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)/'`;
53abinumstr=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1.\2.\3/'`;
54abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
55changequote([,])dnl
56AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#include <linux/version.h>
57#if LINUX_VERSION_CODE < $decnum
58# error kernel headers too old
59#endif]], [[]])], [libc_minimum_kernel=ok], [libc_minimum_kernel='too old!'])
60AC_MSG_RESULT($libc_minimum_kernel)
61if test "$libc_minimum_kernel" = ok; then
62  AC_DEFINE_UNQUOTED(__LINUX_KERNEL_VERSION, $decnum)
63  AC_DEFINE_UNQUOTED(__LINUX_KERNEL_VERSION_STR, "$abinumstr")
64  AC_DEFINE_UNQUOTED(__ABI_TAG_VERSION, $abinum)
65else
66  AC_MSG_ERROR([*** The available kernel headers are older than the requested
67*** compatible kernel version])
68fi
69
70if test -n "$sysheaders"; then
71  CPPFLAGS=$OLD_CPPFLAGS
72fi
73
74if test "$prefix" = "/usr/local" -o "$prefix" = "/usr/local/" -o "$prefix" = "NONE"; then
75  if test $enable_sanity = yes; then
76    echo "\
77*** On GNU/Linux systems the GNU C Library should not be installed into
78*** /usr/local since this might make your system totally unusable.
79*** We strongly advise to use a different prefix.  For details read the FAQ.
80*** If you really mean to do this, run configure again using the extra
81*** parameter \`--disable-sanity-checks'."
82    exit 1
83  else
84    echo "\
85*** WARNING: Do you really want to install the GNU C Library into /usr/local?
86*** This might make your system totally unusable, for details read the FAQ."
87  fi
88fi
89
90
91# One Linux we use ldconfig.
92use_ldconfig=yes
93
94if test $host = $build; then
95  # If $prefix/include/{net,scsi} are symlinks, make install will
96  # clobber what they're linked to (probably a kernel tree).
97  # test -L ought to work on all Linux boxes.
98  if test "x$prefix" != xNONE; then
99    ac_prefix=$prefix
100  else
101    ac_prefix=$ac_default_prefix
102  fi
103  AC_MSG_CHECKING([for symlinks in ${ac_prefix}/include])
104  ac_message=
105  if test -L ${ac_prefix}/include/net; then
106    ac_message="$ac_message
107   ${ac_prefix}/include/net is a symlink"
108  fi
109  if test -L ${ac_prefix}/include/scsi; then
110    ac_message="$ac_message
111   ${ac_prefix}/include/scsi is a symlink"
112  fi
113  if test -n "$ac_message"; then
114    AC_MSG_ERROR([$ac_message
115\`make install' will destroy the target of the link(s).
116Delete the links and re-run configure, or better still, move the entire
117${ac_prefix}/include directory out of the way.])
118  else
119    AC_MSG_RESULT(ok)
120  fi
121fi
122
123# We have inlined syscalls.
124AC_DEFINE(HAVE_INLINED_SYSCALLS)
125