VirtualBox

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

Last change on this file since 1903 was 903, checked in by bird, 18 years ago

Merged with the 2007-05-23 CVS. Added rsort and fixed a couple of windows build issues.

  • Property svn:eol-style set to native
File size: 4.7 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, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
5dnl Free Software Foundation, Inc.
6dnl This file is part of GNU Make.
7dnl
8dnl GNU Make is free software; you can redistribute it and/or modify it
9dnl under the terms of the GNU General Public License as published by
10dnl the Free Software Foundation; either version 2, or (at your option)
11dnl any later version.
12dnl
13dnl GNU Make is distributed in the hope that it will be useful, but
14dnl WITHOUT ANY WARRANTY; without even the implied warranty of
15dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16dnl General Public License for more details.
17dnl
18dnl You should have received a copy of the GNU General Public License
19dnl along with GNU Make; see the file COPYING. If not, write to the
20dnl Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
21dnl MA 02110-1301 USA.
22
23
24dnl ---------------------------------------------------------------------------
25dnl Got this from the lynx 2.8 distribution.
26dnl by T.E.Dickey <[email protected]>
27dnl and Jim Spath <[email protected]>
28dnl and Philippe De Muyter <[email protected]>
29dnl
30dnl Created: 1997/1/28
31dnl Updated: 1997/12/23
32dnl ---------------------------------------------------------------------------
33dnl After checking for functions in the default $LIBS, make a further check
34dnl for the functions that are netlib-related (these aren't always in the
35dnl libc, etc., and have to be handled specially because there are conflicting
36dnl and broken implementations.
37dnl Common library requirements (in order):
38dnl -lresolv -lsocket -lnsl
39dnl -lnsl -lsocket
40dnl -lsocket
41dnl -lbsd
42AC_DEFUN([CF_NETLIBS],[
43cf_test_netlibs=no
44AC_MSG_CHECKING(for network libraries)
45AC_CACHE_VAL(cf_cv_netlibs,[
46AC_MSG_RESULT(working...)
47cf_cv_netlibs=""
48cf_test_netlibs=yes
49AC_CHECK_FUNCS(gethostname,,[
50 CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[
51 CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])])
52#
53# FIXME: sequent needs this library (i.e., -lsocket -linet -lnsl), but
54# I don't know the entrypoints - 97/7/22 TD
55AC_CHECK_LIB(inet,main,cf_cv_netlibs="-linet $cf_cv_netlibs")
56#
57if test "$ac_cv_func_lsocket" != no ; then
58AC_CHECK_FUNCS(socket,,[
59 CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
60 CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
61fi
62#
63AC_CHECK_FUNCS(gethostbyname,,[
64 CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
65])
66LIBS="$LIBS $cf_cv_netlibs"
67test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG
68])dnl
69dnl ---------------------------------------------------------------------------
70dnl Re-check on a function to see if we can pick it up by adding a library.
71dnl $1 = function to check
72dnl $2 = library to check in
73dnl $3 = environment to update (e.g., $LIBS)
74dnl $4 = what to do if this fails
75dnl
76dnl This uses 'unset' if the shell happens to support it, but leaves the
77dnl configuration variable set to 'unknown' if not. This is a little better
78dnl than the normal autoconf test, which gives misleading results if a test
79dnl for the function is made (e.g., with AC_CHECK_FUNC) after this macro is
80dnl used (autoconf does not distinguish between a null token and one that is
81dnl set to 'no').
82AC_DEFUN([CF_RECHECK_FUNC],[
83AC_CHECK_LIB($2,$1,[
84 CF_UPPER(cf_tr_func,$1)
85 AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func,1,[Define if you have function $1])
86 ac_cv_func_$1=yes
87 $3="-l$2 [$]$3"],[
88 ac_cv_func_$1=unknown
89 unset ac_cv_func_$1 2>/dev/null
90 $4],
91 [[$]$3])
92])dnl
93dnl ---------------------------------------------------------------------------
94dnl Make an uppercase version of a variable
95dnl $1=uppercase($2)
96AC_DEFUN([CF_UPPER],
97[
98changequote(,)dnl
99$1=`echo $2 | tr '[a-z]' '[A-Z]'`
100changequote([,])dnl
101])dnl
102
103
104dnl ---------------------------------------------------------------------------
105dnl From Paul Eggert <[email protected]>
106
107AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
108 [AC_CACHE_CHECK([for nanoseconds field of struct stat.st_mtim],
109 ac_cv_struct_st_mtim_nsec,
110 [ac_save_CPPFLAGS="$CPPFLAGS"
111 ac_cv_struct_st_mtim_nsec=no
112 # tv_nsec -- the usual case
113 # _tv_nsec -- Solaris 2.6, if
114 # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
115 # && !defined __EXTENSIONS__)
116 # st__tim.tv_nsec -- UnixWare 2.1.2
117 for ac_val in tv_nsec _tv_nsec st__tim.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.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)
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