configure.in 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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/netdb.h:buildlib/netdb.h.in)
  15. dnl -- SET THIS TO THE RELEASE VERSION --
  16. AC_DEFINE_UNQUOTED(VERSION,"0.3.15.1")
  17. AC_DEFINE_UNQUOTED(PACKAGE,"apt")
  18. dnl Check our C compiler
  19. AC_CHECK_TOOL_PREFIX
  20. AC_PROG_CC
  21. AC_ISC_POSIX
  22. dnl Check the host arch (build+target not needed... yet)
  23. AC_CANONICAL_HOST
  24. AC_CHECK_TOOL_PREFIX dnl recheck, in case the initial guess was wrong
  25. dnl Check for other programs
  26. AC_PROG_CXX
  27. AC_PROG_CPP
  28. AC_PROG_RANLIB
  29. AC_CHECK_TOOL(AR,ar,"ar")
  30. dnl Checks for sockets
  31. SAVE_LIBS="$LIBS"
  32. LIBS=""
  33. AC_SEARCH_LIBS(gethostbyname,nsl)
  34. AC_SEARCH_LIBS(connect,socket)
  35. SOCKETLIBS="$LIBS"
  36. AC_SUBST(SOCKETLIBS)
  37. LIBS="$SAVE_LIBS"
  38. dnl Section Disabled pending removal of deity widget library -- jgg
  39. if test "yes" != "yes"; then
  40. dnl Checks for X11
  41. AC_PATH_X
  42. AC_PATH_XTRA
  43. AC_SUBST(X11LIB)
  44. X11LIB=
  45. if test "$no_x" != "yes"; then
  46. X11LIB="-lX11"
  47. AC_DEFINE(HAVE_X11)
  48. dnl Checks for ZPM
  49. AC_CHECK_LIB(Xpm, XpmLibraryVersion,[AC_DEFINE(HAVE_LIBXPM) XPMLIB="-lXpm"],,$X_LIBS $X_PRE_LIBS $X11LIB $X_EXTRA_LIBS)
  50. AC_SUBST(XPMLIB)
  51. if test "$XPMLIB" != "-lXpm"; then
  52. AC_MSG_ERROR(failed: I need xpm if you are building for X)
  53. fi
  54. fi
  55. dnl Checks for Slang
  56. AC_CHECK_LIB(slang, SLang_Version,[AC_DEFINE(HAVE_LIBSLANG) SLANGLIB="-lslang"])
  57. AC_SUBST(SLANGLIB)
  58. dnl Checks for GPM
  59. AC_ARG_WITH(gpm,[ --without-gpm do not use GPM mouse support])
  60. if test "$with_gpm" != "no"; then
  61. AC_CHECK_LIB(gpm, Gpm_Open,[AC_DEFINE(HAVE_LIBGPM) GPMLIB="-lgpm"])
  62. AC_SUBST(GPMLIB)
  63. fi
  64. fi
  65. dnl Checks for pthread
  66. #AC_CHECK_LIB(pthread, pthread_create,[AC_DEFINE(HAVE_PTHREAD) PTHREADLIB="-lpthread"])
  67. AC_SUBST(PTHREADLIB)
  68. #if test "$PTHREADLIB" != "-lpthread"; then
  69. # AC_MSG_ERROR(failed: I need posix threads, pthread)
  70. #fi
  71. dnl Converts the ARCH to be the same as dpkg
  72. AC_MSG_CHECKING(system architecture)
  73. archset="`awk \"{ if(\\\$1 == \\\"$host_cpu\\\") print \\\$2 }\" $srcdir/buildlib/archtable`"
  74. if test "x$archset" = "x"; then
  75. AC_MSG_ERROR(failed: use --host=)
  76. fi
  77. AC_MSG_RESULT($archset)
  78. AC_DEFINE_UNQUOTED(ARCHITECTURE,"$archset")
  79. dnl We use C9x types if at all possible
  80. AC_CACHE_CHECK([for C9x integer types],c9x_ints,[
  81. AC_TRY_COMPILE([#include <inttypes.h>],
  82. [uint8_t Foo1;uint16_t Foo2;uint32_t Foo3;],
  83. c9x_ints=yes,c9x_ints=no)])
  84. dnl Single Unix Spec statvfs
  85. AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes])
  86. AC_SUBST(HAVE_STATVFS)
  87. dnl Arg, linux and bsd put their statfs function in different places
  88. if test x"$HAVE_STATVFS" != x"yes"; then
  89. AC_EGREP_HEADER(statfs,sys/vfs.h,[AC_DEFINE(HAVE_VFS_H)],[
  90. AC_EGREP_HEADER(statfs,sys/mount.h,[AC_DEFINE(HAVE_MOUNT_H)],[AC_MSG_ERROR(failed: Need statvfs)])
  91. ])
  92. fi
  93. dnl Check the sizes etc. of the architecture
  94. changequote(,)
  95. if archline="`grep \"^$archset\" $srcdir/buildlib/sizetable | cut -f 2- -d ' '`";then
  96. changequote([,])
  97. set $archline
  98. if test "$1" = "little"; then
  99. ac_cv_c_bigendian=no
  100. else
  101. ac_cv_c_bigendian=yes
  102. fi
  103. size_char=$2
  104. size_int=$3
  105. size_short=$4
  106. size_long=$5
  107. fi
  108. if test "$cross_compiling" = "yes" -a "$archline" = ""; then
  109. AC_MSG_ERROR(When cross compiling, architecture must be present in sizetable)
  110. fi
  111. AC_C_BIGENDIAN
  112. dnl We do not need this if we have inttypes..
  113. HAVE_C9X=yes
  114. if test x"$c9x_ints" = x"no"; then
  115. AC_CHECK_SIZEOF(char,$size_char)
  116. AC_CHECK_SIZEOF(int,$size_int)
  117. AC_CHECK_SIZEOF(short,$size_short)
  118. AC_CHECK_SIZEOF(long,$size_long)
  119. HAVE_C9X=
  120. AC_SUBST(HAVE_C9X)
  121. fi
  122. AC_MSG_CHECKING(for socklen_t)
  123. AC_EGREP_HEADER(socklen_t, sys/socket.h, [
  124. AC_DEFINE(HAVE_SYS_SOCKET_H)
  125. AC_MSG_RESULT(sys/socket.h)
  126. ], [
  127. AC_DEFINE(NEED_SOCKLEN_T_DEFINE)
  128. AC_MSG_RESULT([socklen_t size_t])
  129. ])
  130. AC_MSG_CHECKING(for h_errno)
  131. AC_EGREP_HEADER(h_errno, netdb.h, [AC_DEFINE(HAVE_NETDB_H)
  132. AC_MSG_RESULT(found)
  133. ], [AC_TRY_COMPILE(netdb.h, h_errno foo, [AC_MSG_RESULT(found)
  134. AC_MSG_RESULT(found)
  135. ], [ah_CFLAGS="$CFLAGS"
  136. CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
  137. AC_TRY_COMPILE([netdb.h], [h_errno foo], [AC_DEFINE(NEED_XOPEN_NETDB_H)
  138. AC_MSG_RESULT([found, needed -D_XOPEN_SOURCE_EXTENDED])
  139. ], [CFLAGS="$ah_CFLAGS"
  140. AC_MSG_ERROR(["not found."])
  141. ])
  142. ])
  143. ])
  144. dnl Check for debiandoc
  145. AC_CHECK_PROG(DEBIANDOC_HTML,debiandoc2html,"yes","")
  146. AC_CHECK_PROG(DEBIANDOC_TEXT,debiandoc2text,"yes","")
  147. dnl Check for YODL
  148. AC_CHECK_PROG(YODL_MAN,yodl2man,"yes","")
  149. ah_NUM_PROCS
  150. AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in,make dirs)