* texinfo.tex (\value): handle active _ or - in argument (happens
[make.git] / acinclude.m4
blob343c333610fc038f2379c1b19d078746f99745fe
1 dnl acinclude.m4 -- Extra macros needed for GNU make.
2 dnl
3 dnl Automake will incorporate this into its generated aclocal.m4.
5 dnl ---------------------------------------------------------------------------
6 dnl Got this from the lynx 2.8 distribution.
7 dnl by T.E.Dickey <dickey@clark.net>
8 dnl and Jim Spath <jspath@mail.bcpl.lib.md.us>
9 dnl and Philippe De Muyter <phdm@macqel.be>
10 dnl
11 dnl Created: 1997/1/28
12 dnl Updated: 1997/12/23
13 dnl ---------------------------------------------------------------------------
14 dnl After checking for functions in the default $LIBS, make a further check
15 dnl for the functions that are netlib-related (these aren't always in the
16 dnl libc, etc., and have to be handled specially because there are conflicting
17 dnl and broken implementations.
18 dnl Common library requirements (in order):
19 dnl     -lresolv -lsocket -lnsl
20 dnl     -lnsl -lsocket
21 dnl     -lsocket
22 dnl     -lbsd
23 AC_DEFUN([CF_NETLIBS],[
24 cf_test_netlibs=no
25 AC_MSG_CHECKING(for network libraries)
26 AC_CACHE_VAL(cf_cv_netlibs,[
27 AC_MSG_RESULT(working...)
28 cf_cv_netlibs=""
29 cf_test_netlibs=yes
30 AC_CHECK_FUNCS(gethostname,,[
31         CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[
32                 CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])])
34 # FIXME:  sequent needs this library (i.e., -lsocket -linet -lnsl), but
35 # I don't know the entrypoints - 97/7/22 TD
36 AC_CHECK_LIB(inet,main,cf_cv_netlibs="-linet $cf_cv_netlibs")
38 if test "$ac_cv_func_lsocket" != no ; then
39 AC_CHECK_FUNCS(socket,,[
40         CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
41                 CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
44 AC_CHECK_FUNCS(gethostbyname,,[
45         CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
47 AC_CHECK_FUNCS(strcasecmp,,[
48         CF_RECHECK_FUNC(strcasecmp,resolv,cf_cv_netlibs)])
50 LIBS="$LIBS $cf_cv_netlibs"
51 test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG
52 ])dnl
53 dnl ---------------------------------------------------------------------------
54 dnl Re-check on a function to see if we can pick it up by adding a library.
55 dnl     $1 = function to check
56 dnl     $2 = library to check in
57 dnl     $3 = environment to update (e.g., $LIBS)
58 dnl     $4 = what to do if this fails
59 dnl
60 dnl This uses 'unset' if the shell happens to support it, but leaves the
61 dnl configuration variable set to 'unknown' if not.  This is a little better
62 dnl than the normal autoconf test, which gives misleading results if a test
63 dnl for the function is made (e.g., with AC_CHECK_FUNC) after this macro is
64 dnl used (autoconf does not distinguish between a null token and one that is
65 dnl set to 'no').
66 AC_DEFUN([CF_RECHECK_FUNC],[
67 AC_CHECK_LIB($2,$1,[
68         CF_UPPER(cf_tr_func,$1)
69         AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func)
70         ac_cv_func_$1=yes
71         $3="-l$2 [$]$3"],[
72         ac_cv_func_$1=unknown
73         unset ac_cv_func_$1 2>/dev/null
74         $4],
75         [[$]$3])
76 ])dnl
77 dnl ---------------------------------------------------------------------------
78 dnl Make an uppercase version of a variable
79 dnl $1=uppercase($2)
80 AC_DEFUN([CF_UPPER],
82 changequote(,)dnl
83 $1=`echo $2 | tr '[a-z]' '[A-Z]'`
84 changequote([,])dnl
85 ])dnl
87 dnl ---------------------------------------------------------------------------
88 dnl Got this from the GNU fileutils 3.16r distribution
89 dnl by Paul Eggert <egger@twinsun.com>
90 dnl ---------------------------------------------------------------------------
92 dnl The problem is that the default compilation flags in Solaris 2.6 won't
93 dnl let programs access large files;  you need to tell the compiler that
94 dnl you actually want your programs to work on large files.  For more
95 dnl details about this brain damage please see:
96 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
98 AC_DEFUN(AC_LFS,
99 [dnl
100   # If available, prefer support for large files unless the user specified
101   # one of the CPPFLAGS, LDFLAGS, or LIBS variables.
102   AC_MSG_CHECKING(whether large file support needs explicit enabling)
103   ac_getconfs=''
104   ac_result=yes
105   ac_set=''
106   ac_shellvars='CPPFLAGS LDFLAGS LIBS'
107   for ac_shellvar in $ac_shellvars; do
108     case $ac_shellvar in
109       CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;;
110       *) ac_lfsvar=LFS_$ac_shellvar ;;
111     esac
112     eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
113     (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
114     ac_getconf=`getconf $ac_lfsvar`
115     ac_getconfs=$ac_getconfs$ac_getconf
116     eval ac_test_$ac_shellvar=\$ac_getconf
117   done
118   case "$ac_result$ac_getconfs" in
119     yes) ac_result=no ;;
120   esac
121   case "$ac_result$ac_set" in
122     yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
123   esac
124   AC_MSG_RESULT($ac_result)
125   case $ac_result in
126     yes)
127       for ac_shellvar in $ac_shellvars; do
128         eval $ac_shellvar=\$ac_test_$ac_shellvar
129       done ;;
130   esac