configure.ac 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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.50)
  13. AC_INIT(configure.ac)
  14. AC_CONFIG_AUX_DIR(buildlib)
  15. AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
  16. PACKAGE="apt"
  17. PACKAGE_VERSION="1.0.5"
  18. PACKAGE_MAIL="APT Development Team <deity@lists.debian.org>"
  19. AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
  20. AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"$PACKAGE_VERSION")
  21. AC_DEFINE_UNQUOTED(PACKAGE_MAIL,"$PACKAGE_MAIL")
  22. AC_SUBST(PACKAGE)
  23. AC_SUBST(PACKAGE_VERSION)
  24. AC_SUBST(PACKAGE_MAIL)
  25. dnl Check the archs, we want the target type.
  26. AC_CANONICAL_SYSTEM
  27. dnl Check our C compiler
  28. AC_CHECK_TOOL_PREFIX
  29. AC_PROG_CC
  30. AC_ISC_POSIX
  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_ERROR([failed: I need gtest to build tests]),
  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_BZ2=no
  92. AC_CHECK_LIB(bz2, BZ2_bzopen,[AC_CHECK_HEADER(bzlib.h, [HAVE_BZ2=yes], [])], [])
  93. AC_SUBST(HAVE_BZ2)
  94. if test "x$HAVE_BZ2" = "xyes"; then
  95. AC_DEFINE(HAVE_BZ2)
  96. fi
  97. HAVE_LZMA=no
  98. AC_CHECK_LIB(lzma, lzma_easy_encoder,[AC_CHECK_HEADER(lzma.h, [HAVE_LZMA=yes], [])], [])
  99. AC_SUBST(HAVE_LZMA)
  100. if test "x$HAVE_LZMA" = "xyes"; then
  101. AC_DEFINE(HAVE_LZMA)
  102. fi
  103. dnl Converts the ARCH to be something singular for this general CPU family
  104. dnl This is often the dpkg architecture string.
  105. dnl First check against the full canonical canoncial-system-type in $target
  106. dnl and if that fails, just look for the cpu
  107. AC_MSG_CHECKING(debian architecture)
  108. archset="`dpkg-architecture -qDEB_HOST_ARCH`"
  109. if test "x$archset" = "x"; then
  110. AC_MSG_ERROR([failed: use --host= or output from dpkg-architecture])
  111. fi
  112. AC_MSG_RESULT($archset)
  113. AC_DEFINE_UNQUOTED(COMMON_ARCH,"$archset")
  114. dnl Single Unix Spec statvfs
  115. AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes])
  116. AC_SUBST(HAVE_STATVFS)
  117. dnl Arg, linux and bsd put their statfs function in different places
  118. if test x"$HAVE_STATVFS" != x"yes"; then
  119. AC_EGREP_HEADER(statfs,sys/vfs.h,[AC_DEFINE(HAVE_VFS_H)],[
  120. AC_EGREP_HEADER(statfs,sys/mount.h,[AC_DEFINE(HAVE_MOUNT_H)],[AC_MSG_ERROR(failed: Need statvfs)])
  121. ])
  122. fi
  123. AC_CHECK_MEMBERS([struct statfs.f_type],,,
  124. [$ac_includes_default
  125. #include <sys/vfs.h>])
  126. dnl We should use the real timegm function if we have it.
  127. AC_CHECK_FUNC(timegm,AC_DEFINE(HAVE_TIMEGM))
  128. AC_SUBST(HAVE_TIMEGM)
  129. dnl Check the architecture
  130. AC_C_BIGENDIAN
  131. dnl HP-UX sux..
  132. AC_MSG_CHECKING(for missing socklen_t)
  133. AC_EGREP_HEADER(socklen_t, sys/socket.h,[AC_MSG_RESULT(no)],[
  134. AC_DEFINE(NEED_SOCKLEN_T_DEFINE)
  135. NEED_SOCKLEN_T_DEFINE=yes
  136. AC_MSG_RESULT(missing.)])
  137. AC_SUBST(NEED_SOCKLEN_T_DEFINE)
  138. dnl HP-UX needs -d_XOPEN_SOURCE_EXTENDED for h_errno
  139. AC_MSG_CHECKING(for h_errno)
  140. AC_EGREP_HEADER(h_errno, netdb.h, [AC_MSG_RESULT(normal)],
  141. [CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
  142. AC_EGREP_HEADER(h_errno, netdb.h,
  143. [AC_MSG_RESULT(needs _XOPEN_SOURCE_EXTENDED)],
  144. [AC_MSG_ERROR("not found.")])
  145. ])
  146. dnl Check for doxygen
  147. AC_PATH_PROG(DOXYGEN, doxygen)
  148. dnl Check for the XSLTProc tool needed to build man pages together with po4a
  149. AC_PATH_PROG(XSLTPROC,xsltproc)
  150. AC_PATH_PROG(W3M, w3m)
  151. dnl Check for the po4a tool needed to build man pages
  152. AC_PATH_PROG(PO4A,po4a)
  153. dnl Check for graphviz
  154. AC_CHECK_PROG([HAVE_DOT], [dot], [YES], [NO])
  155. AC_PATH_PROG([DOT], [dot], [])
  156. DOTDIR=$(dirname $DOT)
  157. AC_SUBST(DOTDIR)
  158. ah_NUM_PROCS
  159. ah_GCC3DEP
  160. AM_GNU_GETTEXT(external)
  161. if test x"$USE_NLS" = "xyes"; then
  162. AC_DEFINE(USE_NLS)
  163. fi
  164. AC_SUBST(USE_NLS)
  165. AC_PATH_PROG(BASH, bash)
  166. AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in doc/Doxyfile:doc/Doxyfile.in,make -s dirs)