x86: In ld.so, diagnose missing APX support in APX-only builds
[glibc.git] / sysdeps / unix / sysv / linux / configure.ac
blobc177e082a96d1525e1ff209d2e537a7ed96f019f
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],[3.2.0])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_PREPROC_IFELSE([AC_LANG_PROGRAM([[#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=3.2.0
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 abinumstr=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1.\2.\3/'`;
54 abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
55 changequote([,])dnl
56 AC_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!'])
60 AC_MSG_RESULT($libc_minimum_kernel)
61 if 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)
65 else
66   AC_MSG_ERROR([*** The available kernel headers are older than the requested
67 *** compatible kernel version])
70 if test -n "$sysheaders"; then
71   CPPFLAGS=$OLD_CPPFLAGS
74 if 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
91 # One Linux we use ldconfig.
92 use_ldconfig=yes
94 if 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).
116 Delete 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
123 # We have inlined syscalls.
124 AC_DEFINE(HAVE_INLINED_SYSCALLS)