configure.ac 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
  2. # Local configure fragment for sysdeps/unix/sysv/linux.
  3. define([LIBC_LINUX_VERSION],[3.2.0])dnl
  4. if test -n "$sysheaders"; then
  5. OLD_CPPFLAGS=$CPPFLAGS
  6. CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
  7. fi
  8. define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl
  9. AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl
  10. AC_TRY_COMPILE([#include <linux/version.h>
  11. #if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < ]dnl
  12. patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl
  13. [ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[
  14. # error kernel headers missing or too old
  15. #endif], [],
  16. [libc_cv_linuxVER='LIBC_LINUX_VERSION or later'],
  17. [libc_cv_linuxVER='missing or too old!'])])
  18. if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then
  19. AC_MSG_ERROR([GNU libc requires kernel header files from
  20. Linux LIBC_LINUX_VERSION or later to be installed before configuring.
  21. The kernel header files are found usually in /usr/include/asm and
  22. /usr/include/linux; make sure these directories use files from
  23. Linux LIBC_LINUX_VERSION or later. This check uses <linux/version.h>, so
  24. make sure that file was built correctly when installing the kernel header
  25. files. To use kernel headers not from /usr/include/linux, use the
  26. configure option --with-headers.])
  27. fi
  28. # If the user gave a minimal version number test whether the available
  29. # kernel headers are young enough. Additionally we have minimal
  30. # kernel versions for some architectures. If a previous configure fragment
  31. # set arch_minimum_kernel already, let that override our defaults here.
  32. # Note that we presume such a fragment has set libc_cv_gcc_unwind_find_fde
  33. # if appropriate too.
  34. test -n "$arch_minimum_kernel" || arch_minimum_kernel=3.2.0
  35. if test -n "$minimum_kernel"; then
  36. changequote(,)
  37. user_version=$((`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`))
  38. arch_version=$((`echo "$arch_minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`))
  39. changequote([,])
  40. if test $user_version -lt $arch_version; then
  41. AC_MSG_WARN([minimum kernel version reset to $arch_minimum_kernel])
  42. minimum_kernel=$arch_minimum_kernel
  43. fi
  44. else
  45. minimum_kernel=$arch_minimum_kernel
  46. fi
  47. AC_MSG_CHECKING(for kernel header at least $minimum_kernel)
  48. changequote(,)dnl
  49. decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
  50. abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
  51. changequote([,])dnl
  52. AC_TRY_COMPILE([#include <linux/version.h>
  53. #if LINUX_VERSION_CODE < $decnum
  54. # error kernel headers too old
  55. #endif], [], [libc_minimum_kernel=ok], [libc_minimum_kernel='too old!'])
  56. AC_MSG_RESULT($libc_minimum_kernel)
  57. if test "$libc_minimum_kernel" = ok; then
  58. AC_DEFINE_UNQUOTED(__LINUX_KERNEL_VERSION, $decnum)
  59. AC_DEFINE_UNQUOTED(__ABI_TAG_VERSION, $abinum)
  60. else
  61. AC_MSG_ERROR([*** The available kernel headers are older than the requested
  62. *** compatible kernel version])
  63. fi
  64. if test -n "$sysheaders"; then
  65. CPPFLAGS=$OLD_CPPFLAGS
  66. fi
  67. if test "$prefix" = "/usr/local" -o "$prefix" = "/usr/local/" -o "$prefix" = "NONE"; then
  68. if test $enable_sanity = yes; then
  69. echo "\
  70. *** On GNU/Linux systems the GNU C Library should not be installed into
  71. *** /usr/local since this might make your system totally unusable.
  72. *** We strongly advise to use a different prefix. For details read the FAQ.
  73. *** If you really mean to do this, run configure again using the extra
  74. *** parameter \`--disable-sanity-checks'."
  75. exit 1
  76. else
  77. echo "\
  78. *** WARNING: Do you really want to install the GNU C Library into /usr/local?
  79. *** This might make your system totally unusable, for details read the FAQ."
  80. fi
  81. fi
  82. # One Linux we use ldconfig.
  83. use_ldconfig=yes
  84. if test $host = $build; then
  85. # If $prefix/include/{net,scsi} are symlinks, make install will
  86. # clobber what they're linked to (probably a kernel tree).
  87. # test -L ought to work on all Linux boxes.
  88. if test "x$prefix" != xNONE; then
  89. ac_prefix=$prefix
  90. else
  91. ac_prefix=$ac_default_prefix
  92. fi
  93. AC_MSG_CHECKING([for symlinks in ${ac_prefix}/include])
  94. ac_message=
  95. if test -L ${ac_prefix}/include/net; then
  96. ac_message="$ac_message
  97. ${ac_prefix}/include/net is a symlink"
  98. fi
  99. if test -L ${ac_prefix}/include/scsi; then
  100. ac_message="$ac_message
  101. ${ac_prefix}/include/scsi is a symlink"
  102. fi
  103. if test -n "$ac_message"; then
  104. AC_MSG_ERROR([$ac_message
  105. \`make install' will destroy the target of the link(s).
  106. Delete the links and re-run configure, or better still, move the entire
  107. ${ac_prefix}/include directory out of the way.])
  108. else
  109. AC_MSG_RESULT(ok)
  110. fi
  111. fi
  112. # We have inlined syscalls.
  113. AC_DEFINE(HAVE_INLINED_SYSCALLS)