Don't add -lreadline to LIBS
[freeradius.git] / aclocal.m4
1 # generated automatically by aclocal 1.10 -*- Autoconf -*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 # 2005, 2006  Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
15
16 # Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
17 #
18 # This file is free software; the Free Software Foundation
19 # gives unlimited permission to copy and/or distribute it,
20 # with or without modifications, as long as this notice is preserved.
21
22 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
23 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
24 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
25 #
26 # Of course, Automake must honor this variable whenever it calls a
27 # tool from the auxiliary directory.  The problem is that $srcdir (and
28 # therefore $ac_aux_dir as well) can be either absolute or relative,
29 # depending on how configure is run.  This is pretty annoying, since
30 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
31 # source directory, any form will work fine, but in subdirectories a
32 # relative path needs to be adjusted first.
33 #
34 # $ac_aux_dir/missing
35 #    fails when called from a subdirectory if $ac_aux_dir is relative
36 # $top_srcdir/$ac_aux_dir/missing
37 #    fails if $ac_aux_dir is absolute,
38 #    fails when called from a subdirectory in a VPATH build with
39 #          a relative $ac_aux_dir
40 #
41 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
42 # are both prefixed by $srcdir.  In an in-source build this is usually
43 # harmless because $srcdir is `.', but things will broke when you
44 # start a VPATH build or use an absolute $srcdir.
45 #
46 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
47 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
48 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
49 # and then we would define $MISSING as
50 #   MISSING="\${SHELL} $am_aux_dir/missing"
51 # This will work as long as MISSING is not called from configure, because
52 # unfortunately $(top_srcdir) has no meaning in configure.
53 # However there are other variables, like CC, which are often used in
54 # configure, and could therefore not use this "fixed" $ac_aux_dir.
55 #
56 # Another solution, used here, is to always expand $ac_aux_dir to an
57 # absolute PATH.  The drawback is that using absolute paths prevent a
58 # configured tree to be moved without reconfiguration.
59
60 AC_DEFUN([AM_AUX_DIR_EXPAND],
61 [dnl Rely on autoconf to set up CDPATH properly.
62 AC_PREREQ([2.50])dnl
63 # expand $ac_aux_dir to an absolute path
64 am_aux_dir=`cd $ac_aux_dir && pwd`
65 ])
66
67 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
68
69 # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
70 # Free Software Foundation, Inc.
71 #
72 # This file is free software; the Free Software Foundation
73 # gives unlimited permission to copy and/or distribute it,
74 # with or without modifications, as long as this notice is preserved.
75
76 # serial 5
77
78 # AM_MISSING_PROG(NAME, PROGRAM)
79 # ------------------------------
80 AC_DEFUN([AM_MISSING_PROG],
81 [AC_REQUIRE([AM_MISSING_HAS_RUN])
82 $1=${$1-"${am_missing_run}$2"}
83 AC_SUBST($1)])
84
85
86 # AM_MISSING_HAS_RUN
87 # ------------------
88 # Define MISSING if not defined so far and test if it supports --run.
89 # If it does, set am_missing_run to use it, otherwise, to nothing.
90 AC_DEFUN([AM_MISSING_HAS_RUN],
91 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
92 AC_REQUIRE_AUX_FILE([missing])dnl
93 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
94 # Use eval to expand $SHELL
95 if eval "$MISSING --run true"; then
96   am_missing_run="$MISSING --run "
97 else
98   am_missing_run=
99   AC_MSG_WARN([`missing' script is too old or missing])
100 fi
101 ])
102
103 m4_include([libtool.m4])
104 m4_include([acinclude.m4])
105
106 #  See if the compilation works with __thread, for thread-local storage
107 #
108 AC_DEFUN([FR_TLS],
109 [
110     AC_MSG_CHECKING(for TLS)
111     AC_RUN_IFELSE([AC_LANG_SOURCE([[ static __thread int val; int main() { return 0; } ]])],[have_tls=yes],[have_tls=no],[have_tls=no ])
112     AC_MSG_RESULT($have_tls)
113     if test "$have_tls" = "yes"; then
114         AC_DEFINE([HAVE_THREAD_TLS],[1],[Define if the compiler supports __thread])
115     fi
116 ])
117
118
119 AC_DEFUN([AC_LIB_READLINE], [
120   AC_CACHE_CHECK([for a readline compatible library],
121                  ac_cv_lib_readline, [
122     ORIG_LIBS=$LIBS
123     for readline_lib in readline edit editline; do
124       for termcap_lib in "" termcap curses ncurses; do
125         if test -z "$termcap_lib"; then
126           TRY_LIB="-l$readline_lib"
127         else
128           TRY_LIB="-l$readline_lib -l$termcap_lib"
129         fi
130         LIBS="$ORIG_LIBS $TRY_LIB"
131         AC_TRY_LINK_FUNC(readline, ac_cv_lib_readline="$TRY_LIB")
132         if test -n "$ac_cv_lib_readline"; then
133           LIBREADLINE="$TRY_LIB"
134           AC_SUBST(LIBREADLINE)
135           break
136         fi
137       done
138       if test -n "$ac_cv_lib_readline"; then
139         break
140       fi
141     done
142     if test -z "$ac_cv_lib_readline"; then
143       ac_cv_lib_readline="no"
144     fi
145     LIBS=$ORIG_LIBS
146   ])
147
148   if test "$ac_cv_lib_readline" != "no"; then
149     AC_DEFINE(HAVE_LIBREADLINE, 1,
150               [Define if you have a readline compatible library])
151     AC_CHECK_HEADERS(readline.h readline/readline.h)
152     AC_CACHE_CHECK([whether readline supports history],
153                    ac_cv_lib_readline_history, [
154       ac_cv_lib_readline_history="no"
155       AC_TRY_LINK_FUNC(add_history, ac_cv_lib_readline_history="yes")
156     ])
157     if test "$ac_cv_lib_readline_history" = "yes"; then
158       AC_DEFINE(HAVE_READLINE_HISTORY, 1,
159                 [Define if your readline library has \`add_history'])
160       AC_CHECK_HEADERS(history.h readline/history.h)
161     fi
162   fi
163 ])