2.9
[glibc/nacl-glibc.git] / sysdeps / unix / sysv / linux / configure.in
blob5330e98c2da1d462cd6d5cc66429143c22125d3e
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   powerpc/powerpc32)
79     libc_cv_gcc_unwind_find_fde=yes
80     arch_minimum_kernel=2.0.10
81     ;;
82   powerpc/powerpc64)
83     arch_minimum_kernel=2.4.21
84     ;;
85   s390/s390-32)
86     libc_cv_gcc_unwind_find_fde=yes
87     arch_minimum_kernel=2.2.10
88     ;;
89   s390/s390-64)
90     libc_cv_gcc_unwind_find_fde=yes
91     arch_minimum_kernel=2.4.0
92     ;;
93   sh*)
94     arch_minimum_kernel=2.3.99
95     libc_cv_gcc_unwind_find_fde=yes
96     ;;
97   sparc/sparc64*)
98     libc_cv_gcc_unwind_find_fde=yes
99     arch_minimum_kernel=2.4.21
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   # Allow earlier configure scripts to handle libc_cv_slibdir, libdir,
164   # and libc_cv_localedir.
165   test -n "$libc_cv_slibdir" || \
166   case $machine in
167   sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64)
168     libc_cv_slibdir="/lib64"
169     if test "$libdir" = '${exec_prefix}/lib'; then
170       libdir='${exec_prefix}/lib64';
171       # Locale data can be shared between 32bit and 64bit libraries
172       libc_cv_localedir='${exec_prefix}/lib/locale'
173     fi
174     ;;
175   *)
176     libc_cv_slibdir="/lib"
177     ;;
178   esac
179   # Allow the user to override the path with --sysconfdir
180   if test $sysconfdir = '${prefix}/etc'; then
181     libc_cv_sysconfdir=/etc
182   else
183     libc_cv_sysconfdir=$sysconfdir
184    fi
185   libc_cv_rootsbindir="/sbin"
186   ;;
187 esac
189 # Under Linux the NPTL add-on should be available.
190 case $add_ons in
191   # It is available.  Good.
192   *nptl*)
193     nptl_missing=
194     ;;
195   *)
196     nptl_missing=yes
197     ;;
198 esac
200 if test "$nptl_missing"; then
201   if test $enable_sanity = yes; then
202     echo "\
203 *** On GNU/Linux systems it is normal to compile GNU libc with the
204 *** \`nptl' add-on.  Without that, the library will be
205 *** incompatible with normal GNU/Linux systems.
206 *** If you really mean to not use this add-on, run configure again
207 *** using the extra parameter \`--disable-sanity-checks'."
208     exit 1
209   else
210     echo "\
211 *** WARNING: Are you sure you do not want to use the \`nptl'
212 *** add-on?"
213   fi
216 if test "$prefix" = "/usr/local" -o "$prefix" = "/usr/local/" -o "$prefix" = "NONE"; then
217   if test $enable_sanity = yes; then
218     echo "\
219 *** On GNU/Linux systems the GNU C Library should not be installed into
220 *** /usr/local since this might make your system totally unusable.
221 *** We strongly advise to use a different prefix.  For details read the FAQ.
222 *** If you really mean to do this, run configure again using the extra
223 *** parameter \`--disable-sanity-checks'."
224     exit 1
225   else
226     echo "\
227 *** WARNING: Do you really want to install the GNU C Library into /usr/local?
228 *** This might make your system totally unusable, for details read the FAQ."
229   fi
233 # One Linux we use ldconfig.
234 use_ldconfig=yes
236 # We need some extensions to the `ldd' script.
237 changequote(,)
238 case "$machine" in
239   i[3456]86* | m68*)
240     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ldd-rewrite.sed
241     ;;
242   ia64*)
243     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
244     ;;
245   s390*)
246     ldd_rewrite_script=../sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
247     ;;
248   sparc*)
249     ldd_rewrite_script=../sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed
250     ;;
251   x86_64*)
252     ldd_rewrite_script=../sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
253     ;;
254   powerpc*)
255     ldd_rewrite_script=../sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed
256     ;;
257   *)
258     ;;
259 esac
260 changequote([,])
262 if test $host = $build; then
263   # If $prefix/include/{net,scsi} are symlinks, make install will
264   # clobber what they're linked to (probably a kernel tree).
265   # test -L ought to work on all Linux boxes.
266   if test "x$prefix" != xNONE; then
267     ac_prefix=$prefix
268   else
269     ac_prefix=$ac_default_prefix
270   fi
271   AC_MSG_CHECKING([for symlinks in ${ac_prefix}/include])
272   ac_message=
273   if test -L ${ac_prefix}/include/net; then
274     ac_message="$ac_message
275    ${ac_prefix}/include/net is a symlink"
276   fi
277   if test -L ${ac_prefix}/include/scsi; then
278     ac_message="$ac_message
279    ${ac_prefix}/include/scsi is a symlink"
280   fi
281   if test -n "$ac_message"; then
282     AC_MSG_ERROR([$ac_message
283 \`make install' will destroy the target of the link(s).
284 Delete the links and re-run configure, or better still, move the entire
285 ${ac_prefix}/include directory out of the way.])
286   else
287     AC_MSG_RESULT(ok)
288   fi
291 # We have inlined syscalls.
292 AC_DEFINE(HAVE_INLINED_SYSCALLS)