configure.ac 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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.1"
  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_SUBST(BDBLIB)
  78. HAVE_ZLIB=no
  79. AC_CHECK_LIB(z, gzopen,
  80. [AC_CHECK_HEADER(zlib.h, [HAVE_ZLIB=yes], AC_MSG_ERROR([failed: zlib.h not found]))],
  81. AC_MSG_ERROR([failed: Need libz]))
  82. AC_SUBST(HAVE_ZLIB)
  83. if test "x$HAVE_ZLIB" = "xyes"; then
  84. AC_DEFINE(HAVE_ZLIB)
  85. fi
  86. HAVE_BZ2=no
  87. AC_CHECK_LIB(bz2, BZ2_bzopen,[AC_CHECK_HEADER(bzlib.h, [HAVE_BZ2=yes], [])], [])
  88. AC_SUBST(HAVE_BZ2)
  89. if test "x$HAVE_BZ2" = "xyes"; then
  90. AC_DEFINE(HAVE_BZ2)
  91. fi
  92. HAVE_LZMA=no
  93. AC_CHECK_LIB(lzma, lzma_easy_encoder,[AC_CHECK_HEADER(lzma.h, [HAVE_LZMA=yes], [])], [])
  94. AC_SUBST(HAVE_LZMA)
  95. if test "x$HAVE_LZMA" = "xyes"; then
  96. AC_DEFINE(HAVE_LZMA)
  97. fi
  98. dnl Converts the ARCH to be something singular for this general CPU family
  99. dnl This is often the dpkg architecture string.
  100. dnl First check against the full canonical canoncial-system-type in $target
  101. dnl and if that fails, just look for the cpu
  102. AC_MSG_CHECKING(debian architecture)
  103. archset="`dpkg-architecture -qDEB_HOST_ARCH`"
  104. if test "x$archset" = "x"; then
  105. AC_MSG_ERROR([failed: use --host= or output from dpkg-architecture])
  106. fi
  107. AC_MSG_RESULT($archset)
  108. AC_DEFINE_UNQUOTED(COMMON_ARCH,"$archset")
  109. dnl Single Unix Spec statvfs
  110. AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes])
  111. AC_SUBST(HAVE_STATVFS)
  112. dnl Arg, linux and bsd put their statfs function in different places
  113. if test x"$HAVE_STATVFS" != x"yes"; then
  114. AC_EGREP_HEADER(statfs,sys/vfs.h,[AC_DEFINE(HAVE_VFS_H)],[
  115. AC_EGREP_HEADER(statfs,sys/mount.h,[AC_DEFINE(HAVE_MOUNT_H)],[AC_MSG_ERROR(failed: Need statvfs)])
  116. ])
  117. fi
  118. AC_CHECK_MEMBERS([struct statfs.f_type],,,
  119. [$ac_includes_default
  120. #include <sys/vfs.h>])
  121. dnl We should use the real timegm function if we have it.
  122. AC_CHECK_FUNC(timegm,AC_DEFINE(HAVE_TIMEGM))
  123. AC_SUBST(HAVE_TIMEGM)
  124. dnl Check the architecture
  125. AC_C_BIGENDIAN
  126. dnl HP-UX sux..
  127. AC_MSG_CHECKING(for missing socklen_t)
  128. AC_EGREP_HEADER(socklen_t, sys/socket.h,[AC_MSG_RESULT(no)],[
  129. AC_DEFINE(NEED_SOCKLEN_T_DEFINE)
  130. NEED_SOCKLEN_T_DEFINE=yes
  131. AC_MSG_RESULT(missing.)])
  132. AC_SUBST(NEED_SOCKLEN_T_DEFINE)
  133. dnl HP-UX needs -d_XOPEN_SOURCE_EXTENDED for h_errno
  134. AC_MSG_CHECKING(for h_errno)
  135. AC_EGREP_HEADER(h_errno, netdb.h, [AC_MSG_RESULT(normal)],
  136. [CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
  137. AC_EGREP_HEADER(h_errno, netdb.h,
  138. [AC_MSG_RESULT(needs _XOPEN_SOURCE_EXTENDED)],
  139. [AC_MSG_ERROR("not found.")])
  140. ])
  141. dnl Check for debiandoc
  142. AC_PATH_PROG(DEBIANDOC_HTML,debiandoc2html)
  143. AC_PATH_PROG(DEBIANDOC_TEXT,debiandoc2text)
  144. dnl Check for doxygen
  145. AC_PATH_PROG(DOXYGEN, doxygen)
  146. dnl Check for the XSLTProc tool needed to build man pages together with po4a
  147. AC_PATH_PROG(XSLTPROC,xsltproc)
  148. dnl Check for the po4a tool needed to build man pages
  149. AC_PATH_PROG(PO4A,po4a)
  150. dnl Check for graphviz
  151. AC_CHECK_PROG([HAVE_DOT], [dot], [YES], [NO])
  152. AC_PATH_PROG([DOT], [dot], [])
  153. DOTDIR=$(dirname $DOT)
  154. AC_SUBST(DOTDIR)
  155. ah_NUM_PROCS
  156. ah_GCC3DEP
  157. AM_GNU_GETTEXT(external)
  158. if test x"$USE_NLS" = "xyes"; then
  159. AC_DEFINE(USE_NLS)
  160. fi
  161. AC_SUBST(USE_NLS)
  162. AC_PATH_PROG(BASH, bash)
  163. AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in doc/Doxyfile:doc/Doxyfile.in,make -s dirs)