configure.ac 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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 popular 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.ac correctly and can be run at any time
  12. AC_PREREQ([2.68])
  13. AC_INIT
  14. AC_CONFIG_SRCDIR([configure.ac])
  15. AC_CONFIG_AUX_DIR(buildlib)
  16. AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
  17. PACKAGE="apt"
  18. PACKAGE_VERSION="1.3~exp1"
  19. PACKAGE_MAIL="APT Development Team <deity@lists.debian.org>"
  20. AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
  21. AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"$PACKAGE_VERSION")
  22. AC_DEFINE_UNQUOTED(PACKAGE_MAIL,"$PACKAGE_MAIL")
  23. AC_SUBST(PACKAGE)
  24. AC_SUBST(PACKAGE_VERSION)
  25. AC_SUBST(PACKAGE_MAIL)
  26. dnl Check the archs, we want the target type.
  27. AC_CANONICAL_TARGET
  28. dnl Check our C compiler
  29. AC_PROG_CC
  30. AC_SEARCH_LIBS([strerror],[cposix])
  31. dnl check for large file support and enable it if possible
  32. dnl do this early as other stuff might depend on it
  33. AC_SYS_LARGEFILE
  34. dnl Check for other programs
  35. AC_PROG_CXX
  36. AC_PROG_CPP
  37. AC_PROG_RANLIB
  38. AC_CHECK_TOOL(AR,ar,"ar")
  39. dnl Checks for sockets
  40. SAVE_LIBS="$LIBS"
  41. LIBS=""
  42. AC_SEARCH_LIBS(gethostbyname,nsl)
  43. AC_SEARCH_LIBS(connect,socket)
  44. SOCKETLIBS="$LIBS"
  45. AC_SUBST(SOCKETLIBS)
  46. LIBS="$SAVE_LIBS"
  47. dnl Checks for pthread -- disabled due to glibc bugs jgg
  48. dnl AC_CHECK_LIB(pthread, pthread_create,[AC_DEFINE(HAVE_PTHREAD) PTHREADLIB="-lpthread"])
  49. AC_SUBST(PTHREADLIB)
  50. dnl if test "$PTHREADLIB" != "-lpthread"; then
  51. dnl AC_MSG_ERROR(failed: I need posix threads, pthread)
  52. dnl fi
  53. dnl Check for BDB
  54. saveLIBS="$LIBS"
  55. LIBS="$LIBS -ldb"
  56. AC_CHECK_HEADER(db.h,
  57. [AC_MSG_CHECKING(if we can link against BerkeleyDB)
  58. AC_LINK_IFELSE(
  59. [AC_LANG_PROGRAM(
  60. [#include <db.h>],
  61. [int r, s, t; db_version(&r, &s, &t);]
  62. )],
  63. [AC_DEFINE(HAVE_BDB)
  64. BDBLIB="-ldb"
  65. AC_MSG_RESULT(yes)],
  66. [BDBLIB=""
  67. AC_MSG_RESULT(no)]
  68. )]
  69. )
  70. LIBS="$saveLIBS"
  71. AC_CHECK_LIB(curl, curl_easy_init,
  72. [AC_CHECK_HEADER(curl/curl.h,
  73. curl_ok=yes,
  74. curl_ok=no)],
  75. AC_MSG_ERROR([failed: I need CURL due https support]),
  76. )
  77. AC_LANG_PUSH([C++])
  78. AC_CHECK_HEADER(gtest/gtest.h,,
  79. AC_MSG_WARN([failed: I need gtest (packaged as libgtest-dev) for unit testing]),
  80. )
  81. AC_LANG_POP([C++])
  82. AC_SUBST(BDBLIB)
  83. HAVE_ZLIB=no
  84. AC_CHECK_LIB(z, gzopen,
  85. [AC_CHECK_HEADER(zlib.h, [HAVE_ZLIB=yes], AC_MSG_ERROR([failed: zlib.h not found]))],
  86. AC_MSG_ERROR([failed: Need libz]))
  87. AC_SUBST(HAVE_ZLIB)
  88. if test "x$HAVE_ZLIB" = "xyes"; then
  89. AC_DEFINE(HAVE_ZLIB)
  90. fi
  91. HAVE_LZ4=no
  92. AC_CHECK_LIB(lz4, LZ4F_createCompressionContext,[AC_CHECK_HEADER(lz4frame.h, [HAVE_LZ4=yes], [])], [])
  93. AC_SUBST(HAVE_LZ4)
  94. if test "x$HAVE_LZ4" = "xyes"; then
  95. AC_DEFINE(HAVE_LZ4)
  96. fi
  97. HAVE_BZ2=no
  98. AC_CHECK_LIB(bz2, BZ2_bzopen,[AC_CHECK_HEADER(bzlib.h, [HAVE_BZ2=yes], [])], [])
  99. AC_SUBST(HAVE_BZ2)
  100. if test "x$HAVE_BZ2" = "xyes"; then
  101. AC_DEFINE(HAVE_BZ2)
  102. fi
  103. HAVE_LZMA=no
  104. AC_CHECK_LIB(lzma, lzma_easy_encoder,[AC_CHECK_HEADER(lzma.h, [HAVE_LZMA=yes], [])], [])
  105. AC_SUBST(HAVE_LZMA)
  106. if test "x$HAVE_LZMA" = "xyes"; then
  107. AC_DEFINE(HAVE_LZMA)
  108. fi
  109. dnl Converts the ARCH to be something singular for this general CPU family
  110. dnl This is often the dpkg architecture string.
  111. dnl First check against the full canonical canoncial-system-type in $target
  112. dnl and if that fails, just look for the cpu
  113. AC_MSG_CHECKING(debian architecture)
  114. archset="`dpkg-architecture -qDEB_HOST_ARCH`"
  115. if test "x$archset" = "x"; then
  116. AC_MSG_ERROR([failed: use --host= or output from dpkg-architecture])
  117. fi
  118. AC_MSG_RESULT($archset)
  119. AC_DEFINE_UNQUOTED(COMMON_ARCH,"$archset")
  120. dnl Single Unix Spec statvfs
  121. AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes])
  122. AC_SUBST(HAVE_STATVFS)
  123. dnl Arg, linux and bsd put their statfs function in different places
  124. if test x"$HAVE_STATVFS" != x"yes"; then
  125. AC_EGREP_HEADER(statfs,sys/vfs.h,[AC_DEFINE(HAVE_VFS_H)],[
  126. AC_EGREP_HEADER(statfs,sys/mount.h,[AC_DEFINE(HAVE_MOUNT_H)],[AC_MSG_ERROR(failed: Need statvfs)])
  127. ])
  128. fi
  129. AC_CHECK_MEMBERS([struct statfs.f_type],,,
  130. [$ac_includes_default
  131. #include <sys/vfs.h>])
  132. dnl We should use the real timegm function if we have it.
  133. AC_CHECK_FUNC(timegm,AC_DEFINE(HAVE_TIMEGM))
  134. AC_SUBST(HAVE_TIMEGM)
  135. dnl Check the architecture
  136. AC_C_BIGENDIAN
  137. dnl HP-UX sux..
  138. AC_MSG_CHECKING(for missing socklen_t)
  139. AC_EGREP_HEADER(socklen_t, sys/socket.h,[AC_MSG_RESULT(no)],[
  140. AC_DEFINE(NEED_SOCKLEN_T_DEFINE)
  141. NEED_SOCKLEN_T_DEFINE=yes
  142. AC_MSG_RESULT(missing.)])
  143. AC_SUBST(NEED_SOCKLEN_T_DEFINE)
  144. dnl HP-UX needs -d_XOPEN_SOURCE_EXTENDED for h_errno
  145. AC_MSG_CHECKING(for h_errno)
  146. AC_EGREP_HEADER(h_errno, netdb.h, [AC_MSG_RESULT(normal)],
  147. [CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
  148. AC_EGREP_HEADER(h_errno, netdb.h,
  149. [AC_MSG_RESULT(needs _XOPEN_SOURCE_EXTENDED)],
  150. [AC_MSG_ERROR("not found.")])
  151. ])
  152. dnl check for setuid checking function
  153. AC_CHECK_FUNCS(getresuid getresgid setresuid setresgid)
  154. AC_SUBST(HAVE_GETRESUID)
  155. AC_SUBST(HAVE_GETRESGID)
  156. AC_SUBST(HAVE_SETRESUID)
  157. AC_SUBST(HAVE_SETRESGID)
  158. AC_CHECK_FUNC(ptsname_r)
  159. AC_SUBST(HAVE_PTSNAME_R)
  160. dnl Check for doxygen
  161. AC_PATH_PROG(DOXYGEN, doxygen)
  162. dnl Check for the XSLTProc tool needed to build man pages together with po4a
  163. AC_PATH_PROG(XSLTPROC,xsltproc)
  164. AC_PATH_PROG(W3M, w3m)
  165. dnl Check for the po4a tool needed to build man pages
  166. AC_PATH_PROG(PO4A,po4a)
  167. dnl Check for graphviz
  168. AC_CHECK_PROG([HAVE_DOT], [dot], [YES], [NO])
  169. AC_PATH_PROG([DOT], [dot], [])
  170. DOTDIR=$(dirname $DOT)
  171. AC_SUBST(DOTDIR)
  172. ah_NUM_PROCS
  173. ah_GCC3DEP
  174. AM_GNU_GETTEXT(external)
  175. if test x"$USE_NLS" = "xyes"; then
  176. AC_DEFINE(USE_NLS)
  177. fi
  178. AC_SUBST(USE_NLS)
  179. AC_PATH_PROG(BASH, bash)
  180. AC_CONFIG_FILES([environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in doc/Doxyfile:doc/Doxyfile.in])
  181. AC_OUTPUT