1 # Copyright (C) 2006 Free Software Foundation, Inc.
2 # This configure.ac script is free software; the Free Software Foundation
3 # gives unlimited permission to copy, distribute and modify it.
5 AC_INIT([ctdlsh], [1.0], [bug-automake@gnu.org])
6 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
8 AC_CONFIG_HEADERS([config.h])
10 ##########################################################################
11 # adding the readline library (e.g. with static name 'libreadline.a')
12 ##########################################################################
14 # adding the lib to the files to link
15 LIBS="-lreadline $LIBS"
17 # introduce the optional configure parameter for a non-standard install prefix of readline
18 AC_ARG_WITH([readline],
19 [AS_HELP_STRING([--with-readline=prefix],
20 [try this for a non-standard install prefix of the readline library])],
24 # if optional parameter used, extend path flags for compliler and linker
25 if test $readlinePATHSET = 1 ; then
26 # extend the compiler and linker flags according to the path set
27 AM_CXXFLAGS="$AM_CXXFLAGS -I$with_readline/include"
28 AM_LDFLAGS="$AM_LDFLAGS -L$with_readline/lib"
31 ##########################################################################
34 ##########################################################################
35 # check for readline library
36 ##########################################################################
38 # store current *FLAGS and merge with AM_*FLAGS for compilation and linker check
39 OLD_CXXFLAGS=$CXXFLAGS;
41 CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
42 LDFLAGS="$AM_LDFLAGS $LDFLAGS"
44 # ensure the library to check for is covered by the LIBS variable
46 LIBS="$LIBS -lreadline"
48 # check for readline library headers
49 AC_MSG_CHECKING([for the readline library headers])
50 # try to compile a file that includes a header of the library readline
51 AC_COMPILE_IFELSE([[#include <readline/readline.h>]],
52 [AC_MSG_RESULT([found])
53 # try to link the function 'rl_initialize' out of library readline
54 AC_MSG_CHECKING([whether the readline library can be linked])
56 [AC_LANG_PROGRAM([[#include <readline/readline.h>]],
57 [[rl_initialize();]])],
61 LIBS=$OLD_LIBS; dnl reset to old value since readline was not found
63 [AC_MSG_RESULT([not found])
66 # reset original *FLAGS
67 CXXFLAGS=$OLD_CXXFLAGS
70 # handle check results
71 if test $FOUND_readline != 1; then
73 AC_MSG_NOTICE([The readline library was not found!])
74 if test $readlinePATHSET = 1 ; then
75 AC_MSG_NOTICE([ The install prefix '$with_readline' for the readline library was set.])
76 AC_MSG_NOTICE([ --> Maybe wrong ???])
78 AC_MSG_NOTICE([ No non-standard install prefix was set.])
79 AC_MSG_NOTICE([ --> You might want to use '--with-readline=PREFIX' ?!?])
82 AC_MSG_ERROR([ readline library is an essential dependency : cannot build and stop here !])
85 ##########################################################################