1GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2# Local configure fragment for sysdeps/unix/sysv/linux.
3
4define([LIBC_LINUX_VERSION],[3.2.0])dnl
5if test -n "$sysheaders"; then
6  OLD_CPPFLAGS=$CPPFLAGS
7  CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
8fi
9define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl
10AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl
11AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <linux/version.h>
12#if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < ]dnl
13patsubst(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!'])])
19if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then
20  AC_MSG_ERROR([GNU libc requires kernel header files from
21Linux LIBC_LINUX_VERSION or later to be installed before configuring.
22The kernel header files are found usually in /usr/include/asm and
23/usr/include/linux; make sure these directories use files from
24Linux LIBC_LINUX_VERSION or later.  This check uses <linux/version.h>, so
25make sure that file was built correctly when installing the kernel header
26files.  To use kernel headers not from /usr/include/linux, use the
27configure option --with-headers.])
28fi
29
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.
36test -n "$arch_minimum_kernel" || arch_minimum_kernel=3.2.0
37if 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
46else
47  minimum_kernel=$arch_minimum_kernel
48fi
49
50AC_MSG_CHECKING(for kernel header at least $minimum_kernel)
51changequote(,)dnl
52decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
53abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
54changequote([,])dnl
55AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#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!'])
59AC_MSG_RESULT($libc_minimum_kernel)
60if test "$libc_minimum_kernel" = ok; then
61  AC_DEFINE_UNQUOTED(__LINUX_KERNEL_VERSION, $decnum)
62  AC_DEFINE_UNQUOTED(__ABI_TAG_VERSION, $abinum)
63else
64  AC_MSG_ERROR([*** The available kernel headers are older than the requested
65*** compatible kernel version])
66fi
67
68if test -n "$sysheaders"; then
69  CPPFLAGS=$OLD_CPPFLAGS
70fi
71
72if test "$prefix" = "/usr/local" -o "$prefix" = "/usr/local/" -o "$prefix" = "NONE"; then
73  if test $enable_sanity = yes; then
74    echo "\
75*** On GNU/Linux systems the GNU C Library should not be installed into
76*** /usr/local since this might make your system totally unusable.
77*** We strongly advise to use a different prefix.  For details read the FAQ.
78*** If you really mean to do this, run configure again using the extra
79*** parameter \`--disable-sanity-checks'."
80    exit 1
81  else
82    echo "\
83*** WARNING: Do you really want to install the GNU C Library into /usr/local?
84*** This might make your system totally unusable, for details read the FAQ."
85  fi
86fi
87
88
89# One Linux we use ldconfig.
90use_ldconfig=yes
91
92if test $host = $build; then
93  # If $prefix/include/{net,scsi} are symlinks, make install will
94  # clobber what they're linked to (probably a kernel tree).
95  # test -L ought to work on all Linux boxes.
96  if test "x$prefix" != xNONE; then
97    ac_prefix=$prefix
98  else
99    ac_prefix=$ac_default_prefix
100  fi
101  AC_MSG_CHECKING([for symlinks in ${ac_prefix}/include])
102  ac_message=
103  if test -L ${ac_prefix}/include/net; then
104    ac_message="$ac_message
105   ${ac_prefix}/include/net is a symlink"
106  fi
107  if test -L ${ac_prefix}/include/scsi; then
108    ac_message="$ac_message
109   ${ac_prefix}/include/scsi is a symlink"
110  fi
111  if test -n "$ac_message"; then
112    AC_MSG_ERROR([$ac_message
113\`make install' will destroy the target of the link(s).
114Delete the links and re-run configure, or better still, move the entire
115${ac_prefix}/include directory out of the way.])
116  else
117    AC_MSG_RESULT(ok)
118  fi
119fi
120
121# We have inlined syscalls.
122AC_DEFINE(HAVE_INLINED_SYSCALLS)
123