configure.in 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. ad
  2. dnl Process this file with autoconf to produce a configure script.
  3. dnl The ONLY thing this is used for is to configure for different
  4. dnl linux architectures and configurations, it is not used to make the
  5. dnl code more portable
  6. dnl You MUST have an environment that has all the POSIX functions and
  7. dnl some of the more populare bsd/sysv ones (like select). You'll also
  8. dnl need a C++ compiler that is semi-standard conformant, exceptions are
  9. dnl not used but STL is.
  10. dnl 'make -f Makefile startup' will generate the configure file from
  11. dnl configure.in correctly and can be run at any time
  12. AC_INIT(configure.in)
  13. AC_CONFIG_AUX_DIR(buildlib)
  14. AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
  15. dnl -- SET THIS TO THE RELEASE VERSION --
  16. AC_DEFINE_UNQUOTED(VERSION,"0.5.4")
  17. AC_DEFINE_UNQUOTED(PACKAGE,"apt")
  18. dnl Check the archs, we want the target type.
  19. AC_CANONICAL_SYSTEM
  20. dnl Check our C compiler
  21. AC_CHECK_TOOL_PREFIX
  22. AC_PROG_CC
  23. AC_ISC_POSIX
  24. dnl Check for other programs
  25. AC_PROG_CXX
  26. AC_PROG_CPP
  27. AC_PROG_RANLIB
  28. AC_CHECK_TOOL(AR,ar,"ar")
  29. dnl Checks for sockets
  30. SAVE_LIBS="$LIBS"
  31. LIBS=""
  32. AC_SEARCH_LIBS(gethostbyname,nsl)
  33. AC_SEARCH_LIBS(connect,socket)
  34. SOCKETLIBS="$LIBS"
  35. AC_SUBST(SOCKETLIBS)
  36. LIBS="$SAVE_LIBS"
  37. dnl Checks for pthread -- disabled due to glibc bugs jgg
  38. dnl AC_CHECK_LIB(pthread, pthread_create,[AC_DEFINE(HAVE_PTHREAD) PTHREADLIB="-lpthread"])
  39. AC_SUBST(PTHREADLIB)
  40. dnl if test "$PTHREADLIB" != "-lpthread"; then
  41. dnl AC_MSG_ERROR(failed: I need posix threads, pthread)
  42. dnl fi
  43. dnl Check for DB2
  44. AC_CHECK_HEADER(db2/db.h,
  45. [AC_CHECK_LIB(db2,db_open,
  46. [AC_DEFINE(HAVE_DB2) DB2LIB="-ldb2"])])
  47. AC_SUBST(DB2LIB)
  48. dnl Converts the ARCH to be something singular for this general CPU family
  49. dnl This is often the dpkg architecture string.
  50. AC_MSG_CHECKING(system architecture)
  51. archset="`awk \" ! /^#|^\\\$/ { if(match(\\\"$target_cpu\\\",\\\"^\\\"\\\$1\\\"\\\$\\\")) {print \\\$2; exit}}\" $srcdir/buildlib/archtable`"
  52. if test "x$archset" = "x"; then
  53. AC_MSG_ERROR(failed: use --host=)
  54. fi
  55. AC_MSG_RESULT($archset)
  56. AC_DEFINE_UNQUOTED(COMMON_CPU,"$archset")
  57. dnl Get a common name for the host OS - this is primarily only for HURD and is
  58. dnl non fatal if it fails
  59. AC_MSG_CHECKING(system OS)
  60. osset="`awk \" ! /^#|^\\\$/ {if (match(\\\"$target_vendor-$target_os\\\",\\\$1)) {print \\\$2; exit}}\" $srcdir/buildlib/ostable`"
  61. AC_MSG_RESULT($osset)
  62. AC_DEFINE_UNQUOTED(COMMON_OS,"$osset")
  63. dnl We use C99 types if at all possible
  64. AC_CACHE_CHECK([for C99 integer types],c9x_ints,[
  65. AC_TRY_COMPILE([#include <inttypes.h>],
  66. [uint8_t Foo1;uint16_t Foo2;uint32_t Foo3;],
  67. c9x_ints=yes,c9x_ints=no)])
  68. dnl Single Unix Spec statvfs
  69. AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes])
  70. AC_SUBST(HAVE_STATVFS)
  71. dnl Arg, linux and bsd put their statfs function in different places
  72. if test x"$HAVE_STATVFS" != x"yes"; then
  73. AC_EGREP_HEADER(statfs,sys/vfs.h,[AC_DEFINE(HAVE_VFS_H)],[
  74. AC_EGREP_HEADER(statfs,sys/mount.h,[AC_DEFINE(HAVE_MOUNT_H)],[AC_MSG_ERROR(failed: Need statvfs)])
  75. ])
  76. fi
  77. dnl Check the sizes etc. of the architecture
  78. dnl This is stupid, it should just use the AC macros like it does below
  79. dnl Cross compilers can either get a real C library or preload the cache
  80. dnl with their size values.
  81. changequote(,)
  82. archline="`awk \" ! /^#|^\\\$/ {if (match(\\\"$archset\\\",\\\$1)) {print; exit}}\" $srcdir/buildlib/sizetable | cut -f 2- -d ' '`"
  83. if test "x$archline" != "x"; then
  84. changequote([,])
  85. set $archline
  86. if test "$1" = "little"; then
  87. ac_cv_c_bigendian=no
  88. else
  89. ac_cv_c_bigendian=yes
  90. fi
  91. size_char=$2
  92. size_int=$3
  93. size_short=$4
  94. size_long=$5
  95. fi
  96. dnl I wonder what AC_C_BIGENDIAN does if you cross compile...
  97. dnl This is probably bogus, as above we only care if we have to build our own
  98. dnl C9x types.
  99. if test "$cross_compiling" = "yes" -a "x$archline" = "x"; then
  100. AC_MSG_ERROR(When cross compiling, architecture must be present in sizetable)
  101. fi
  102. AC_C_BIGENDIAN
  103. dnl We do not need this if we have inttypes!
  104. HAVE_C9X=yes
  105. if test x"$c9x_ints" = x"no"; then
  106. AC_CHECK_SIZEOF(char,$size_char)
  107. AC_CHECK_SIZEOF(int,$size_int)
  108. AC_CHECK_SIZEOF(short,$size_short)
  109. AC_CHECK_SIZEOF(long,$size_long)
  110. HAVE_C9X=
  111. AC_SUBST(HAVE_C9X)
  112. fi
  113. dnl HP-UX sux..
  114. AC_MSG_CHECKING(for missing socklen_t)
  115. AC_EGREP_HEADER(socklen_t, sys/socket.h,[AC_MSG_RESULT(no)],[
  116. AC_DEFINE(NEED_SOCKLEN_T_DEFINE)
  117. NEED_SOCKLEN_T_DEFINE=yes
  118. AC_MSG_RESULT(missing.)])
  119. AC_SUBST(NEED_SOCKLEN_T_DEFINE)
  120. dnl HP-UX needs -d_XOPEN_SOURCE_EXTENDED for h_errno
  121. AC_MSG_CHECKING(for h_errno)
  122. AC_EGREP_HEADER(h_errno, netdb.h, [AC_MSG_RESULT(normal)],
  123. [CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
  124. AC_EGREP_HEADER(h_errno, netdb.h,
  125. [AC_MSG_RESULT(needs _XOPEN_SOURCE_EXTENDED)],
  126. [AC_MSG_ERROR("not found.")])
  127. ])
  128. dnl Check for debiandoc
  129. AC_PATH_PROG(DEBIANDOC_HTML,debiandoc2html)
  130. AC_PATH_PROG(DEBIANDOC_TEXT,debiandoc2text)
  131. dnl Check for the SGML tools needed to build man pages
  132. AC_PATH_PROG(NSGMLS,nsgmls)
  133. AC_PATH_PROG(SGMLSPL,sgmlspl)
  134. dnl Check for YODL
  135. dnl AC_CHECK_PROG(YODL_MAN,yodl2man,"yes","")
  136. ah_NUM_PROCS
  137. ah_GLIBC_VER
  138. ah_LIBSTDCPP_VER
  139. AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in,make -s dirs)