Update.
[glibc.git] / sysdeps / unix / sysv / linux / configure.in
blob4d52ee539ca3cfdf03c07dc39ba46061d0d7422f
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 # The Linux kernel headers can be found in
6 #   /lib/modules/$(uname -r)/build/include
7 # Check whether this directory is available.
8 if test -z "$sysheaders" &&
9    test -d /lib/modules/`uname -r`/build/include; then
10   sysheaders="/lib/modules/`uname -r`/build/include"
11   ccheaders=`$CC -print-file-name=include`
12   dnl We don't have to use -nostdinc.  We just want one more directory
13   dnl to be used.
14   SYSINCLUDES="-I $sysheaders"
17 # Don't bother trying to generate any glue code to be compatible with the
18 # existing system library, because we are the only system library.
19 inhibit_glue=yes
21 define([LIBC_LINUX_VERSION],[2.0.10])dnl
22 if test -n "$sysheaders"; then
23   OLD_CPPFLAGS=$CPPFLAGS
24   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
26 define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl
27 AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl
28 AC_EGREP_CPP([eat flaming death], [#include <linux/version.h>
29 #if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < ]dnl
30 patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl
31 [ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[
32 eat flaming death
33 #endif],
34              libc_cv_linuxVER='TOO OLD!',
35              libc_cv_linuxVER='LIBC_LINUX_VERSION or later')])
36 if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then
37   AC_MSG_ERROR([GNU libc requires kernel header files from
38 Linux LIBC_LINUX_VERSION or later to be installed before configuring.
39 The kernel header files are found usually in /usr/include/asm and
40 /usr/include/linux; make sure these directories use files from
41 Linux LIBC_LINUX_VERSION or later.  This check uses <linux/version.h>, so
42 make sure that file was built correctly when installing the kernel header
43 files.  To use kernel headers not from /usr/include/linux, use the
44 configure option --with-headers.])
47 # If the user gave a minimal version number test whether the available
48 # kernel headers are young enough.  Additionally we have minimal
49 # kernel versions for some architectures.
50 case "$machine" in
51   alpha*)
52     arch_minimum_kernel=2.1.100
53     libc_cv_gcc_unwind_find_fde=yes
54     ;;
55   arm*)
56     arch_minimum_kernel=2.0.10
57     libc_cv_gcc_unwind_find_fde=yes
58     ;;
59   i386*)
60     libc_cv_gcc_unwind_find_fde=yes
61     arch_minimum_kernel=2.0.10
62     ;;
63   ia64*)
64     arch_minimum_kernel=2.4.0
65     ;;
66   hppa*)
67     arch_minimum_kernel=2.3.99
68     ;;
69   m68k*)
70     arch_minimum_kernel=2.0.10
71     libc_cv_gcc_unwind_find_fde=yes
72     ;;
73   mips*)
74     arch_minimum_kernel=2.4.0
75     libc_cv_gcc_unwind_find_fde=yes
76     ;;
77   powerpc/powerpc32)
78     libc_cv_gcc_unwind_find_fde=yes
79     arch_minimum_kernel=2.0.10
80     ;;
81   powerpc/powerpc64)
82     arch_minimum_kernel=2.4.19
83     ;;
84   s390/s390-32)
85     libc_cv_gcc_unwind_find_fde=yes
86     arch_minimum_kernel=2.2.10
87     ;;
88   s390/s390-64)
89     libc_cv_gcc_unwind_find_fde=yes
90     arch_minimum_kernel=2.4.0
91     ;;
92   sh*)
93     arch_minimum_kernel=2.3.99
94     libc_cv_gcc_unwind_find_fde=yes
95     ;;
96   sparc*)
97     libc_cv_gcc_unwind_find_fde=yes
98     arch_minimum_kernel=2.0.10
99     ;;
100   x86_64*)
101     arch_minimum_kernel=2.4.0
102     ;;
103   *)
104     arch_minimum_kernel=2.0.10
105     ;;
106 esac
107 if test -n "$minimum_kernel"; then
108   changequote(,)
109   user_version=$((`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`))
110   arch_version=$((`echo "$arch_minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`))
111   changequote([,])
112   if test $user_version -lt $arch_version; then
113     AC_MSG_WARN([minimum kernel version reset to $arch_minimum_kernel])
114     minimum_kernel=$arch_minimum_kernel
115   fi
116 else
117   if test $arch_minimum_kernel != '2.0.10'; then
118     minimum_kernel=$arch_minimum_kernel
119   fi
122 if test -n "$minimum_kernel"; then
123   AC_MSG_CHECKING(for kernel header at least $minimum_kernel)
124 changequote(,)dnl
125   decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
126   abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
127 changequote([,])dnl
128   AC_EGREP_CPP([eat flaming death], [#include <linux/version.h>
129 #if LINUX_VERSION_CODE < $decnum
130 eat flaming death
131 #endif], libc_minimum_kernel='too old!', libc_minimum_kernel=ok)
132   AC_MSG_RESULT($libc_minimum_kernel)
133   if test "$libc_minimum_kernel" = ok; then
134     AC_DEFINE_UNQUOTED(__LINUX_KERNEL_VERSION, $decnum)
135     AC_DEFINE_UNQUOTED(__ABI_TAG_VERSION, $abinum)
136   else
137     AC_MSG_ERROR([*** The available kernel headers are older than the requested
138 *** compatible kernel version])
139   fi
142 # The result of the above test for the use of the FDE code is invalid if
143 # the user overrides the decision about the minimum ABI.
144 if test "$oldest_abi" != default && test "2.2.4" \< "$oldest_abi"; then
145   libc_cv_gcc_unwind_find_fde=no
148 if test -n "$sysheaders"; then
149   CPPFLAGS=$OLD_CPPFLAGS
151 # The Linux filesystem standard prescribes where to place "essential"
152 # files.  I.e., when the installation prefix is "/usr" we have to place
153 # shared library objects and the configuration files on the root partition
154 # in /lib and /etc.
155 if test "$prefix" = "/usr" -o "$prefix" = "/usr/"; then
156   # 64bit libraries on sparc go to /lib64 and not /lib
157   if test "$machine" = "sparc/sparc64" -o "$machine" = "x86_64" \
158           -o "$machine" = "powerpc/powerpc64"; then
159     libc_cv_slibdir="/lib64"
160     if test "$libdir" = '${exec_prefix}/lib'; then
161       libdir='${exec_prefix}/lib64';
162       # Locale data can be shared between 32bit and 64bit libraries
163       libc_cv_localedir='${exec_prefix}/lib/locale'
164     fi
165   else
166     libc_cv_slibdir="/lib"
167   fi
168   # Allow the user to override the path with --sysconfdir
169   if test $sysconfdir = '${prefix}/etc'; then
170     libc_cv_sysconfdir=/etc
171   else
172     libc_cv_sysconfdir=$sysconfdir
173    fi
174   libc_cv_rootsbindir="/sbin"
177 # Under Linux the LinuxThreads add-on should be available.
178 case $add_ons in
179   # It is available.  Good.
180   *linuxthreads*)
181     linuxthreads_missing=
182     ;;
183   *)
184     linuxthreads_missing=yes
185     ;;
186 esac
188 if test "$linuxthreads_missing"; then
189   if test $enable_sanity = yes; then
190     echo "\
191 *** On GNU/Linux systems it is normal to compile GNU libc with the
192 *** \`linuxthreads' add-on.  Without that, the library will be
193 *** incompatible with normal GNU/Linux systems.
194 *** If you really mean to not use this add-on, run configure again
195 *** using the extra parameter \`--disable-sanity-checks'."
196     exit 1
197   else
198     echo "\
199 *** WARNING: Are you sure you do not want to use the \`linuxthreads'
200 *** add-on?"
201   fi
204 if test "$prefix" = "/usr/local" -o "$prefix" = "/usr/local/" -o "$prefix" = "NONE"; then
205   if test $enable_sanity = yes; then
206     echo "\
207 *** On GNU/Linux systems the GNU C Library should not be installed into
208 *** /usr/local since this might make your system totally unusable.
209 *** We strongly advise to use a different prefix.  For details read the FAQ.
210 *** If you really mean to do this, run configure again using the extra
211 *** parameter \`--disable-sanity-checks'."
212     exit 1
213   else
214     echo "\
215 *** WARNING: Do you really want to install the GNU C Library into /usr/local?
216 *** This might make your system totally unusable, for details read the FAQ."
217   fi
221 # One Linux we use ldconfig.
222 use_ldconfig=yes
224 # We need some extensions to the `ldd' script.
225 changequote(,)
226 case "$machine" in
227   i[3456]86* | m68*)
228     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ldd-rewrite.sed
229     ;;
230   ia64*)
231     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
232     ;;
233   s390*)
234     ldd_rewrite_script=../sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
235     ;;
236   sparc*)
237     ldd_rewrite_script=../sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed
238     ;;
239   x86_64*)
240     ldd_rewrite_script=../sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
241     ;;
242   powerpc*)
243     ldd_rewrite_script=../sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed
244     ;;
245   *)
246     ;;
247 esac
248 changequote([,])
250 if test $host = $build; then
251   # If $prefix/include/{net,scsi} are symlinks, make install will
252   # clobber what they're linked to (probably a kernel tree).
253   # test -L ought to work on all Linux boxes.
254   if test "x$prefix" != xNONE; then
255     ac_prefix=$prefix
256   else
257     ac_prefix=$ac_default_prefix
258   fi
259   AC_MSG_CHECKING([for symlinks in ${ac_prefix}/include])
260   ac_message=
261   if test -L ${ac_prefix}/include/net; then
262     ac_message="$ac_message
263    ${ac_prefix}/include/net is a symlink"
264   fi
265   if test -L ${ac_prefix}/include/scsi; then
266     ac_message="$ac_message
267    ${ac_prefix}/include/scsi is a symlink"
268   fi
269   if test -n "$ac_message"; then
270     AC_MSG_ERROR([$ac_message
271 \`make install' will destroy the target of the link(s).
272 Delete the links and re-run configure, or better still, move the entire
273 ${ac_prefix}/include directory out of the way.])
274   else
275     AC_MSG_RESULT(ok)
276   fi