2004-07-01 Roland McGrath <roland@redhat.com>
[glibc.git] / sysdeps / unix / sysv / linux / configure.in
blobf0a7fb123133485c84aa88f1745915ea1a178481
1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/unix/sysv/linux.
4 # The Linux kernel headers can be found in
5 #   /lib/modules/$(uname -r)/build/include
6 # Check whether this directory is available.
7 if test -z "$sysheaders" &&
8    test "x$cross_compiling" = xno &&
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.  If a previous configure fragment
50 # set arch_minimum_kernel already, let that override our defaults here.
51 # Note that we presume such a fragment has set libc_cv_gcc_unwind_find_fde
52 # if appropriate too.
53 test -n "$arch_minimum_kernel" ||
54 case "$machine" in
55   alpha*)
56     arch_minimum_kernel=2.1.100
57     libc_cv_gcc_unwind_find_fde=yes
58     ;;
59   arm*)
60     arch_minimum_kernel=2.0.10
61     libc_cv_gcc_unwind_find_fde=yes
62     ;;
63   i386*)
64     libc_cv_gcc_unwind_find_fde=yes
65     arch_minimum_kernel=2.0.10
66     ;;
67   ia64*)
68     arch_minimum_kernel=2.4.0
69     ;;
70   hppa*)
71     libc_cv_gcc_unwind_find_fde=yes
72     arch_minimum_kernel=2.4.19
73     ;;
74   m68k*)
75     arch_minimum_kernel=2.0.10
76     libc_cv_gcc_unwind_find_fde=yes
77     ;;
78   mips*)
79     arch_minimum_kernel=2.4.0
80     libc_cv_gcc_unwind_find_fde=yes
81     ;;
82   powerpc/powerpc32)
83     libc_cv_gcc_unwind_find_fde=yes
84     arch_minimum_kernel=2.0.10
85     ;;
86   powerpc/powerpc64)
87     arch_minimum_kernel=2.4.19
88     ;;
89   s390/s390-32)
90     libc_cv_gcc_unwind_find_fde=yes
91     arch_minimum_kernel=2.2.10
92     ;;
93   s390/s390-64)
94     libc_cv_gcc_unwind_find_fde=yes
95     arch_minimum_kernel=2.4.0
96     ;;
97   sh*)
98     arch_minimum_kernel=2.3.99
99     libc_cv_gcc_unwind_find_fde=yes
100     ;;
101   sparc*)
102     libc_cv_gcc_unwind_find_fde=yes
103     arch_minimum_kernel=2.0.10
104     ;;
105   x86_64*)
106     arch_minimum_kernel=2.4.0
107     ;;
108   *)
109     arch_minimum_kernel=2.0.10
110     ;;
111 esac
112 if test -n "$minimum_kernel"; then
113   changequote(,)
114   user_version=$((`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`))
115   arch_version=$((`echo "$arch_minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`))
116   changequote([,])
117   if test $user_version -lt $arch_version; then
118     AC_MSG_WARN([minimum kernel version reset to $arch_minimum_kernel])
119     minimum_kernel=$arch_minimum_kernel
120   fi
121 else
122   if test $arch_minimum_kernel != '2.0.10'; then
123     minimum_kernel=$arch_minimum_kernel
124   fi
127 if test -n "$minimum_kernel"; then
128   AC_MSG_CHECKING(for kernel header at least $minimum_kernel)
129 changequote(,)dnl
130   decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
131   abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
132 changequote([,])dnl
133   AC_EGREP_CPP([eat flaming death], [#include <linux/version.h>
134 #if LINUX_VERSION_CODE < $decnum
135 eat flaming death
136 #endif], libc_minimum_kernel='too old!', libc_minimum_kernel=ok)
137   AC_MSG_RESULT($libc_minimum_kernel)
138   if test "$libc_minimum_kernel" = ok; then
139     AC_DEFINE_UNQUOTED(__LINUX_KERNEL_VERSION, $decnum)
140     AC_DEFINE_UNQUOTED(__ABI_TAG_VERSION, $abinum)
141   else
142     AC_MSG_ERROR([*** The available kernel headers are older than the requested
143 *** compatible kernel version])
144   fi
147 # The result of the above test for the use of the FDE code is invalid if
148 # the user overrides the decision about the minimum ABI.
149 if test "$oldest_abi" != default && test "2.2.4" \< "$oldest_abi"; then
150   libc_cv_gcc_unwind_find_fde=no
153 if test -n "$sysheaders"; then
154   CPPFLAGS=$OLD_CPPFLAGS
156 # The Linux filesystem standard prescribes where to place "essential"
157 # files.  I.e., when the installation prefix is "/usr" we have to place
158 # shared library objects and the configuration files on the root partition
159 # in /lib and /etc.
160 case "$prefix" in
161 /usr | /usr/)
162   # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib
163   case $machine in
164   sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 | \
165   mips/mips64/n64/* )
166     libc_cv_slibdir="/lib64"
167     if test "$libdir" = '${exec_prefix}/lib'; then
168       libdir='${exec_prefix}/lib64';
169       # Locale data can be shared between 32bit and 64bit libraries
170       libc_cv_localedir='${exec_prefix}/lib/locale'
171     fi
172     ;;
173   mips/mips64/n32/* )
174     libc_cv_slibdir="/lib32"
175     if test "$libdir" = '${exec_prefix}/lib'; then
176       libdir='${exec_prefix}/lib32';
177       # Locale data can be shared between 32bit and 64bit libraries
178       libc_cv_localedir='${exec_prefix}/lib/locale'
179     fi
180     ;;
181   *)
182     libc_cv_slibdir="/lib"
183     ;;
184   esac
185   # Allow the user to override the path with --sysconfdir
186   if test $sysconfdir = '${prefix}/etc'; then
187     libc_cv_sysconfdir=/etc
188   else
189     libc_cv_sysconfdir=$sysconfdir
190    fi
191   libc_cv_rootsbindir="/sbin"
192   ;;
193 esac
195 # Under Linux the LinuxThreads or NPTL add-on should be available.
196 case $add_ons in
197   # Only one of the add-ons should be available.
198   *linuxthreads*nptl*|*nptl*linuxthreads*)
199     echo "\
200 *** LinuxThreads and NPTL add-ons are both available.  Only one must be used."
201     exit 1
202     ;;
203   # It is available.  Good.
204   *linuxthreads*)
205     linuxthreads_missing=
206     ;;
207   *nptl*)
208     linuxthreads_missing=
209     ;;
210   *)
211     linuxthreads_missing=yes
212     ;;
213 esac
215 if test "$linuxthreads_missing"; then
216   if test $enable_sanity = yes; then
217     echo "\
218 *** On GNU/Linux systems it is normal to compile GNU libc with the
219 *** \`linuxthreads' add-on.  Without that, the library will be
220 *** incompatible with normal GNU/Linux systems.
221 *** If you really mean to not use this add-on, run configure again
222 *** using the extra parameter \`--disable-sanity-checks'."
223     exit 1
224   else
225     echo "\
226 *** WARNING: Are you sure you do not want to use the \`linuxthreads'
227 *** add-on?"
228   fi
231 if test "$prefix" = "/usr/local" -o "$prefix" = "/usr/local/" -o "$prefix" = "NONE"; then
232   if test $enable_sanity = yes; then
233     echo "\
234 *** On GNU/Linux systems the GNU C Library should not be installed into
235 *** /usr/local since this might make your system totally unusable.
236 *** We strongly advise to use a different prefix.  For details read the FAQ.
237 *** If you really mean to do this, run configure again using the extra
238 *** parameter \`--disable-sanity-checks'."
239     exit 1
240   else
241     echo "\
242 *** WARNING: Do you really want to install the GNU C Library into /usr/local?
243 *** This might make your system totally unusable, for details read the FAQ."
244   fi
248 # One Linux we use ldconfig.
249 use_ldconfig=yes
251 # We need some extensions to the `ldd' script.
252 changequote(,)
253 case "$machine" in
254   i[3456]86* | m68*)
255     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ldd-rewrite.sed
256     ;;
257   ia64*)
258     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
259     ;;
260   mips/*64*)
261     ldd_rewrite_script=../sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed
262     ;;
263   s390*)
264     ldd_rewrite_script=../sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
265     ;;
266   sparc*)
267     ldd_rewrite_script=../sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed
268     ;;
269   x86_64*)
270     ldd_rewrite_script=../sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
271     ;;
272   powerpc*)
273     ldd_rewrite_script=../sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed
274     ;;
275   *)
276     ;;
277 esac
278 changequote([,])
280 if test $host = $build; then
281   # If $prefix/include/{net,scsi} are symlinks, make install will
282   # clobber what they're linked to (probably a kernel tree).
283   # test -L ought to work on all Linux boxes.
284   if test "x$prefix" != xNONE; then
285     ac_prefix=$prefix
286   else
287     ac_prefix=$ac_default_prefix
288   fi
289   AC_MSG_CHECKING([for symlinks in ${ac_prefix}/include])
290   ac_message=
291   if test -L ${ac_prefix}/include/net; then
292     ac_message="$ac_message
293    ${ac_prefix}/include/net is a symlink"
294   fi
295   if test -L ${ac_prefix}/include/scsi; then
296     ac_message="$ac_message
297    ${ac_prefix}/include/scsi is a symlink"
298   fi
299   if test -n "$ac_message"; then
300     AC_MSG_ERROR([$ac_message
301 \`make install' will destroy the target of the link(s).
302 Delete the links and re-run configure, or better still, move the entire
303 ${ac_prefix}/include directory out of the way.])
304   else
305     AC_MSG_RESULT(ok)
306   fi