Update.
[glibc.git] / sysdeps / unix / sysv / linux / configure.in
blobb112a0f4fb0496b178d898ec34aecff4fb4f4d40
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     ;;
45   ia64*)
46     arch_minimum_kernel=2.4.0
47     ;;
48   hppa*)
49     arch_minimum_kernel=2.3.99
50     ;;
51   mips*)
52     arch_minimum_kernel=2.2.15
53     ;;
54   sh*)
55     arch_minimum_kernel=2.3.99
56     ;;
57   *)
58     arch_minimum_kernel=2.0.10
59     ;;
60 esac
61 if test -n "$minimum_kernel"; then
62   changequote(,)
63   user_version=$((`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`))
64   arch_version=$((`echo "$arch_minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`))
65   changequote([,])
66   if test $user_version -lt $arch_version; then
67     AC_MSG_WARN([minimum kernel version reset to $arch_minimum_kernel])
68     minimum_kernel=$arch_minimum_kernel
69   fi
70 else
71   if test $arch_minimum_kernel != '2.0.10'; then
72     minimum_kernel=$arch_minimum_kernel
73   fi
76 if test -n "$minimum_kernel"; then
77   AC_MSG_CHECKING(for kernel header at least $minimum_kernel)
78 changequote(,)dnl
79   decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
80   abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
81 changequote([,])dnl
82   AC_EGREP_CPP([eat flaming death], [#include <linux/version.h>
83 #if LINUX_VERSION_CODE < $decnum
84 eat flaming death
85 #endif], libc_minimum_kernel='too old!', libc_minimum_kernel=ok)
86   AC_MSG_RESULT($libc_minimum_kernel)
87   if test "$libc_minimum_kernel" = ok; then
88     AC_DEFINE_UNQUOTED(__LINUX_KERNEL_VERSION, $decnum)
89     AC_DEFINE_UNQUOTED(__ABI_TAG_VERSION, $abinum)
90   else
91     AC_MSG_ERROR([*** The available kernel headers are older than the requested
92 *** compatible kernel version])
93   fi
96 if test -n "$sysheaders"; then
97   CPPFLAGS=$OLD_CPPFLAGS
99 # The Linux filesystem standard prescribes where to place "essential"
100 # files.  I.e., when the installation prefix is "/usr" we have to place
101 # shared library objects and the configuration files on the root partition
102 # in /lib and /etc.
103 if test "$prefix" = "/usr" -o "$prefix" = "/usr/"; then
104   # 64bit libraries on sparc go to /lib64 and not /lib
105   if test "$machine" = "sparc/sparc64"; then
106     libc_cv_slibdir="/lib64"
107     if test "$libdir" = '${exec_prefix}/lib'; then
108       libdir='${exec_prefix}/lib64';
109       # Locale data can be shared between 32bit and 64bit libraries
110       libc_cv_localedir='${exec_prefix}/lib/locale'
111     fi
112   else
113     libc_cv_slibdir="/lib"
114   fi
115   # Allow the user to override the path with --sysconfdir
116   if test $sysconfdir = '${prefix}/etc'; then
117     libc_cv_sysconfdir=/etc
118   else
119     libc_cv_sysconfdir=$sysconfdir
120    fi
121   libc_cv_rootsbindir="/sbin"
124 # Under Linux the LinuxThreads add-on should be available.
125 case $add_ons in
126   # It is available.  Good.
127   *linuxthreads*)
128     linuxthreads_missing=
129     ;;
130   *)
131     linuxthreads_missing=yes
132     ;;
133 esac
135 if test "$linuxthreads_missing"; then
136   if test $enable_sanity = yes; then
137     echo "\
138 *** On GNU/Linux systems it is normal to compile GNU libc with the
139 *** \`linuxthreads' add-on.  Without that, the library will be
140 *** incompatible with normal GNU/Linux systems.
141 *** If you really mean to not use this add-on, run configure again
142 *** using the extra parameter \`--disable-sanity-checks'."
143     exit 1
144   else
145     echo "\
146 *** WARNING: Are you sure you do not want to use the \`linuxthreads'
147 *** add-on?"
148   fi
151 # One Linux we use ldconfig.
152 use_ldconfig=yes
154 # We need some extensions to the `ldd' script.
155 changequote(,)
156 case "$machine" in
157   i[3456]86* | m68*)
158     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ldd-rewrite.sed
159     ;;
160   sparc*)
161     ldd_rewrite_script=../sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed
162     ;;
163   *)
164     ;;
165 esac
166 changequote([,])
168 if test $host = $build; then
169   # If $prefix/include/{net,scsi} are symlinks, make install will
170   # clobber what they're linked to (probably a kernel tree).
171   # test -L ought to work on all Linux boxes.
172   if test "x$prefix" != xNONE; then
173     ac_prefix=$prefix
174   else
175     ac_prefix=$ac_default_prefix
176   fi
177   AC_MSG_CHECKING([for symlinks in ${ac_prefix}/include])
178   ac_message=
179   if test -L ${ac_prefix}/include/net; then
180     ac_message="$ac_message
181    ${ac_prefix}/include/net is a symlink"
182   fi
183   if test -L ${ac_prefix}/include/scsi; then
184     ac_message="$ac_message
185    ${ac_prefix}/include/scsi is a symlink"
186   fi
187   if test -n "$ac_message"; then
188     AC_MSG_ERROR([$ac_message
189 \`make install' will destroy the target of the link(s).
190 Delete the links and re-run configure, or better still, move the entire
191 ${ac_prefix}/include directory out of the way.])
192   else
193     AC_MSG_RESULT(ok)
194   fi