Fix pathconf statvfs namespace (bug 18507).
[glibc.git] / sysdeps / unix / sysv / linux / configure.ac
blob6738e2d653f0f042884a0d73ebf950e9554b7750
1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/unix/sysv/linux.
4 define([LIBC_LINUX_VERSION],[2.6.32])dnl
5 if test -n "$sysheaders"; then
6   OLD_CPPFLAGS=$CPPFLAGS
7   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
8 fi
9 define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl
10 AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl
11 AC_TRY_COMPILE([#include <linux/version.h>
12 #if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < ]dnl
13 patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl
14 [ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[
15 # error kernel headers missing or too old
16 #endif], [],
17                [libc_cv_linuxVER='LIBC_LINUX_VERSION or later'],
18                [libc_cv_linuxVER='missing or too old!'])])
19 if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then
20   AC_MSG_ERROR([GNU libc requires kernel header files from
21 Linux LIBC_LINUX_VERSION or later to be installed before configuring.
22 The kernel header files are found usually in /usr/include/asm and
23 /usr/include/linux; make sure these directories use files from
24 Linux LIBC_LINUX_VERSION or later.  This check uses <linux/version.h>, so
25 make sure that file was built correctly when installing the kernel header
26 files.  To use kernel headers not from /usr/include/linux, use the
27 configure option --with-headers.])
30 # If the user gave a minimal version number test whether the available
31 # kernel headers are young enough.  Additionally we have minimal
32 # kernel versions for some architectures.  If a previous configure fragment
33 # set arch_minimum_kernel already, let that override our defaults here.
34 # Note that we presume such a fragment has set libc_cv_gcc_unwind_find_fde
35 # if appropriate too.
36 test -n "$arch_minimum_kernel" || arch_minimum_kernel=2.6.32
37 if test -n "$minimum_kernel"; then
38   changequote(,)
39   user_version=$((`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`))
40   arch_version=$((`echo "$arch_minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`))
41   changequote([,])
42   if test $user_version -lt $arch_version; then
43     AC_MSG_WARN([minimum kernel version reset to $arch_minimum_kernel])
44     minimum_kernel=$arch_minimum_kernel
45   fi
46 else
47   minimum_kernel=$arch_minimum_kernel
50 AC_MSG_CHECKING(for kernel header at least $minimum_kernel)
51 changequote(,)dnl
52 decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
53 abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
54 changequote([,])dnl
55 AC_TRY_COMPILE([#include <linux/version.h>
56 #if LINUX_VERSION_CODE < $decnum
57 # error kernel headers too old
58 #endif], [], [libc_minimum_kernel=ok], [libc_minimum_kernel='too old!'])
59 AC_MSG_RESULT($libc_minimum_kernel)
60 if test "$libc_minimum_kernel" = ok; then
61   AC_DEFINE_UNQUOTED(__LINUX_KERNEL_VERSION, $decnum)
62   AC_DEFINE_UNQUOTED(__ABI_TAG_VERSION, $abinum)
63 else
64   AC_MSG_ERROR([*** The available kernel headers are older than the requested
65 *** compatible kernel version])
68 # Until we start requiring 2.6.37+ headers, we need to check for the
69 # availability of linux/fanotify.h for testing purposes.
70 AC_CHECK_HEADER(linux/fanotify.h,
71   [AC_DEFINE(HAVE_LINUX_FANOTIFY_H)], ,
72   [/* No default includes.  */])
74 if test -n "$sysheaders"; then
75   CPPFLAGS=$OLD_CPPFLAGS
78 if test "$prefix" = "/usr/local" -o "$prefix" = "/usr/local/" -o "$prefix" = "NONE"; then
79   if test $enable_sanity = yes; then
80     echo "\
81 *** On GNU/Linux systems the GNU C Library should not be installed into
82 *** /usr/local since this might make your system totally unusable.
83 *** We strongly advise to use a different prefix.  For details read the FAQ.
84 *** If you really mean to do this, run configure again using the extra
85 *** parameter \`--disable-sanity-checks'."
86     exit 1
87   else
88     echo "\
89 *** WARNING: Do you really want to install the GNU C Library into /usr/local?
90 *** This might make your system totally unusable, for details read the FAQ."
91   fi
95 # One Linux we use ldconfig.
96 use_ldconfig=yes
98 if test $host = $build; then
99   # If $prefix/include/{net,scsi} are symlinks, make install will
100   # clobber what they're linked to (probably a kernel tree).
101   # test -L ought to work on all Linux boxes.
102   if test "x$prefix" != xNONE; then
103     ac_prefix=$prefix
104   else
105     ac_prefix=$ac_default_prefix
106   fi
107   AC_MSG_CHECKING([for symlinks in ${ac_prefix}/include])
108   ac_message=
109   if test -L ${ac_prefix}/include/net; then
110     ac_message="$ac_message
111    ${ac_prefix}/include/net is a symlink"
112   fi
113   if test -L ${ac_prefix}/include/scsi; then
114     ac_message="$ac_message
115    ${ac_prefix}/include/scsi is a symlink"
116   fi
117   if test -n "$ac_message"; then
118     AC_MSG_ERROR([$ac_message
119 \`make install' will destroy the target of the link(s).
120 Delete the links and re-run configure, or better still, move the entire
121 ${ac_prefix}/include directory out of the way.])
122   else
123     AC_MSG_RESULT(ok)
124   fi
127 # We have inlined syscalls.
128 AC_DEFINE(HAVE_INLINED_SYSCALLS)