1 | dnl acinclude.m4 -- Extra macros needed for GNU make.
|
---|
2 | dnl
|
---|
3 | dnl Automake will incorporate this into its generated aclocal.m4.
|
---|
4 | dnl Copyright (C) 1998-2016 Free Software Foundation, Inc.
|
---|
5 | dnl This file is part of GNU Make.
|
---|
6 | dnl
|
---|
7 | dnl GNU Make is free software; you can redistribute it and/or modify it under
|
---|
8 | dnl the terms of the GNU General Public License as published by the Free
|
---|
9 | dnl Software Foundation; either version 3 of the License, or (at your option)
|
---|
10 | dnl any later version.
|
---|
11 | dnl
|
---|
12 | dnl GNU Make is distributed in the hope that it will be useful, but WITHOUT
|
---|
13 | dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
---|
14 | dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for.
|
---|
15 | dnl more details.
|
---|
16 | dnl
|
---|
17 | dnl You should have received a copy of the GNU General Public License along
|
---|
18 | dnl with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 |
|
---|
20 | dnl ---------------------------------------------------------------------------
|
---|
21 | dnl Got this from the lynx 2.8 distribution.
|
---|
22 | dnl by T.E.Dickey <[email protected]>
|
---|
23 | dnl and Jim Spath <[email protected]>
|
---|
24 | dnl and Philippe De Muyter <[email protected]>
|
---|
25 | dnl
|
---|
26 | dnl Created: 1997/1/28
|
---|
27 | dnl Updated: 1997/12/23
|
---|
28 | dnl ---------------------------------------------------------------------------
|
---|
29 | dnl After checking for functions in the default $LIBS, make a further check
|
---|
30 | dnl for the functions that are netlib-related (these aren't always in the
|
---|
31 | dnl libc, etc., and have to be handled specially because there are conflicting
|
---|
32 | dnl and broken implementations.
|
---|
33 | dnl Common library requirements (in order):
|
---|
34 | dnl -lresolv -lsocket -lnsl
|
---|
35 | dnl -lnsl -lsocket
|
---|
36 | dnl -lsocket
|
---|
37 | dnl -lbsd
|
---|
38 | AC_DEFUN([CF_NETLIBS],[
|
---|
39 | cf_test_netlibs=no
|
---|
40 | AC_MSG_CHECKING(for network libraries)
|
---|
41 | AC_CACHE_VAL(cf_cv_netlibs,[
|
---|
42 | AC_MSG_RESULT(working...)
|
---|
43 | cf_cv_netlibs=""
|
---|
44 | cf_test_netlibs=yes
|
---|
45 | AC_CHECK_FUNCS(gethostname,,[
|
---|
46 | CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[
|
---|
47 | CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])])
|
---|
48 | #
|
---|
49 | # FIXME: sequent needs this library (i.e., -lsocket -linet -lnsl), but
|
---|
50 | # I don't know the entrypoints - 97/7/22 TD
|
---|
51 | AC_CHECK_LIB(inet,main,cf_cv_netlibs="-linet $cf_cv_netlibs")
|
---|
52 | #
|
---|
53 | if test "$ac_cv_func_lsocket" != no ; then
|
---|
54 | AC_CHECK_FUNCS(socket,,[
|
---|
55 | CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
|
---|
56 | CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
|
---|
57 | fi
|
---|
58 | #
|
---|
59 | AC_CHECK_FUNCS(gethostbyname,,[
|
---|
60 | CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
|
---|
61 | ])
|
---|
62 | LIBS="$LIBS $cf_cv_netlibs"
|
---|
63 | test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG
|
---|
64 | ])dnl
|
---|
65 | dnl ---------------------------------------------------------------------------
|
---|
66 | dnl Re-check on a function to see if we can pick it up by adding a library.
|
---|
67 | dnl $1 = function to check
|
---|
68 | dnl $2 = library to check in
|
---|
69 | dnl $3 = environment to update (e.g., $LIBS)
|
---|
70 | dnl $4 = what to do if this fails
|
---|
71 | dnl
|
---|
72 | dnl This uses 'unset' if the shell happens to support it, but leaves the
|
---|
73 | dnl configuration variable set to 'unknown' if not. This is a little better
|
---|
74 | dnl than the normal autoconf test, which gives misleading results if a test
|
---|
75 | dnl for the function is made (e.g., with AC_CHECK_FUNC) after this macro is
|
---|
76 | dnl used (autoconf does not distinguish between a null token and one that is
|
---|
77 | dnl set to 'no').
|
---|
78 | AC_DEFUN([CF_RECHECK_FUNC],[
|
---|
79 | AC_CHECK_LIB($2,$1,[
|
---|
80 | CF_UPPER(cf_tr_func,$1)
|
---|
81 | AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func,1,[Define if you have function $1])
|
---|
82 | ac_cv_func_$1=yes
|
---|
83 | $3="-l$2 [$]$3"],[
|
---|
84 | ac_cv_func_$1=unknown
|
---|
85 | unset ac_cv_func_$1 2>/dev/null
|
---|
86 | $4],
|
---|
87 | [[$]$3])
|
---|
88 | ])dnl
|
---|
89 | dnl ---------------------------------------------------------------------------
|
---|
90 | dnl Make an uppercase version of a variable
|
---|
91 | dnl $1=uppercase($2)
|
---|
92 | AC_DEFUN([CF_UPPER],
|
---|
93 | [
|
---|
94 | changequote(,)dnl
|
---|
95 | $1=`echo $2 | tr '[a-z]' '[A-Z]'`
|
---|
96 | changequote([,])dnl
|
---|
97 | ])dnl
|
---|
98 |
|
---|
99 |
|
---|
100 | dnl ---------------------------------------------------------------------------
|
---|
101 | dnl From Paul Eggert <[email protected]>
|
---|
102 | dnl Update for Darwin by Troy Runkel <[email protected]>
|
---|
103 | dnl Update for AIX by Olexiy Buyanskyy (Savannah bug 32485)
|
---|
104 |
|
---|
105 | AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
|
---|
106 | [AC_CACHE_CHECK([for nanoseconds field of struct stat],
|
---|
107 | ac_cv_struct_st_mtim_nsec,
|
---|
108 | [ac_save_CPPFLAGS="$CPPFLAGS"
|
---|
109 | ac_cv_struct_st_mtim_nsec=no
|
---|
110 | # st_mtim.tv_nsec -- the usual case
|
---|
111 | # st_mtim._tv_nsec -- Solaris 2.6, if
|
---|
112 | # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
|
---|
113 | # && !defined __EXTENSIONS__)
|
---|
114 | # st_mtim.st__tim.tv_nsec -- UnixWare 2.1.2
|
---|
115 | # st_mtime_n -- AIX 5.2 and above
|
---|
116 | # st_mtimespec.tv_nsec -- Darwin (Mac OSX)
|
---|
117 | for ac_val in st_mtim.tv_nsec st_mtim._tv_nsec st_mtim.st__tim.tv_nsec st_mtime_n st_mtimespec.tv_nsec; do
|
---|
118 | CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
|
---|
119 | AC_TRY_COMPILE([#include <sys/types.h>
|
---|
120 | #include <sys/stat.h>
|
---|
121 | ], [struct stat s; s.ST_MTIM_NSEC;],
|
---|
122 | [ac_cv_struct_st_mtim_nsec=$ac_val; break])
|
---|
123 | done
|
---|
124 | CPPFLAGS="$ac_save_CPPFLAGS"
|
---|
125 | ])
|
---|
126 |
|
---|
127 | if test $ac_cv_struct_st_mtim_nsec != no; then
|
---|
128 | AC_DEFINE_UNQUOTED([ST_MTIM_NSEC], [$ac_cv_struct_st_mtim_nsec],
|
---|
129 | [Define if struct stat contains a nanoseconds field])
|
---|
130 | fi
|
---|
131 | ]
|
---|
132 | )
|
---|
133 |
|
---|
134 | dnl bird: Copy of above for atime
|
---|
135 | AC_DEFUN([AC_STRUCT_ST_ATIM_NSEC],
|
---|
136 | [AC_CACHE_CHECK([for nanoseconds access time field of struct stat],
|
---|
137 | ac_cv_struct_st_atim_nsec,
|
---|
138 | [ac_save_CPPFLAGS="$CPPFLAGS"
|
---|
139 | ac_cv_struct_st_atim_nsec=no
|
---|
140 | # st_atim.tv_nsec -- the usual case
|
---|
141 | # st_atim._tv_nsec -- Solaris 2.6, if
|
---|
142 | # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
|
---|
143 | # && !defined __EXTENSIONS__)
|
---|
144 | # st_atim.st__tim.tv_nsec -- UnixWare 2.1.2
|
---|
145 | # st_atime_n -- AIX 5.2 and above
|
---|
146 | # st_atimespec.tv_nsec -- Darwin (Mac OSX)
|
---|
147 | for ac_val in st_atim.tv_nsec st_atim._tv_nsec st_atim.st__tim.tv_nsec st_atime_n st_atimespec.tv_nsec; do
|
---|
148 | CPPFLAGS="$ac_save_CPPFLAGS -DST_ATIM_NSEC=$ac_val"
|
---|
149 | AC_TRY_COMPILE([#include <sys/types.h>
|
---|
150 | #include <sys/stat.h>
|
---|
151 | ], [struct stat s; s.ST_ATIM_NSEC;],
|
---|
152 | [ac_cv_struct_st_atim_nsec=$ac_val; break])
|
---|
153 | done
|
---|
154 | CPPFLAGS="$ac_save_CPPFLAGS"
|
---|
155 | ])
|
---|
156 |
|
---|
157 | if test $ac_cv_struct_st_atim_nsec != no; then
|
---|
158 | AC_DEFINE_UNQUOTED([ST_ATIM_NSEC], [$ac_cv_struct_st_atim_nsec],
|
---|
159 | [Define if struct stat contains a nanoseconds field])
|
---|
160 | fi
|
---|
161 | ]
|
---|
162 | )
|
---|
163 |
|
---|