configure.ac 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. # configure.ac -*- autoconf -*- vim: filetype=config
  2. #
  3. # Gearman server and library
  4. # Copyright (C) 2011-2014 Data Differential, http://datadifferential.com/
  5. # Copyright (C) 2008 Brian Aker, Eric Day, Monty Taylor
  6. # All rights reserved.
  7. #
  8. # Use and distribution licensed under the BSD license. See
  9. # the COPYING file in this directory for full text.
  10. m4_include([./version.m4])
  11. AC_REVISION([m4_esyscmd_s([git describe --always])])
  12. AC_PREREQ([2.69])
  13. AC_INIT([gearmand],[VERSION_NUMBER],[https://github.com/gearman/gearmand/issues],[gearmand],[http://gearman.info/])
  14. AC_CONFIG_AUX_DIR([build-aux])
  15. # Setup the compilers early on
  16. AC_PROG_CC([cc gcc clang])
  17. AC_PROG_CXX([c++ g++ clang++])
  18. AC_CONFIG_MACRO_DIR([m4])
  19. AC_CANONICAL_HOST
  20. AC_ARG_PROGRAM
  21. AC_USE_SYSTEM_EXTENSIONS
  22. AX_GENERATE_CHANGELOG
  23. AM_INIT_AUTOMAKE([1.11 color-tests -Wno-portability subdir-objects foreign tar-ustar])
  24. AC_CONFIG_HEADERS([gear_config.h:gear_config.in])dnl Keep filename to 8.3 for MS-DOS.
  25. AC_SUBST([AUTOHEADER_FILE],[gear_config.h])
  26. AC_CONFIG_SRCDIR([libgearman/gearman.cc])
  27. GEARMAN_LIBRARY_VERSION=8:0:0
  28. # | | |
  29. # +------+ | +---+
  30. # | | |
  31. # current:revision:age
  32. # | | |
  33. # | | +- increment if interfaces have been added
  34. # | | set to zero if interfaces have been removed
  35. # | | or changed
  36. # | +- increment if source code has changed
  37. # | set to zero if current is incremented
  38. # +- increment if interfaces have been added, removed or changed
  39. AC_SUBST([GEARMAN_LIBRARY_VERSION])
  40. LT_PREREQ([2.2])
  41. LT_INIT([dlopen])
  42. LT_LANG([C++])
  43. LT_LIB_M
  44. AC_SUBST([lt_cv_dlopen_libs])
  45. # AC_REQUIRE(AC_PROG_CC)
  46. AC_DEFUN([CHECK_CXX0X],[
  47. AC_LANG_PUSH([C++])
  48. AX_CHECK_COMPILE_FLAG([-std=c++0x],[
  49. CXX_STD="c++0x"])
  50. AC_LANG_POP([C++])
  51. ])
  52. CHECK_CXX0X
  53. AX_PLATFORM
  54. m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
  55. # First look for Boost, maybe for a specific minimum version:
  56. AC_DEFUN([CHECK_BOOST],
  57. [AX_BOOST_BASE([1.39],,[AC_MSG_ERROR(could not find boost)])
  58. AX_BOOST_PROGRAM_OPTIONS])
  59. CHECK_BOOST
  60. m4_include([libhashkit/include.m4])
  61. AX_CXX_CINTTYPES
  62. CONFIG_EXTRA
  63. m4_include([libtest/yatl.m4])
  64. AM_CONDITIONAL([BUILDING_GEARMAN],true)
  65. AM_CONDITIONAL([HAVE_LIBGEARMAN],true)
  66. AC_SUBST([_WITH_LIBGEARMAN_SUPPORT],["_WITH_LIBGEARMAN_SUPPORT 0"])
  67. AC_DEFINE([GEARMAND_BINARY],["./gearmand/gearmand"],[Name of the gearmand binary used in make test])
  68. AC_DEFINE([HAVE_LIBGEARMAN],[1], [libgearman support])
  69. AC_DEFINE([HAVE_GEARMAND_BINARY],[1],[gearmand binary was found])
  70. AC_DEFUN([CHECK_CURL],
  71. [AX_LIB_CURL([7.21.7],
  72. [AX_CHECK_LIBRARY([LIBCURL],[curl/curl.h],[curl])],
  73. [AC_DEFINE([HAVE_LIBCURL],[0],[Have the LIBCURL library])
  74. ])
  75. ])
  76. CHECK_CURL
  77. AM_CONDITIONAL([HAVE_LIBCURL],[test "x${ax_cv_have_LIBCURL}" = "xyes"])
  78. m4_include([m4/drizzled.m4])
  79. WITH_LIBDRIZZLE
  80. AX_LIB_SQLITE3
  81. AS_IF([test "x${WANT_SQLITE3}" = "xyes"],
  82. [AC_DEFINE([HAVE_LIBSQLITE3],[1],[Have the SQLITE3 library])],
  83. [AC_DEFINE([HAVE_LIBSQLITE3],[0],[Have the SQLITE3 library])])
  84. AM_CONDITIONAL([HAVE_LIBSQLITE3],[test "x${WANT_SQLITE3}" = "xyes"])
  85. PANDORA_ENABLE_DTRACE
  86. AX_HAVE_LIBPQ
  87. PANDORA_HAVE_LIBTOKYOCABINET
  88. AC_FUNC_STRERROR_R
  89. SOCKET_SEND_FLAGS
  90. FCNTL_FLAGS
  91. AX_ENABLE_LIBHIREDIS
  92. # Checks for programs.
  93. AC_CHECK_PROGS([DPKG_GENSYMBOLS],[dpkg-gensymbols])
  94. AC_CHECK_PROGS([OPENSSL],[openssl])
  95. AC_CHECK_PROGS([VALGRIND],['valgrind'])
  96. AC_CHECK_PROGS([WINE],['wine'])
  97. AC_CHECK_PROGS([RPMBUILD],[rpmbuild --nocheck])
  98. AC_CHECK_PROGS([RPMDEV_SETUPTREE],[rpmdev-setuptree])
  99. AC_CHECK_PROGS([RPM],[rpm])
  100. AC_PATH_PROG([GPERF],['gperf'],[])
  101. AS_IF([test -z "$GPERF"],
  102. [AC_MSG_ERROR([Unable to find gperf])])
  103. AC_PROG_AWK
  104. AC_PROG_INSTALL
  105. AC_PROG_LN_S
  106. AC_PROG_MAKE_SET
  107. AX_PROG_MEMCACHED
  108. AX_PROG_SPHINX_BUILD(,[AC_MSG_WARN([sphinx-build version 1.0 or greater is required to build man pages])])
  109. AX_WITH_PROG([LCOV],[lcov])
  110. AX_WITH_PROG([LCOV_GENHTML],[genhtml])
  111. AC_HEADER_SYS_WAIT
  112. AC_CHECK_HEADERS_ONCE([arpa/inet.h])
  113. AC_CHECK_HEADERS_ONCE([errno.h])
  114. AC_CHECK_HEADERS_ONCE([execinfo.h])
  115. AC_CHECK_HEADERS_ONCE([fcntl.h])
  116. AC_CHECK_HEADERS_ONCE([features.h])
  117. AC_CHECK_HEADERS_ONCE([fnmatch.h])
  118. AC_CHECK_HEADERS_ONCE([getopt.h])
  119. AC_CHECK_HEADERS_ONCE([inttypes.h])
  120. AC_CHECK_HEADERS_ONCE([limits.h])
  121. AC_CHECK_HEADERS_ONCE([mach/mach.h])
  122. AC_CHECK_HEADERS_ONCE([netdb.h])
  123. AC_CHECK_HEADERS_ONCE([netinet/in.h])
  124. AC_CHECK_HEADERS_ONCE([netinet/tcp.h])
  125. AC_CHECK_HEADERS_ONCE([poll.h])
  126. AC_CHECK_HEADERS_ONCE([pwd.h])
  127. AC_CHECK_HEADERS_ONCE([signal.h])
  128. AC_CHECK_HEADERS_ONCE([spawn.h])
  129. AC_CHECK_HEADERS_ONCE([stdarg.h])
  130. AC_CHECK_HEADERS_ONCE([stddef.h])
  131. AC_CHECK_HEADERS_ONCE([stdint.h])
  132. AC_CHECK_HEADERS_ONCE([stdio.h])
  133. AC_CHECK_HEADERS_ONCE([stdlib.h])
  134. AC_CHECK_HEADERS_ONCE([string.h])
  135. AC_CHECK_HEADERS_ONCE([strings.h])
  136. AC_CHECK_HEADERS_ONCE([sys/epoll.h])
  137. AC_CHECK_HEADERS_ONCE([sys/resource.h])
  138. AC_CHECK_HEADERS_ONCE([sys/socket.h])
  139. AC_CHECK_HEADERS_ONCE([sys/stat.h])
  140. AC_CHECK_HEADERS_ONCE([sys/time.h])
  141. AC_CHECK_HEADERS_ONCE([sys/types.h])
  142. AC_CHECK_HEADERS_ONCE([sys/utsname.h])
  143. AC_CHECK_HEADERS_ONCE([sys/wait.h])
  144. AC_CHECK_HEADERS_ONCE([syslog.h])
  145. AC_CHECK_HEADERS_ONCE([unistd.h])
  146. AC_CHECK_HEADERS_ONCE([winsock2.h])
  147. AC_CHECK_HEADERS_ONCE([libmemcached-1.0/types/return.h])
  148. AC_CHECK_DECL([htonll],[AC_DEFINE([HAVE_HTONLL],[1],
  149. [Define to 1 if you have htonll.])])
  150. AM_CONDITIONAL([BUILD_WIN32_WRAPPERS],[test "x$ac_cv_header_winsock2_h" = "xyes"])
  151. AS_IF([test "x$ac_cv_header_winsock2_h" = "xyes"],
  152. [AM_LDFLAGS="$AM_LDFLAGS -lws2_32"
  153. AM_CFLAGS="$AM_CFLAGS $NO_WERROR"
  154. AM_CXXFLAGS="$AM_CXXFLAGS $NO_WERROR"
  155. ])
  156. # Checks for typedefs, structures, and compiler characteristics.
  157. AC_CHECK_TYPES([ptrdiff_t])
  158. AC_C_CONST
  159. AC_C_INLINE
  160. AC_C_VOLATILE
  161. AC_HEADER_STDBOOL
  162. AC_CHECK_HEADERS_ONCE([sys/time.h])
  163. AC_TYPE_INT32_T
  164. AC_TYPE_INT64_T
  165. AC_TYPE_OFF_T
  166. AC_TYPE_PID_T
  167. AC_TYPE_SIZE_T
  168. AC_TYPE_SSIZE_T
  169. AC_TYPE_UID_T
  170. AC_TYPE_UINT16_T
  171. AC_TYPE_UINT32_T
  172. AC_TYPE_UINT64_T
  173. AC_TYPE_UINT8_T
  174. # Checks for library functions.
  175. AC_FUNC_ERROR_AT_LINE
  176. AC_FUNC_FORK
  177. AC_FUNC_MEMCMP
  178. AC_FUNC_STRERROR_R
  179. AC_FUNC_VPRINTF
  180. AC_REPLACE_FNMATCH
  181. AC_CHECK_FUNCS([accept4])
  182. AC_CHECK_FUNCS([dup2])
  183. AC_CHECK_FUNCS([fork])
  184. AC_CHECK_FUNCS([gettimeofday])
  185. AC_CHECK_FUNCS([memchr])
  186. AC_CHECK_FUNCS([memmove])
  187. AC_CHECK_FUNCS([memset])
  188. AC_CHECK_FUNCS([pipe])
  189. AC_CHECK_FUNCS([pipe2])
  190. AC_CHECK_FUNCS([select])
  191. AC_CHECK_FUNCS([setenv])
  192. AC_CHECK_FUNCS([socket])
  193. AC_CHECK_FUNCS([strcasecmp])
  194. AC_CHECK_FUNCS([strdup])
  195. AC_CHECK_FUNCS([strerror])
  196. AC_CHECK_FUNCS([strncasecmp])
  197. AC_CHECK_FUNCS([strtol])
  198. AC_CHECK_FUNCS([strtoul])
  199. AC_CHECK_FUNCS([uname])
  200. AC_CHECK_FUNCS([atexit])
  201. AC_CHECK_FUNCS([getcwd])
  202. AC_CHECK_FUNCS([strstr])
  203. AC_CHECK_FUNC([setsockopt],[],[AC_CHECK_LIB([socket],[setsockopt])])
  204. AC_CHECK_FUNC([bind],[],[AC_CHECK_LIB([bind],[bind])])
  205. # Check for -lrt
  206. AC_CHECK_LIB([rt],[clock_gettime],
  207. [AX_SAVE_FLAGS
  208. LIBS="$LIB -lrt"
  209. AC_CHECK_FUNCS([clock_gettime])
  210. AX_RESTORE_FLAGS
  211. AC_SUBST([RT_LIB],[-lrt])
  212. AC_DEFINE([HAVE_LIBRT],[1],[Have -lrt])
  213. ],
  214. [AC_CHECK_FUNCS([clock_gettime])])
  215. # Check for OPENSSL
  216. AX_CHECK_OPENSSL([have_openssl=yes
  217. AC_DEFINE([HAVE_OPENSSL],[1],[Enable openssl Support])],
  218. [have_openssl=no])
  219. AM_CONDITIONAL([ENABLE_OPENSSL],[test "x${have_openssl}" = "xyes"])
  220. # Check for wolfSSL
  221. AX_CHECK_WOLFSSL([have_wolfssl=yes],[have_wolfssl=no])
  222. AM_CONDITIONAL([ENABLE_WOLFSSL],[test "x${have_wolfssl}" = "xyes"])
  223. AC_DEFUN([AX_ENABLE_SSL],
  224. [AC_PREREQ([2.69])dnl
  225. m4_define([_SSL_ENABLE_DEFAULT], [m4_if($1, no, no, no)])dnl
  226. AC_ARG_ENABLE([ssl],
  227. [AS_HELP_STRING([--enable-ssl],
  228. [Enable ssl support for Gearman @<:@default=]_SSL_ENABLE_DEFAULT[@:>@])],
  229. [AS_CASE([$enableval],
  230. [yes],[enable_ssl=yes],
  231. [no],[enable_ssl=no],
  232. [enable_ssl=no])
  233. ],
  234. [enable_ssl=]_SSL_ENABLE_DEFAULT)
  235. AS_IF([test "x${enable_ssl}" = "xyes"],
  236. [AS_IF([test "x${have_wolfssl}" = "xyes"],
  237. [AC_DEFINE([HAVE_SSL],[1],[Enable SSL Support])
  238. AC_DEFINE([HAVE_OPENSSL],[0],[Enable OPENSSL Support])
  239. ],
  240. [AS_IF([test "x${have_openssl}" = "xyes"],
  241. [AC_DEFINE([HAVE_SSL],[1],[Enable SSL Support])]
  242. )]
  243. )
  244. ]
  245. )
  246. AM_CONDITIONAL([ENABLE_SSL],[test "x${enable_ssl}" = "xyes"])
  247. ])
  248. if [ test "x${enable_ssl}" = "xyes" ]; then
  249. if ! [ test "x${have_openssl}" = "xyes" ] && ! [ test "x${have_wolfssl}" = "xyes" ]; then
  250. AC_MSG_ERROR([Unable to find either openssl or wolfssl])
  251. fi
  252. fi
  253. AX_ENABLE_SSL
  254. AX_ENABLE_LIBMEMCACHED
  255. AC_DEFINE([GEARMAND_BLOBSLAP_WORKER],[1],[Have Gearman Blobslap Worker])
  256. AX_LIBEVENT(,[AC_MSG_ERROR([Unable to find libevent])])
  257. AX_LIBEVENT2(,[AC_MSG_ERROR([Unable to find libevent2])])
  258. AX_LIBEVENT2_PTHREADS(,[AC_MSG_ERROR([Unable to find libevent_pthreads])])
  259. AX_UUID(,[AC_MSG_ERROR([Unable to find libuuid])])
  260. AX_UUID_GENERATE_TIME_SAFE
  261. AX_AM_JOBSERVER([yes])
  262. AS_IF([test "x${TARGET_LINUX}" = "xtrue"],
  263. [AC_DEFINE([BUILD_LIBHOSTILE],[1],[Build libhostile])],[AC_DEFINE([BUILD_LIBHOSTILE],[0],[Build libhostile])])
  264. AM_CONDITIONAL([TARGET_HOSTILE],[test "x${TARGET_LINUX}" = "xtrue"])
  265. AC_DEFUN([CHECK_FOR_PTHREAD_AND_SASL],
  266. [AC_LANG_PUSH([C++])
  267. AX_PTHREAD(, [AC_MSG_ERROR(could not find Posix Pthread support)])
  268. AX_PTHREAD_TIMEDJOIN_NP
  269. AC_LANG_POP([C++])
  270. ])
  271. CHECK_FOR_PTHREAD_AND_SASL
  272. AX_ENDIAN
  273. AX_HEX_VERSION([LIBGEARMAN],[$VERSION])
  274. AC_SUBST([RPM_RELEASE],[1])
  275. AX_HARDEN_COMPILER_FLAGS
  276. AM_CONDITIONAL([TARGET_MINGW],[test "x${MINGW}" = "xtrue"])
  277. # backtrace(), others require shared builds
  278. AS_IF([test "x$enable_shared" = "xyes"],
  279. [AC_DEFINE([HAVE_SHARED_ENABLED],[1],[Enable code which requires shared library support. Like backtrace().])
  280. AX_CXX_GCC_ABI_DEMANGLE])
  281. AM_CONDITIONAL([SHARED_ENABLED],[test "x$enable_shared" = "xyes"])
  282. AC_CONFIG_FILES([Makefile
  283. docs/source/conf.py
  284. libgearman-1.0/version.h
  285. scripts/gearmand
  286. scripts/gearmand.xml
  287. scripts/smf_install.sh
  288. support/gearmand.init
  289. support/gearmand.pc
  290. support/gearmand.spec])
  291. AS_IF([test "x${ax_enable_debug}" = "xyes"],
  292. [AC_DEFUN([CHECK_CXX11],
  293. [AC_LANG_PUSH([C++])
  294. AX_CHECK_COMPILE_FLAG([-std=c++11], [CXX_STD="c++11"])
  295. AC_LANG_POP([C++])
  296. ])
  297. CHECK_CXX11])
  298. CXXFLAGS=" $CXXFLAGS -std=$CXX_STD"
  299. AC_OUTPUT
  300. echo "---"
  301. echo "Configuration summary for $PACKAGE_NAME version $VERSION"
  302. echo ""
  303. echo " * Installation prefix: $prefix"
  304. echo " * System type: $host_vendor-$host_os"
  305. echo " * Host CPU: $host_cpu"
  306. echo " * C Compiler: $CC $CC_VERSION"
  307. echo " * C Flags: $CFLAGS"
  308. echo " * C++ Compiler: $CXX $CXX_VERSION"
  309. echo " * C++ Flags: $CXXFLAGS"
  310. echo " * CPP Flags: $CPPFLAGS"
  311. echo " * LIBS: $LIBS"
  312. echo " * LDFLAGS Flags: $LDFLAGS"
  313. echo " * Assertions enabled: $ax_enable_assert"
  314. echo " * Debug enabled: $ax_enable_debug"
  315. echo " * Warnings as failure: $ac_cv_warnings_as_errors"
  316. echo " * Building with hiredis $ac_enable_hiredis"
  317. echo " * Building with libsqlite3 $WANT_SQLITE3"
  318. echo " * Building with libdrizzle $ac_enable_libdrizzle"
  319. echo " * Building with libmemcached $ax_enable_libmemcached"
  320. echo " * Building with libpq $ac_cv_libpq"
  321. echo " * Building with tokyocabinet $ac_enable_libtokyocabinet"
  322. echo " * Building with libmysql $found_mysql"
  323. echo " * SSL enabled: $enable_ssl"
  324. echo " * wolfssl found: $have_wolfssl"
  325. echo " * openssl found: $have_openssl"
  326. echo " * make -j: $enable_jobserver"
  327. echo " * VCS checkout: $ac_cv_vcs_checkout"
  328. echo " * sphinx-build: $SPHINXBUILD"
  329. echo ""
  330. echo "---"
  331. if [test "x${ax_enable_debug}" = "xyes"]; then
  332. echo "*****"
  333. echo "*"
  334. echo "* NOTE: You should execute gearmand with --threads 0 when --enable-debug is specified."
  335. echo "*"
  336. echo "*****"
  337. fi
  338. case "$host_os" in
  339. *freebsd*)
  340. echo "*****"
  341. echo "*"
  342. echo "* NOTE: You are on FreeBSD. BSD 'make' will not work."
  343. echo "*"
  344. echo "* use 'gmake' To build gearmand"
  345. echo "*"
  346. echo "*****"
  347. ;;
  348. esac