VirtualBox

source: kBuild/trunk/src/kmk/acinclude.m4@ 3633

Last change on this file since 3633 was 3281, checked in by bird, 6 years ago

kmk/configure.ac: Detect st_atim.nsec too as we need this for our touch implementation.

  • Property svn:eol-style set to native
File size: 5.9 KB
Line 
1dnl acinclude.m4 -- Extra macros needed for GNU make.
2dnl
3dnl Automake will incorporate this into its generated aclocal.m4.
4dnl Copyright (C) 1998-2016 Free Software Foundation, Inc.
5dnl This file is part of GNU Make.
6dnl
7dnl GNU Make is free software; you can redistribute it and/or modify it under
8dnl the terms of the GNU General Public License as published by the Free
9dnl Software Foundation; either version 3 of the License, or (at your option)
10dnl any later version.
11dnl
12dnl GNU Make is distributed in the hope that it will be useful, but WITHOUT
13dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for.
15dnl more details.
16dnl
17dnl You should have received a copy of the GNU General Public License along
18dnl with this program. If not, see <http://www.gnu.org/licenses/>.
19
20dnl ---------------------------------------------------------------------------
21dnl Got this from the lynx 2.8 distribution.
22dnl by T.E.Dickey <[email protected]>
23dnl and Jim Spath <[email protected]>
24dnl and Philippe De Muyter <[email protected]>
25dnl
26dnl Created: 1997/1/28
27dnl Updated: 1997/12/23
28dnl ---------------------------------------------------------------------------
29dnl After checking for functions in the default $LIBS, make a further check
30dnl for the functions that are netlib-related (these aren't always in the
31dnl libc, etc., and have to be handled specially because there are conflicting
32dnl and broken implementations.
33dnl Common library requirements (in order):
34dnl -lresolv -lsocket -lnsl
35dnl -lnsl -lsocket
36dnl -lsocket
37dnl -lbsd
38AC_DEFUN([CF_NETLIBS],[
39cf_test_netlibs=no
40AC_MSG_CHECKING(for network libraries)
41AC_CACHE_VAL(cf_cv_netlibs,[
42AC_MSG_RESULT(working...)
43cf_cv_netlibs=""
44cf_test_netlibs=yes
45AC_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
51AC_CHECK_LIB(inet,main,cf_cv_netlibs="-linet $cf_cv_netlibs")
52#
53if test "$ac_cv_func_lsocket" != no ; then
54AC_CHECK_FUNCS(socket,,[
55 CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
56 CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
57fi
58#
59AC_CHECK_FUNCS(gethostbyname,,[
60 CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
61])
62LIBS="$LIBS $cf_cv_netlibs"
63test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG
64])dnl
65dnl ---------------------------------------------------------------------------
66dnl Re-check on a function to see if we can pick it up by adding a library.
67dnl $1 = function to check
68dnl $2 = library to check in
69dnl $3 = environment to update (e.g., $LIBS)
70dnl $4 = what to do if this fails
71dnl
72dnl This uses 'unset' if the shell happens to support it, but leaves the
73dnl configuration variable set to 'unknown' if not. This is a little better
74dnl than the normal autoconf test, which gives misleading results if a test
75dnl for the function is made (e.g., with AC_CHECK_FUNC) after this macro is
76dnl used (autoconf does not distinguish between a null token and one that is
77dnl set to 'no').
78AC_DEFUN([CF_RECHECK_FUNC],[
79AC_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
89dnl ---------------------------------------------------------------------------
90dnl Make an uppercase version of a variable
91dnl $1=uppercase($2)
92AC_DEFUN([CF_UPPER],
93[
94changequote(,)dnl
95$1=`echo $2 | tr '[a-z]' '[A-Z]'`
96changequote([,])dnl
97])dnl
98
99
100dnl ---------------------------------------------------------------------------
101dnl From Paul Eggert <[email protected]>
102dnl Update for Darwin by Troy Runkel <[email protected]>
103dnl Update for AIX by Olexiy Buyanskyy (Savannah bug 32485)
104
105AC_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
134dnl bird: Copy of above for atime
135AC_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
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette