Update.
[glibc.git] / sysdeps / unix / sysv / linux / configure.in
blob709d8e913f7bce9c03b46f4520721012c1974043
1 sinclude(./aclocal.m4)dnl Autoconf lossage
2 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
3 # Local configure fragment for sysdeps/unix/sysv/linux.
5 # On Linux, the default is to use libio instead of stdio.
6 test $stdio = default && stdio=libio
8 # Don't bother trying to generate any glue code to be compatible with the
9 # existing system library, because we are the only system library.
10 inhibit_glue=yes
12 define([LIBC_LINUX_VERSION],[2.0.10])dnl
13 if test -n "$sysheaders"; then
14   OLD_CPPFLAGS=$CPPFLAGS
15   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
17 define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl
18 AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl
19 AC_EGREP_CPP([eat flaming death], [#include <linux/version.h>
20 #if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < ]dnl
21 patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl
22 [ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[
23 eat flaming death
24 #endif],
25              libc_cv_linuxVER='TOO OLD!',
26              libc_cv_linuxVER='LIBC_LINUX_VERSION or later')])
27 if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then
28   AC_MSG_ERROR([GNU libc requires kernel header files from
29 Linux LIBC_LINUX_VERSION or later to be installed before configuring.
30 The kernel header files are found usually in /usr/include/asm and
31 /usr/include/linux; make sure these directories use files from
32 Linux LIBC_LINUX_VERSION or later.  This check uses <linux/version.h>, so
33 make sure that file was built correctly when installing the kernel header
34 files.  To use kernel headers not from /usr/include/linux, use the
35 configure option --with-headers.])
38 # If the user gave a minimal version number test whether the available
39 # kernel headers are young enough.  Additionally we have minimal
40 # kernel versions for some architectures.
41 case "$machine" in
42   alpha*)
43     arch_minimum_kernel=2.1.100
44     libc_cv_gcc_unwind_find_fde=yes
45     ;;
46   i386*)
47     libc_cv_gcc_unwind_find_fde=yes
48     arch_minimum_kernel=2.0.10
49     ;;
50   ia64*)
51     arch_minimum_kernel=2.4.0
52     ;;
53   hppa*)
54     arch_minimum_kernel=2.3.99
55     ;;
56   mips*)
57     arch_minimum_kernel=2.2.15
58     libc_cv_gcc_unwind_find_fde=yes
59     ;;
60   powerpc)
61     libc_cv_gcc_unwind_find_fde=yes
62     arch_minimum_kernel=2.0.10
63     ;;
64   sh*)
65     arch_minimum_kernel=2.3.99
66     libc_cv_gcc_unwind_find_fde=yes
67     ;;
68   sparc*)
69     libc_cv_gcc_unwind_find_fde=yes
70     arch_minimum_kernel=2.0.10
71     ;;
72   x86_64*)
73     arch_minimum_kernel=2.4.0
74     ;;
75   *)
76     arch_minimum_kernel=2.0.10
77     ;;
78 esac
79 if test -n "$minimum_kernel"; then
80   changequote(,)
81   user_version=$((`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`))
82   arch_version=$((`echo "$arch_minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`))
83   changequote([,])
84   if test $user_version -lt $arch_version; then
85     AC_MSG_WARN([minimum kernel version reset to $arch_minimum_kernel])
86     minimum_kernel=$arch_minimum_kernel
87   fi
88 else
89   if test $arch_minimum_kernel != '2.0.10'; then
90     minimum_kernel=$arch_minimum_kernel
91   fi
94 if test -n "$minimum_kernel"; then
95   AC_MSG_CHECKING(for kernel header at least $minimum_kernel)
96 changequote(,)dnl
97   decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
98   abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
99 changequote([,])dnl
100   AC_EGREP_CPP([eat flaming death], [#include <linux/version.h>
101 #if LINUX_VERSION_CODE < $decnum
102 eat flaming death
103 #endif], libc_minimum_kernel='too old!', libc_minimum_kernel=ok)
104   AC_MSG_RESULT($libc_minimum_kernel)
105   if test "$libc_minimum_kernel" = ok; then
106     AC_DEFINE_UNQUOTED(__LINUX_KERNEL_VERSION, $decnum)
107     AC_DEFINE_UNQUOTED(__ABI_TAG_VERSION, $abinum)
108   else
109     AC_MSG_ERROR([*** The available kernel headers are older than the requested
110 *** compatible kernel version])
111   fi
114 # The result of the above test for the use of the FDE code is invalid if
115 # the user overrides the decision about the minimum ABI.
116 if test "$oldest_abi" != default && test "2.2.4" \< "$oldest_abi"; then
117   libc_cv_gcc_unwind_find_fde=no
120 if test -n "$sysheaders"; then
121   CPPFLAGS=$OLD_CPPFLAGS
123 # The Linux filesystem standard prescribes where to place "essential"
124 # files.  I.e., when the installation prefix is "/usr" we have to place
125 # shared library objects and the configuration files on the root partition
126 # in /lib and /etc.
127 if test "$prefix" = "/usr" -o "$prefix" = "/usr/"; then
128   # 64bit libraries on sparc go to /lib64 and not /lib
129   if test "$machine" = "sparc/sparc64" -o "$machine" = "x86_64"; then
130     libc_cv_slibdir="/lib64"
131     if test "$libdir" = '${exec_prefix}/lib'; then
132       libdir='${exec_prefix}/lib64';
133       # Locale data can be shared between 32bit and 64bit libraries
134       libc_cv_localedir='${exec_prefix}/lib/locale'
135     fi
136   else
137     libc_cv_slibdir="/lib"
138   fi
139   # Allow the user to override the path with --sysconfdir
140   if test $sysconfdir = '${prefix}/etc'; then
141     libc_cv_sysconfdir=/etc
142   else
143     libc_cv_sysconfdir=$sysconfdir
144    fi
145   libc_cv_rootsbindir="/sbin"
148 # Under Linux the LinuxThreads add-on should be available.
149 case $add_ons in
150   # It is available.  Good.
151   *linuxthreads*)
152     linuxthreads_missing=
153     ;;
154   *)
155     linuxthreads_missing=yes
156     ;;
157 esac
159 if test "$linuxthreads_missing"; then
160   if test $enable_sanity = yes; then
161     echo "\
162 *** On GNU/Linux systems it is normal to compile GNU libc with the
163 *** \`linuxthreads' add-on.  Without that, the library will be
164 *** incompatible with normal GNU/Linux systems.
165 *** If you really mean to not use this add-on, run configure again
166 *** using the extra parameter \`--disable-sanity-checks'."
167     exit 1
168   else
169     echo "\
170 *** WARNING: Are you sure you do not want to use the \`linuxthreads'
171 *** add-on?"
172   fi
175 # One Linux we use ldconfig.
176 use_ldconfig=yes
178 # We need some extensions to the `ldd' script.
179 changequote(,)
180 case "$machine" in
181   i[3456]86* | m68*)
182     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ldd-rewrite.sed
183     ;;
184   ia64*)
185     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
186     ;;
187   s390*)
188     ldd_rewrite_script=../sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
189     ;;
190   sparc*)
191     ldd_rewrite_script=../sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed
192     ;;
193   x86_64*)
194     ldd_rewrite_script=../sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
195     ;;
196   *)
197     ;;
198 esac
199 changequote([,])
201 if test $host = $build; then
202   # If $prefix/include/{net,scsi} are symlinks, make install will
203   # clobber what they're linked to (probably a kernel tree).
204   # test -L ought to work on all Linux boxes.
205   if test "x$prefix" != xNONE; then
206     ac_prefix=$prefix
207   else
208     ac_prefix=$ac_default_prefix
209   fi
210   AC_MSG_CHECKING([for symlinks in ${ac_prefix}/include])
211   ac_message=
212   if test -L ${ac_prefix}/include/net; then
213     ac_message="$ac_message
214    ${ac_prefix}/include/net is a symlink"
215   fi
216   if test -L ${ac_prefix}/include/scsi; then
217     ac_message="$ac_message
218    ${ac_prefix}/include/scsi is a symlink"
219   fi
220   if test -n "$ac_message"; then
221     AC_MSG_ERROR([$ac_message
222 \`make install' will destroy the target of the link(s).
223 Delete the links and re-run configure, or better still, move the entire
224 ${ac_prefix}/include directory out of the way.])
225   else
226     AC_MSG_RESULT(ok)
227   fi