configure.ac 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl
  3. dnl
  4. AC_PREREQ(2.59)
  5. AC_INIT([wraith],[],[wraith@botpack.net])
  6. AC_CONFIG_SRCDIR(src/eggdrop.h)
  7. AC_CONFIG_HEADER(src/config.h)
  8. AC_CONFIG_AUX_DIR([build/autotools])
  9. AC_COPYRIGHT([Copyright (c) Bryan Drewery])
  10. AC_REVISION($Revision$)
  11. EGG_SAVE_PARAMETERS
  12. # Setup build environment
  13. dnl Search for newer gcc versions before older
  14. #AC_REQUIRE_CPP
  15. AC_LANG([C++])
  16. AC_PROG_CXX([g++49 g++-4.9 g++48 g++-4.8 g++47 g++-4.7 clang++ g++46 g++-4.6 g++45 g++-4.5 g++-4.4 g++-4.4.1 g++-4.4.2 g++-4.4.0 g++44 g++4 eg++ g++-3.3 g++33 g++-3 g++3 g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC])
  17. dnl AC_PROG_CC([gcc34 gcc-3.4 gcc33 gcc3 gcc-3.3 gcc cc c1])
  18. AC_REQUIRE_CPP
  19. AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
  20. EGG_CHECK_CC
  21. #checkpoint
  22. AC_CACHE_SAVE
  23. # Speedup compile
  24. EGG_CHECK_CCWALL
  25. EGG_CHECK_CCPIPE
  26. CXX_FLAG_CHECK([CXXFLAGS], [-fcolor-diagnostics], [colordiagnostics])
  27. #CXX_FLAG_CHECK([CXXFLAGS], [-Qunused-arguments], [unusedarguments])
  28. CXX_FLAG_CHECK([CXXFLAGS], [-Wno-invalid-source-encoding], [invalid_source_encoding])
  29. CXX_FLAG_CHECK([CXXFLAGS], [-fstack-protector], [stackprotector])
  30. CXX_FLAG_CHECK([CXXFLAGS], [-fstack-protector-strong], [stackprotectorstrong])
  31. if [[ "${ax_cv_prog_cc_stackprotectorstrong}" = "yes" ]]; then
  32. LDFLAGS="${LDFLAGS} -fstack-protector-strong"
  33. elif [[ "${ax_cv_prog_cc_stackprotector}" = "yes" ]]; then
  34. LDFLAGS="${LDFLAGS} -fstack-protector"
  35. fi
  36. CXX_FLAG_CHECK([DEBCXXFLAGS], [-fstack-protector-all], [stackprotectorall])
  37. EGG_CHECK_DEPMODE
  38. #checkpoint
  39. AC_CACHE_SAVE
  40. # Checks for programs
  41. AC_PROG_MAKE_SET
  42. AC_PROG_SED
  43. EGG_PROG_HEAD_1
  44. EGG_PROG_AWK
  45. EGG_PROG_BASENAME
  46. AC_CHECK_PROG(OBJCOPY, objcopy, [objcopy --remove-section=.note --remove-section=.comment], touch)
  47. AC_CHECK_PROG(STRIP, strip, strip, touch)
  48. AC_CHECK_PROG(DIFF, gdiff, gdiff, diff)
  49. AC_CHECK_PROG(UNAME, uname, uname)
  50. # Test the os and set the module linking settings
  51. EGG_CHECK_OS
  52. # Check for IPv6 support
  53. #EGG_IPV6_SUPPORTED
  54. EGG_IPV6_OPTIONS
  55. EGG_CHECK_SOCKLEN_T
  56. # Check for inconsistent random() functions
  57. EGG_CHECK_RANDOM_MAX
  58. # Create static binaries
  59. EGG_CHECK_CCSTATIC
  60. AC_SUBST(DEBCXXFLAGS)
  61. #checkpoint
  62. AC_CACHE_SAVE
  63. # Checks for system libraries
  64. EGG_CHECK_LIBS
  65. CHECK_LIBELF
  66. # Checks for header files
  67. AC_HEADER_DIRENT
  68. AC_HEADER_SYS_WAIT
  69. AC_HEADER_TIME
  70. AC_HEADER_STAT
  71. #checkpoint
  72. AC_CACHE_SAVE
  73. AC_CHECK_HEADERS([stdarg.h arpa/inet.h fcntl.h limits.h locale.h netdb.h netinet/in.h])
  74. AC_CHECK_HEADERS([sys/file.h sys/ioctl.h sys/param.h sys/socket.h wchar.h sys/ptrace.h paths.h sys/prctl.h])
  75. #checkpoint
  76. AC_CACHE_SAVE
  77. #AC_CHECK_HEADERS(openssl/ssl.h openssl/crypto.h)
  78. #AC_CHECK_HEADERS(zlib.h)
  79. #EGG_CHECK_ZLIB
  80. CHECK_SSL
  81. # TCL checks
  82. # Tcl version to recommend if no Tcl is found, and the site where it can be
  83. # found for download.
  84. tclrecommendver="8.5.X"
  85. tclrecommendsite="ftp://tcl.activestate.com/pub/tcl/tcl8_5/"
  86. # Tcl library filename prefixes, suffixes, and search paths.
  87. tcllibnames="tcl8.6 tcl86 tcl8.5 tcl85 tcl8.4 tcl84 tcl8.3 tcl83 tcl8.2 tcl82 \
  88. tcl8.1 tcl81 tcl8.0 tcl80 tcl tcl7.6 tcl76 tcl7.5 tcl75 \
  89. tcl7.4 tcl74 tcl7.3 tcl73 tcl7.2 tcl72 tcl7.1 tcl71 \
  90. tcl7.0 tcl70"
  91. tcllibextensions=".so .so.1 .so.1.0 .so.1.1 .so.1.2 .dll .dylib .sl .a"
  92. tcllibpaths="$HOME/lib $HOME/tcl/lib \
  93. /usr/local/lib /usr/lib /lib /lib64 /usr/lib64 \
  94. /usr/local/lib/tcl8.6 /usr/lib/tcl8.6 \
  95. /usr/local/lib/tcl8.5 /usr/lib/tcl8.5 \
  96. /usr/local/lib/tcl8.4 /usr/lib/tcl8.4 \
  97. /usr/local/lib/tcl8.3 /usr/lib/tcl8.3 \
  98. /usr/local/pkgs/tcl/lib /sys/lib /usr/pkg/lib \
  99. /usr/i486-linuxaout/lib /beos/system/lib $HOME"
  100. # Tcl header filenames and search paths.
  101. tclheadernames="tcl.h"
  102. tclheaderpaths="$HOME/include $HOME/tcl/include \
  103. /usr/local/include /usr/include \
  104. /usr/local/include/tcl8.6 /usr/include/tcl8.6 \
  105. /usr/local/include/tcl8.5 /usr/include/tcl8.5 \
  106. /usr/local/include/tcl8.4 /usr/include/tcl8.4 \
  107. /usr/local/include/tcl8.3 /usr/include/tcl8.3 \
  108. /usr/local/pkgs/tcl/include /sys/include \
  109. /usr/pkg/lib /beos/system/include /beos/devel/include $HOME"
  110. # Misc Tcl checks.
  111. EGG_TCL_OPTIONS
  112. EGG_TCL_ENV
  113. EGG_TCL_WITH_TCLLIB
  114. EGG_TCL_WITH_TCLINC
  115. EGG_TCL_FIND_LIBRARY
  116. EGG_TCL_FIND_HEADER
  117. EGG_TCL_CHECK_LIBRARY
  118. EGG_TCL_CHECK_HEADER
  119. EGG_TCL_DETECT_CHANGE
  120. EGG_TCL_CHECK_VERSION
  121. EGG_TCL_CHECK_PRE70
  122. EGG_TCL_TESTLIBS
  123. EGG_TCL_CHECK_FREE
  124. #EGG_TCL_CHECK_GETCURRENTTHREAD
  125. #EGG_TCL_CHECK_GETTHREADDATA
  126. EGG_TCL_CHECK_SETNOTIFIER
  127. EGG_TCL_LIB_REQS
  128. AC_CACHE_SAVE
  129. #AC_SUBST(ZLIB)dnl
  130. # Checks for typedefs, structures, and compiler characteristics
  131. AC_TYPE_PID_T
  132. AC_TYPE_SIZE_T
  133. AC_TYPE_UID_T
  134. #AC_C_CONST
  135. AC_C_VOLATILE
  136. AC_C_BIGENDIAN(AC_DEFINE(B_ENDIAN, 1, [big endian]),AC_DEFINE(L_ENDIAN, 1, [little endian]))
  137. #AC_C_INLINE
  138. AC_C_CHAR_UNSIGNED
  139. #AC_C_STRINGIZE
  140. #AC_C_PROTOTYPES
  141. #checkpoint
  142. AC_CACHE_SAVE
  143. # Checks for typedefs, structures, and compiler characteristics
  144. AC_TYPE_PID_T
  145. AC_TYPE_SIZE_T
  146. AC_TYPE_UID_T
  147. AC_TYPE_LONG_LONG_INT
  148. AC_TYPE_INT8_T
  149. AC_TYPE_UINT8_T
  150. AC_TYPE_INT16_T
  151. AC_TYPE_UINT16_T
  152. AC_TYPE_INT32_T
  153. AC_TYPE_UINT32_T
  154. AC_TYPE_INT64_T
  155. AC_TYPE_UINT64_T
  156. AC_STRUCT_TIMEZONE
  157. AC_STRUCT_TM
  158. # Checks for library functions
  159. AC_FUNC_FORK
  160. AC_FUNC_LSTAT
  161. AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
  162. AC_FUNC_MALLOC
  163. AC_FUNC_MKTIME
  164. AC_FUNC_MMAP
  165. AC_FUNC_REALLOC
  166. AC_FUNC_STAT
  167. EGG_FUNC_TIMESPEC
  168. AC_FUNC_STRFTIME
  169. #checkpoint
  170. AC_CACHE_SAVE
  171. AC_CHECK_FUNCS([clock fsync getrusage isascii getpassphrase posix_madvise madvise])
  172. AC_CHECK_FUNCS([memcpy memmem memset random rename snprintf srandom gettime])
  173. #checkpoint
  174. AC_CACHE_SAVE
  175. AC_CHECK_FUNCS([strcasecmp strncasecmp vsnprintf inet_ntop])
  176. #autoscan suggested this....
  177. #These are recommended by autoscan, but no code supports it currently
  178. #AC_CHECK_FUNCS([alarm bzero dup2 getcwd gethostbyaddr gethostname getpass gettimeofday mbrlen
  179. #mkdir munmap realpath select setlocale socket strchr strerror strpbrk strrchr strstr strtol tzset])
  180. EGG_CHECK_FUNC_VSPRINTF
  181. EGG_CHECK_FUNC_UNAME
  182. # Make sure we have stdc headers, since we can't compile without them
  183. EGG_HEADER_STDC
  184. #checkpoint
  185. AC_CACHE_SAVE
  186. EGG_SUBST_VERSION
  187. #FIND_WRAPS
  188. DO_DEPS
  189. AC_CONFIG_FILES([Makefile lib/Makefile src/Makefile src/buildinfo.h])
  190. AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member])
  191. AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member])
  192. AH_TEMPLATE(HAVE_TIMESPEC, [Define to 1 if you have struct timespec in sys/time.h])
  193. AH_TEMPLATE(HAVE_TIMESPECSUB2, [Define to 1 if you have a timespecsub macro or function that takes two arguments (not three)])
  194. AH_BOTTOM([#include "config-sanity.h"])
  195. [
  196. GIT_REQUIRED=1
  197. if [ "$GIT_REQUIRED" = "1" ]; then
  198. if ! test -d .git; then
  199. echo ""
  200. echo ""
  201. echo "You have downloaded a GIT version of wraith."
  202. echo "Either 'git clone' from a git repository or download a source tarball"
  203. echo "A distribution version can be found at http://wraith.botpack.net/wiki/Download"
  204. echo ""
  205. echo ""
  206. exit 1
  207. fi
  208. fi
  209. ]
  210. [
  211. if test -d .git; then
  212. git submodule init
  213. git submodule update
  214. git submodule foreach --recursive git clean -fdx
  215. # Restore as it may have been removed by an older 'make distclean'
  216. if ! test -f src/response.h; then
  217. git checkout src/response.h
  218. fi
  219. fi
  220. ]
  221. if [[ -f lib/bdlib/configure ]]; then
  222. AC_CONFIG_SUBDIRS([lib/bdlib])
  223. fi
  224. if [[ -n "${LIBELF_BUNDLED}" ]] && [[ -f lib/libelf/configure ]]; then
  225. AC_CONFIG_SUBDIRS([lib/libelf])
  226. fi
  227. AC_OUTPUT
  228. CXX="$CXX" CXXFLAGS="$CXXFLAGS" TCL_INCLUDES="$TCL_INCLUDES" SSL_INCLUDES="$SSL_INCLUDES" \
  229. SED="$SED" src/generate_defs.sh || exit 1