configure.ac 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959
  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. The ASF licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing,
  13. # software distributed under the License is distributed on an
  14. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. # KIND, either express or implied. See the License for the
  16. # specific language governing permissions and limitations
  17. # under the License.
  18. #
  19. AC_PREREQ(2.65)
  20. AC_CONFIG_MACRO_DIR([./aclocal])
  21. AC_INIT([thrift], [0.10.0])
  22. AC_CONFIG_AUX_DIR([.])
  23. AM_INIT_AUTOMAKE([1.13 subdir-objects tar-ustar])
  24. PKG_PROG_PKG_CONFIG
  25. AC_ARG_VAR([PY_PREFIX], [Prefix for installing Python modules.
  26. (Normal --prefix is ignored for Python because
  27. Python has different conventions.)
  28. Default = "/usr"])
  29. AS_IF([test "x$PY_PREFIX" = x], [PY_PREFIX="/usr"])
  30. AC_ARG_VAR([JAVA_PREFIX], [Prefix for installing the Java lib jar.
  31. Default = "/usr/local/lib"])
  32. AS_IF([test "x$JAVA_PREFIX" != x], [JAVA_PREFIX="$JAVA_PREFIX/usr/local/lib"],
  33. [test "x$PREFIX" != x], [JAVA_PREFIX="$PREFIX/usr/local/lib"],
  34. [JAVA_PREFIX="/usr/local/lib"])
  35. AC_ARG_VAR([RUBY_PREFIX], [Prefix for installing Ruby modules.
  36. (Normal --prefix is ignored for Ruby because
  37. Ruby has different conventions.)
  38. Default = none, let ruby setup decide])
  39. AC_ARG_VAR([PHP_PREFIX], [Prefix for installing PHP modules.
  40. (Normal --prefix is ignored for PHP because
  41. PHP has different conventions.)
  42. Default = "/usr/lib/php"])
  43. AS_IF([test "x$PHP_PREFIX" = x], [PHP_PREFIX="/usr/lib/php"])
  44. AC_ARG_VAR([PHP_CONFIG_PREFIX],
  45. [Prefix for installing PHP extension module .ini file.
  46. (Normal --prefix is ignored for PHP because PHP has
  47. different conventions.)
  48. Default = "/etc/php.d"])
  49. AS_IF([test "x$PHP_CONFIG_PREFIX" = x], [PHP_CONFIG_PREFIX="/etc/php.d"])
  50. AC_ARG_VAR([INSTALLDIRS], [When installing Perl modules, specifies which
  51. of the sets of installation directories
  52. to choose: perl, site or vendor.
  53. Default = "vendor"])
  54. AS_IF([test "x$INSTALLDIRS" = x], [INSTALLDIRS="vendor"])
  55. AC_ARG_VAR([PERL_PREFIX], [Prefix for installing Perl modules.
  56. (Normal --prefix is ignored for Perl because
  57. Perl has different conventions.)
  58. Ignored, when INSTALLDIRS set to site or vendor.
  59. Default = "/usr/local/lib"])
  60. AS_IF([test "x$PERL_PREFIX" = x], [PERL_PREFIX="/usr/local"])
  61. AC_ARG_VAR([CABAL_CONFIGURE_FLAGS],
  62. [Extra flags to pass to cabal: "cabal Setup.lhs configure $CABAL_CONFIGURE_FLAGS".
  63. (Typically used to set --user or force --global.)])
  64. AC_SUBST(CABAL_CONFIGURE_FLAGS)
  65. AC_ARG_VAR([D_IMPORT_PREFIX], [Prefix for installing D modules.
  66. [INCLUDEDIR/d2]])
  67. AS_IF([test "x$D_IMPORT_PREFIX" = x], [D_IMPORT_PREFIX="${includedir}/d2"])
  68. AC_ARG_VAR([DMD_LIBEVENT_FLAGS], [DMD flags for linking libevent (auto-detected if not set).])
  69. AC_ARG_VAR([DMD_OPENSSL_FLAGS], [DMD flags for linking OpenSSL (auto-detected if not set).])
  70. AC_PROG_CC
  71. AC_PROG_CPP
  72. AC_PROG_CXX
  73. AC_PROG_INSTALL
  74. AC_PROG_LIBTOOL
  75. AC_PROG_MAKE_SET
  76. AC_PROG_BISON(2.5)
  77. AC_PROG_YACC
  78. AC_PROG_LEX
  79. AM_PROG_LEX
  80. AC_PROG_LN_S
  81. AC_PROG_MKDIR_P
  82. AC_PROG_AWK
  83. AC_PROG_RANLIB
  84. AC_LANG([C++])
  85. AX_CXX_COMPILE_STDCXX_11([noext], [optional])
  86. AM_EXTRA_RECURSIVE_TARGETS([style])
  87. AC_SUBST(CPPSTYLE_CMD, 'find . -type f \( -iname "*.h" -or -iname "*.cpp" -or -iname "*.cc" -or -iname "*.tcc" \) -printf "Reformatting: %h/%f\n" -exec clang-format -i {} \;')
  88. AC_ARG_ENABLE([libs],
  89. AS_HELP_STRING([--enable-libs], [build the Apache Thrift libraries [default=yes]]),
  90. [], enable_libs=yes
  91. )
  92. have_libs=yes
  93. if test "$enable_libs" = "no"; then
  94. have_libs="no"
  95. with_cpp="no"
  96. with_c_glib="no"
  97. with_java="no"
  98. with_csharp="no"
  99. with_python="no"
  100. with_ruby="no"
  101. with_haskell="no"
  102. with_haxe="no"
  103. with_perl="no"
  104. with_php="no"
  105. with_php_extension="no"
  106. with_dart="no"
  107. with_erlang="no"
  108. with_go="no"
  109. with_d="no"
  110. with_nodejs="no"
  111. with_lua="no"
  112. fi
  113. AX_THRIFT_LIB(cpp, [C++], yes)
  114. have_cpp=no
  115. if test "$with_cpp" = "yes"; then
  116. AX_BOOST_BASE([1.53.0])
  117. if test "x$succeeded" = "xyes" ; then
  118. AC_SUBST([BOOST_LIB_DIR], [$(echo "$BOOST_LDFLAGS" | sed -e 's/^\-L//')])
  119. AC_SUBST([BOOST_CHRONO_LDADD], [$(echo "$BOOST_LIB_DIR/libboost_chrono.a")])
  120. AC_SUBST([BOOST_FILESYSTEM_LDADD], [$(echo "$BOOST_LIB_DIR/libboost_filesystem.a")])
  121. AC_SUBST([BOOST_SYSTEM_LDADD], [$(echo "$BOOST_LIB_DIR/libboost_system.a")])
  122. AC_SUBST([BOOST_TEST_LDADD], [$(echo "$BOOST_LIB_DIR/libboost_unit_test_framework.a")])
  123. AC_SUBST([BOOST_THREAD_LDADD], [$(echo "$BOOST_LIB_DIR/libboost_thread.a")])
  124. have_cpp="yes"
  125. fi
  126. AX_CHECK_OPENSSL()
  127. AX_LIB_EVENT([1.0])
  128. have_libevent=$success
  129. AX_LIB_ZLIB([1.2.3])
  130. have_zlib=$success
  131. AX_THRIFT_LIB(qt4, [Qt], yes)
  132. have_qt=no
  133. if test "$with_qt4" = "yes"; then
  134. PKG_CHECK_MODULES([QT], [QtCore >= 4.3, QtNetwork >= 4.3], have_qt=yes, have_qt=no)
  135. fi
  136. if test "$have_qt" = "yes"; then
  137. AC_PATH_PROGS([QT_MOC], [moc-qt4 moc], "fail")
  138. if test "$QT_MOC" = "fail"; then
  139. have_qt=no
  140. fi
  141. fi
  142. AX_THRIFT_LIB(qt5, [Qt5], yes)
  143. have_qt5=no
  144. qt_reduce_reloc=""
  145. if test "$with_qt5" = "yes"; then
  146. PKG_CHECK_MODULES([QT5], [Qt5Core >= 5.0, Qt5Network >= 5.0],
  147. [have_qt5=yes;qt_reduce_reloc=`$PKG_CONFIG --variable=qt_config Qt5Core | grep "reduce_relocations"`],
  148. [have_qt5=no])
  149. fi
  150. if test "$have_qt5" = "yes"; then
  151. AC_PATH_PROGS([QT5_MOC], [moc-qt5 moc], "fail")
  152. if test "$QT5_MOC" = "fail"; then
  153. have_qt5=no
  154. fi
  155. fi
  156. fi
  157. AM_CONDITIONAL([WITH_CPP], [test "$have_cpp" = "yes"])
  158. AM_CONDITIONAL([AMX_HAVE_LIBEVENT], [test "$have_libevent" = "yes"])
  159. AM_CONDITIONAL([AMX_HAVE_ZLIB], [test "$have_zlib" = "yes"])
  160. AM_CONDITIONAL([AMX_HAVE_QT], [test "$have_qt" = "yes"])
  161. AM_CONDITIONAL([AMX_HAVE_QT5], [test "$have_qt5" = "yes"])
  162. AM_CONDITIONAL([QT5_REDUCE_RELOCATIONS], [test "x$qt_reduce_reloc" != "x"])
  163. AX_THRIFT_LIB(c_glib, [C (GLib)], yes)
  164. if test "$with_c_glib" = "yes"; then
  165. PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.0], have_glib2=yes, have_glib2=no)
  166. PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.0], have_gobject2=yes, have_gobject2=no)
  167. if test "$have_glib2" = "yes" -a "$have_gobject2" = "yes" ; then
  168. have_c_glib="yes"
  169. fi
  170. fi
  171. AM_CONDITIONAL(WITH_C_GLIB, [test "$have_glib2" = "yes" -a "$have_gobject2" = "yes"])
  172. AX_THRIFT_LIB(csharp, [C#], yes)
  173. if test "$with_csharp" = "yes"; then
  174. PKG_CHECK_MODULES(MONO, mono >= 2.11.0, mono_2_11=yes, mono_2_11=no)
  175. if test "$mono_2_11" == "yes"; then
  176. AC_PATH_PROG([MCS], [mcs])
  177. if test "x$MCS" != "x"; then
  178. mono_mcs="yes"
  179. fi
  180. fi
  181. PKG_CHECK_MODULES(MONO, mono >= 2.0.0, net_3_5=yes, net_3_5=no)
  182. PKG_CHECK_MODULES(MONO, mono >= 1.2.4, have_mono=yes, have_mono=no)
  183. if test "$have_mono" = "yes" ; then
  184. have_csharp="yes"
  185. fi
  186. fi
  187. AM_CONDITIONAL(WITH_MONO, [test "$have_csharp" = "yes"])
  188. AM_CONDITIONAL(NET_2_0, [test "$net_3_5" = "no"])
  189. AM_CONDITIONAL(MONO_MCS, [test "$mono_mcs" = "yes"])
  190. AX_THRIFT_LIB(java, [Java], yes)
  191. if test "$with_java" = "yes"; then
  192. AX_JAVAC_AND_JAVA
  193. AC_PATH_PROG([ANT], [ant])
  194. AX_CHECK_ANT_VERSION($ANT, 1.7)
  195. AC_SUBST(CLASSPATH)
  196. AC_SUBST(ANT_FLAGS)
  197. if test "x$JAVA" != "x" && test "x$JAVAC" != "x" && test "x$ANT" != "x" ; then
  198. have_java="yes"
  199. fi
  200. fi
  201. AM_CONDITIONAL([WITH_JAVA], [test "$have_java" = "yes"])
  202. AX_THRIFT_LIB(erlang, [Erlang], yes)
  203. if test "$with_erlang" = "yes"; then
  204. AC_ERLANG_PATH_ERL
  205. AC_ERLANG_PATH_ERLC
  206. AC_PATH_PROG([REBAR], [rebar])
  207. if test -n "$ERLC" ; then
  208. AC_ERLANG_SUBST_LIB_DIR
  209. # Install into the detected Erlang directory instead of $libdir/erlang/lib
  210. ERLANG_INSTALL_LIB_DIR="$ERLANG_LIB_DIR"
  211. AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
  212. fi
  213. if test -n "$ERL" -a -n "$ERLC" && test "x$REBAR" != "x" ; then
  214. have_erlang="yes"
  215. # otp_release is simply a number (like "17") for OTP17+ while "R16..." for OTP16 or less.
  216. # OTP version is currently only used for running tests.
  217. if $ERL -eval 'erlang:display(erlang:system_info(otp_release)),halt().' -noshell | grep "^\"R" >/dev/null; then
  218. erlang_otp16_or_less="yes"
  219. fi
  220. fi
  221. fi
  222. AM_CONDITIONAL(WITH_ERLANG, [test "$have_erlang" = "yes"])
  223. AM_CONDITIONAL(ERLANG_OTP16, [test "$erlang_otp16_or_less" = "yes"])
  224. AX_THRIFT_LIB(nodejs, [Nodejs], yes)
  225. have_nodejs=no
  226. if test "$with_nodejs" = "yes"; then
  227. AC_PATH_PROGS([NODEJS], [nodejs node])
  228. AC_PATH_PROG([NPM], [npm])
  229. if test "x$NODEJS" != "x" -a "x$NPM" != "x"; then
  230. have_nodejs="yes"
  231. fi
  232. fi
  233. AM_CONDITIONAL(WITH_NODEJS, [test "$have_nodejs" = "yes"])
  234. AM_CONDITIONAL(HAVE_NPM, [test "x$NPM" != "x"])
  235. AX_THRIFT_LIB(lua, [Lua], yes)
  236. have_lua=no
  237. if test "$with_lua" = "yes"; then
  238. AX_PROG_LUA(5.2,, have_lua="yes", have_lua="no")
  239. if test "$have_lua" = "yes"; then
  240. AX_LUA_HEADERS(, have_lua="no")
  241. AX_LUA_LIBS(, have_lua="no")
  242. fi
  243. fi
  244. AM_CONDITIONAL(WITH_LUA, [test "$have_lua" = "yes"])
  245. # Find python regardless of with_python value, because it's needed by make cross
  246. AM_PATH_PYTHON(2.6,, :)
  247. AX_THRIFT_LIB(python, [Python], yes)
  248. if test "$with_python" = "yes"; then
  249. if test -n "$PYTHON"; then
  250. have_python="yes"
  251. fi
  252. AC_PATH_PROG([TRIAL], [trial])
  253. if test -n "$TRIAL"; then
  254. have_trial="yes"
  255. fi
  256. fi
  257. AM_CONDITIONAL(WITH_PYTHON, [test "$have_python" = "yes"])
  258. AM_CONDITIONAL(WITH_TWISTED_TEST, [test "$have_trial" = "yes"])
  259. # Find "python3" executable.
  260. # It's distro specific and far from ideal but needed to cross test py2-3 at once.
  261. # TODO: find "python2" if it's 3.x
  262. if python --version 2>&1 | grep -q "Python 2"; then
  263. AC_PATH_PROGS([PYTHON3], [python3 python3.5 python35 python3.4 python34])
  264. if test -n "$PYTHON3"; then
  265. have_py3="yes"
  266. fi
  267. fi
  268. AM_CONDITIONAL(WITH_PY3, [test "$have_py3" = "yes"])
  269. AX_THRIFT_LIB(perl, [Perl], yes)
  270. if test "$with_perl" = "yes"; then
  271. AC_PATH_PROG([PERL], [perl])
  272. if test -n "$PERL" ; then
  273. AC_PROG_PERL_MODULES([Bit::Vector], success="yes", success="no")
  274. have_perl_bit_vector="$success"
  275. AC_PROG_PERL_MODULES([Class::Accessor], success="yes", success="no")
  276. have_perl_class_accessor="$success"
  277. fi
  278. if test -n "$PERL" -a "$have_perl_bit_vector" = "yes" ; then
  279. if test -n "$PERL" -a "$have_perl_class_accessor" = "yes" ; then
  280. have_perl="yes"
  281. fi
  282. fi
  283. fi
  284. AM_CONDITIONAL(WITH_PERL, [test "$have_perl" = "yes"])
  285. AX_THRIFT_LIB(php, [PHP], yes)
  286. if test "$with_php" = "yes"; then
  287. AC_PATH_PROG([PHP], [php])
  288. if test -n "$PHP" ; then
  289. have_php="yes"
  290. fi
  291. fi
  292. AM_CONDITIONAL(WITH_PHP, [test "$have_php" = "yes"])
  293. AX_THRIFT_LIB(php_extension, [PHP_EXTENSION], yes)
  294. if test "$with_php_extension" = "yes"; then
  295. if test -f "lib/php/src/ext/thrift_protocol/configure"; then
  296. AC_PATH_PROG([PHP_CONFIG], [php-config])
  297. if test -n "$PHP_CONFIG" ; then
  298. AC_CONFIG_SUBDIRS([lib/php/src/ext/thrift_protocol])
  299. have_php_extension="yes"
  300. fi
  301. fi
  302. fi
  303. AM_CONDITIONAL(WITH_PHP_EXTENSION, [test "$have_php_extension" = "yes"])
  304. AC_PATH_PROG([PHPUNIT], [phpunit])
  305. AM_CONDITIONAL(HAVE_PHPUNIT, [test "x$PHPUNIT" != "x"])
  306. AX_THRIFT_LIB(dart, [DART], yes)
  307. if test "$with_dart" = "yes"; then
  308. AC_PATH_PROG([DART], [dart])
  309. AC_PATH_PROG([DARTPUB], [pub])
  310. if test "x$DART" != "x" -a "x$DARTPUB" != "x"; then
  311. have_dart="yes"
  312. fi
  313. fi
  314. AM_CONDITIONAL(WITH_DART, [test "$have_dart" = "yes"])
  315. AX_THRIFT_LIB(ruby, [Ruby], yes)
  316. have_ruby=no
  317. if test "$with_ruby" = "yes"; then
  318. AC_PATH_PROG([RUBY], [ruby])
  319. AC_PATH_PROG([BUNDLER], [bundle])
  320. if test "x$RUBY" != "x" -a "x$BUNDLER" != "x"; then
  321. have_ruby="yes"
  322. fi
  323. fi
  324. AM_CONDITIONAL(WITH_RUBY, [test "$have_ruby" = "yes"])
  325. AM_CONDITIONAL(HAVE_BUNDLER, [test "x$BUNDLER" != "x"])
  326. AX_THRIFT_LIB(haskell, [Haskell], yes)
  327. have_haskell=no
  328. RUNHASKELL=true
  329. CABAL=true
  330. if test "$with_haskell" = "yes"; then
  331. AC_PATH_PROG([CABAL], [cabal])
  332. AC_PATH_PROG([RUNHASKELL], [runhaskell])
  333. if test "x$CABAL" != "x" -a "x$RUNHASKELL" != "x"; then
  334. have_haskell="yes"
  335. else
  336. RUNHASKELL=true
  337. CABAL=true
  338. fi
  339. fi
  340. AC_SUBST(CABAL)
  341. AC_SUBST(RUNHASKELL)
  342. AM_CONDITIONAL(WITH_HASKELL, [test "$have_haskell" = "yes"])
  343. AX_THRIFT_LIB(go, [Go], yes)
  344. if test "$with_go" = "yes"; then
  345. AC_PATH_PROG([GO], [go])
  346. if [[ -x "$GO" ]] ; then
  347. AS_IF([test -n "$GO"],[
  348. ax_go_version="1.4"
  349. AC_MSG_CHECKING([for Go version])
  350. golang_version=`$GO version 2>&1 | $SED -e 's/\(go \)\(version \)\(go\)\(@<:@0-9@:>@.@<:@0-9@:>@.@<:@0-9@:>@\)\(@<:@\*@:>@*\).*/\4/'`
  351. AC_MSG_RESULT($golang_version)
  352. AC_SUBST([golang_version],[$golang_version])
  353. AX_COMPARE_VERSION([$ax_go_version],[le],[$golang_version],[
  354. :
  355. have_go="yes"
  356. ],[
  357. :
  358. have_go="no"
  359. ])
  360. ],[
  361. AC_MSG_WARN([could not find Go ])
  362. have_go="no"
  363. ])
  364. fi
  365. fi
  366. AM_CONDITIONAL(WITH_GO, [test "$have_go" = "yes"])
  367. AX_THRIFT_LIB(haxe, [Haxe], yes)
  368. if test "$with_haxe" = "yes"; then
  369. AC_PATH_PROG([HAXE], [haxe])
  370. if [[ -x "$HAXE" ]] ; then
  371. AX_PROG_HAXE_VERSION( [3.1.3], have_haxe="yes", have_haxe="no")
  372. fi
  373. fi
  374. AM_CONDITIONAL(WITH_HAXE, [test "$have_haxe" = "yes"])
  375. AX_THRIFT_LIB(d, [D], yes)
  376. if test "$with_d" = "yes"; then
  377. AX_DMD
  378. AC_SUBST(DMD)
  379. if test "x$DMD" != "x"; then
  380. have_d="yes"
  381. fi
  382. fi
  383. # Determine actual name of the generated D library for use in the command line
  384. # when compiling tests. This is needed because the -l<lib> syntax doesn't work
  385. # with OPTLINK (Windows).
  386. lib_prefix=lib
  387. lib_suffix=a
  388. case "$host_os" in
  389. cygwin* | mingw* | pw32* | cegcc*)
  390. lib_prefix=""
  391. lib_suffix=lib
  392. ;;
  393. esac
  394. D_LIB_NAME="${lib_prefix}thriftd.${lib_suffix}"
  395. AC_SUBST(D_LIB_NAME)
  396. D_EVENT_LIB_NAME="${lib_prefix}thriftd-event.${lib_suffix}"
  397. AC_SUBST(D_EVENT_LIB_NAME)
  398. D_SSL_LIB_NAME="${lib_prefix}thriftd-ssl.${lib_suffix}"
  399. AC_SUBST(D_SSL_LIB_NAME)
  400. if test "$have_d" = "yes"; then
  401. AX_CHECK_D_MODULE(deimos.event2.event)
  402. have_deimos_event2=$success
  403. with_d_event_tests="no"
  404. if test "$have_deimos_event2" = "yes"; then
  405. if test "x$DMD_LIBEVENT_FLAGS" = "x"; then
  406. if test "$dmd_optlink" = "yes"; then
  407. AC_MSG_WARN([D libevent interface found, but cannot auto-detect \
  408. linker flags for OPTLINK. Please set DMD_LIBEVENT_FLAGS manually.])
  409. else
  410. AX_LIB_EVENT([2.0])
  411. if test "$success" = "yes"; then
  412. DMD_LIBEVENT_FLAGS=$(echo "$LIBEVENT_LDFLAGS $LIBEVENT_LIBS" | \
  413. sed -e 's/^ *//g;s/ *$//g;s/^\(.\)/-L\1/g;s/ */ -L/g')
  414. with_d_event_tests="yes"
  415. else
  416. AC_MSG_WARN([D libevent interface present, but libevent library not found.])
  417. fi
  418. fi
  419. else
  420. with_d_event_tests="yes"
  421. fi
  422. fi
  423. AX_CHECK_D_MODULE(deimos.openssl.ssl)
  424. have_deimos_openssl=$success
  425. with_d_ssl_tests="no"
  426. if test "$have_deimos_openssl" = "yes"; then
  427. if test "x$DMD_OPENSSL_FLAGS" = "x"; then
  428. if test "$dmd_optlink" = "yes"; then
  429. AC_MSG_WARN([D OpenSSL interface found, but cannot auto-detect \
  430. linker flags for OPTLINK. Please set DMD_OPENSSL_FLAGS manually.])
  431. else
  432. AX_CHECK_OPENSSL([with_d_ssl_tests="yes"])
  433. if test "$with_d_ssl_tests" = "yes"; then
  434. DMD_OPENSSL_FLAGS=$(echo "$OPENSSL_LDFLAGS $OPENSSL_LIBS" | \
  435. sed -e 's/^ *//g;s/ *$//g;s/^\(.\)/-L\1/g;s/ */ -L/g')
  436. else
  437. AC_MSG_WARN([D OpenSSL interface present, but OpenSSL library not found.])
  438. fi
  439. fi
  440. else
  441. with_d_ssl_tests="yes"
  442. fi
  443. fi
  444. fi
  445. AM_CONDITIONAL(WITH_D, [test "$have_d" = "yes"])
  446. AM_CONDITIONAL(DMD_OPTLINK, [test "$dmd_optlink" = "yes"])
  447. AC_SUBST(DMD_OF_DIRSEP, "$dmd_of_dirsep")
  448. AM_CONDITIONAL(HAVE_DEIMOS_EVENT2, [test "$have_deimos_event2" = "yes"])
  449. AM_CONDITIONAL(WITH_D_EVENT_TESTS, [test "$with_d_event_tests" = "yes"])
  450. AC_SUBST(DMD_LIBEVENT_FLAGS)
  451. AM_CONDITIONAL(HAVE_DEIMOS_OPENSSL, [test "$have_deimos_openssl" = "yes"])
  452. AM_CONDITIONAL(WITH_D_SSL_TESTS, [test "$with_d_ssl_tests" = "yes"])
  453. AC_SUBST(DMD_OPENSSL_FLAGS)
  454. AC_ARG_ENABLE([tests],
  455. AS_HELP_STRING([--enable-tests], [build tests [default=yes]]),
  456. [], enable_tests=yes
  457. )
  458. have_tests=yes
  459. if test "$enable_tests" = "no"; then
  460. have_tests="no"
  461. fi
  462. AM_CONDITIONAL(WITH_TESTS, [test "$have_tests" = "yes"])
  463. AC_ARG_ENABLE([plugin],
  464. AS_HELP_STRING([--enable-plugin], [build compiler plugin support [default=yes]]),
  465. [], enable_plugin=yes
  466. )
  467. have_plugin=yes
  468. if test "$have_cpp" = "no" ; then
  469. have_plugin="no"
  470. fi
  471. if test "$enable_plugin" = "no"; then
  472. have_plugin="no"
  473. fi
  474. if test "$have_plugin" = "yes" ; then
  475. AC_CONFIG_LINKS([compiler/cpp/test/plugin/t_cpp_generator.cc:compiler/cpp/src/thrift/generate/t_cpp_generator.cc])
  476. fi
  477. AM_CONDITIONAL(WITH_PLUGIN, [test "$have_plugin" = "yes"])
  478. AC_ARG_ENABLE([tutorial],
  479. AS_HELP_STRING([--enable-tutorial], [build tutorial [default=yes]]),
  480. [], enable_tutorial=yes
  481. )
  482. have_tutorial=yes
  483. if test "$enable_tutorial" = "no"; then
  484. have_tutorial="no"
  485. fi
  486. AM_CONDITIONAL(WITH_TUTORIAL, [test "$have_tutorial" = "yes"])
  487. AM_CONDITIONAL(MINGW, false)
  488. case "${host_os}" in
  489. *mingw*)
  490. mingw32_support="yes"
  491. AC_CHECK_HEADER(windows.h)
  492. AM_CONDITIONAL(MINGW, true)
  493. ;;
  494. *)
  495. AC_ISC_POSIX
  496. ;;
  497. esac
  498. AC_C_CONST
  499. AC_C_INLINE
  500. AC_C_VOLATILE
  501. AC_HEADER_STDBOOL
  502. AC_HEADER_STDC
  503. AC_HEADER_TIME
  504. AC_HEADER_SYS_WAIT
  505. AC_TYPE_SIGNAL
  506. AC_CHECK_HEADERS([arpa/inet.h])
  507. AC_CHECK_HEADERS([sys/param.h])
  508. AC_CHECK_HEADERS([fcntl.h])
  509. AC_CHECK_HEADERS([inttypes.h])
  510. AC_CHECK_HEADERS([limits.h])
  511. AC_CHECK_HEADERS([netdb.h])
  512. AC_CHECK_HEADERS([netinet/in.h])
  513. AC_CHECK_HEADERS([pthread.h])
  514. AC_CHECK_HEADERS([stddef.h])
  515. AC_CHECK_HEADERS([stdlib.h])
  516. AC_CHECK_HEADERS([sys/socket.h])
  517. AC_CHECK_HEADERS([sys/time.h])
  518. AC_CHECK_HEADERS([sys/un.h])
  519. AC_CHECK_HEADERS([sys/poll.h])
  520. AC_CHECK_HEADERS([sys/resource.h])
  521. AC_CHECK_HEADERS([unistd.h])
  522. AC_CHECK_HEADERS([libintl.h])
  523. AC_CHECK_HEADERS([malloc.h])
  524. AC_CHECK_HEADERS([openssl/ssl.h])
  525. AC_CHECK_HEADERS([openssl/rand.h])
  526. AC_CHECK_HEADERS([openssl/x509v3.h])
  527. AC_CHECK_HEADERS([sched.h])
  528. AC_CHECK_HEADERS([wchar.h])
  529. AC_CHECK_LIB(pthread, pthread_create)
  530. dnl NOTE(dreiss): I haven't been able to find any really solid docs
  531. dnl on what librt is and how it fits into various Unix systems.
  532. dnl My best guess is that it is where glibc stashes its implementation
  533. dnl of the POSIX Real-Time Extensions. This seems necessary on Linux,
  534. dnl and we haven't yet found a system where this is a problem.
  535. AC_CHECK_LIB(rt, clock_gettime)
  536. AC_CHECK_LIB(socket, setsockopt)
  537. AC_TYPE_INT16_T
  538. AC_TYPE_INT32_T
  539. AC_TYPE_INT64_T
  540. AC_TYPE_INT8_T
  541. AC_TYPE_MODE_T
  542. AC_TYPE_OFF_T
  543. AC_TYPE_SIZE_T
  544. AC_TYPE_SSIZE_T
  545. AC_TYPE_UINT16_T
  546. AC_TYPE_UINT32_T
  547. AC_TYPE_UINT64_T
  548. AC_TYPE_UINT8_T
  549. AC_CHECK_TYPES([ptrdiff_t], [], [exit 1])
  550. AC_STRUCT_TM
  551. dnl NOTE(dreiss): AI_ADDRCONFIG is not defined on OpenBSD.
  552. AC_CHECK_DECL([AI_ADDRCONFIG], [],
  553. [AC_DEFINE([AI_ADDRCONFIG], 0,
  554. [Define if the AI_ADDRCONFIG symbol is unavailable])],
  555. [
  556. #include <sys/types.h>
  557. #include <sys/socket.h>
  558. #include <netdb.h>
  559. ])
  560. AC_FUNC_ALLOCA
  561. AC_FUNC_FORK
  562. AC_FUNC_MALLOC
  563. AC_FUNC_MEMCMP
  564. AC_FUNC_REALLOC
  565. AC_FUNC_SELECT_ARGTYPES
  566. AC_FUNC_STAT
  567. AC_FUNC_STRERROR_R
  568. AC_FUNC_STRFTIME
  569. AC_FUNC_VPRINTF
  570. AC_CHECK_FUNCS([strtoul])
  571. AC_CHECK_FUNCS([bzero])
  572. AC_CHECK_FUNCS([ftruncate])
  573. AC_CHECK_FUNCS([gethostbyname])
  574. AC_CHECK_FUNCS([gethostbyname_r])
  575. AC_CHECK_FUNCS([gettimeofday])
  576. AC_CHECK_FUNCS([memmove])
  577. AC_CHECK_FUNCS([memset])
  578. AC_CHECK_FUNCS([mkdir])
  579. AC_CHECK_FUNCS([realpath])
  580. AC_CHECK_FUNCS([select])
  581. AC_CHECK_FUNCS([setlocale])
  582. AC_CHECK_FUNCS([socket])
  583. AC_CHECK_FUNCS([strchr])
  584. AC_CHECK_FUNCS([strdup])
  585. AC_CHECK_FUNCS([strerror])
  586. AC_CHECK_FUNCS([strstr])
  587. AC_CHECK_FUNCS([strtol])
  588. AC_CHECK_FUNCS([sqrt])
  589. dnl The following functions are optional.
  590. AC_CHECK_FUNCS([alarm])
  591. AC_CHECK_FUNCS([clock_gettime])
  592. AC_CHECK_FUNCS([sched_get_priority_min])
  593. AC_CHECK_FUNCS([sched_get_priority_max])
  594. AC_CHECK_FUNCS([inet_ntoa])
  595. AC_CHECK_FUNCS([pow])
  596. if test "$cross_compiling" = "no" ; then
  597. AX_SIGNED_RIGHT_SHIFT
  598. fi
  599. dnl autoscan thinks we need this macro because we have a member function
  600. dnl called "error". Invoke the macro but don't run the check so autoscan
  601. dnl thinks we are in the clear. It's highly unlikely that we will ever
  602. dnl actually use the function that this checks for.
  603. if false ; then
  604. AC_FUNC_ERROR_AT_LINE
  605. fi
  606. # --- Coverage hooks ---
  607. AC_ARG_ENABLE(coverage,
  608. [ --enable-coverage turn on -fprofile-arcs -ftest-coverage],
  609. [case "${enableval}" in
  610. yes) ENABLE_COVERAGE=1 ;;
  611. no) ENABLE_COVERAGE=0 ;;
  612. *) AC_MSG_ERROR(bad value ${enableval} for --enable-cov) ;;
  613. esac],
  614. [ENABLE_COVERAGE=2])
  615. if test "x[$]ENABLE_COVERAGE" = "x1"; then
  616. AC_MSG_WARN(enable coverage)
  617. GCOV_CFLAGS="`echo \"[$]CFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
  618. GCOV_CXXFLAGS="`echo \"[$]CXXFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
  619. GCOV_LDFLAGS="-XCClinker -fprofile-arcs -XCClinker -ftest-coverage"
  620. fi
  621. AC_SUBST(ENABLE_COVERAGE)
  622. AC_SUBST(GCOV_CFLAGS)
  623. AC_SUBST(GCOV_CXXFLAGS)
  624. AC_SUBST(GCOV_LDFLAGS)
  625. AC_ARG_ENABLE(boostthreads,
  626. [ --enable-boostthreads use boost threads, instead of POSIX pthread (experimental) ],
  627. [case "${enableval}" in
  628. yes) ENABLE_BOOSTTHREADS=1 ;;
  629. no) ENABLE_BOOSTTHREADS=0 ;;
  630. *) AC_MSG_ERROR(bad value ${enableval} for --enable-cov) ;;
  631. esac],
  632. [ENABLE_BOOSTTHREADS=2])
  633. if test "x[$]ENABLE_BOOSTTHREADS" = "x1"; then
  634. AC_MSG_WARN(enable boostthreads)
  635. AC_DEFINE([USE_BOOST_THREAD], [1], [experimental --enable-boostthreads that replaces POSIX pthread by boost::thread])
  636. LIBS="-lboost_thread $LIBS"
  637. fi
  638. AM_CONDITIONAL([WITH_BOOSTTHREADS], [test "x[$]ENABLE_BOOSTTHREADS" = "x1"])
  639. AC_CONFIG_HEADERS(config.h:config.hin)
  640. AC_CONFIG_HEADERS(lib/cpp/src/thrift/config.h:config.hin)
  641. AC_CONFIG_HEADERS(lib/c_glib/src/thrift/config.h:config.hin)
  642. # gruard against pre defined config.h
  643. AH_TOP([
  644. #ifndef CONFIG_H
  645. #define CONFIG_H
  646. ])
  647. AH_BOTTOM([
  648. #endif
  649. ])
  650. AC_CONFIG_FILES([
  651. Makefile
  652. compiler/cpp/Makefile
  653. compiler/cpp/src/Makefile
  654. compiler/cpp/src/thrift/plugin/Makefile
  655. compiler/cpp/test/Makefile
  656. compiler/cpp/src/thrift/version.h
  657. lib/Makefile
  658. lib/cpp/Makefile
  659. lib/cpp/test/Makefile
  660. lib/cpp/thrift-nb.pc
  661. lib/cpp/thrift-z.pc
  662. lib/cpp/thrift-qt.pc
  663. lib/cpp/thrift-qt5.pc
  664. lib/cpp/thrift.pc
  665. lib/c_glib/Makefile
  666. lib/c_glib/thrift_c_glib.pc
  667. lib/c_glib/test/Makefile
  668. lib/csharp/Makefile
  669. lib/csharp/test/Multiplex/Makefile
  670. lib/d/Makefile
  671. lib/d/test/Makefile
  672. lib/erl/Makefile
  673. lib/go/Makefile
  674. lib/go/test/Makefile
  675. lib/haxe/test/Makefile
  676. lib/hs/Makefile
  677. lib/java/Makefile
  678. lib/js/Makefile
  679. lib/js/test/Makefile
  680. lib/json/Makefile
  681. lib/json/test/Makefile
  682. lib/nodejs/Makefile
  683. lib/perl/Makefile
  684. lib/perl/test/Makefile
  685. lib/php/Makefile
  686. lib/php/test/Makefile
  687. lib/dart/Makefile
  688. lib/py/Makefile
  689. lib/rb/Makefile
  690. lib/lua/Makefile
  691. lib/xml/Makefile
  692. lib/xml/test/Makefile
  693. test/Makefile
  694. test/features/Makefile
  695. test/c_glib/Makefile
  696. test/cpp/Makefile
  697. test/csharp/Makefile
  698. test/erl/Makefile
  699. test/go/Makefile
  700. test/haxe/Makefile
  701. test/hs/Makefile
  702. test/lua/Makefile
  703. test/php/Makefile
  704. test/dart/Makefile
  705. test/perl/Makefile
  706. test/py/Makefile
  707. test/py.twisted/Makefile
  708. test/py.tornado/Makefile
  709. test/rb/Makefile
  710. tutorial/Makefile
  711. tutorial/c_glib/Makefile
  712. tutorial/cpp/Makefile
  713. tutorial/d/Makefile
  714. tutorial/go/Makefile
  715. tutorial/haxe/Makefile
  716. tutorial/hs/Makefile
  717. tutorial/java/Makefile
  718. tutorial/js/Makefile
  719. tutorial/nodejs/Makefile
  720. tutorial/dart/Makefile
  721. tutorial/py/Makefile
  722. tutorial/py.twisted/Makefile
  723. tutorial/py.tornado/Makefile
  724. tutorial/rb/Makefile
  725. ])
  726. if test "$have_cpp" = "yes" ; then MAYBE_CPP="cpp" ; else MAYBE_CPP="" ; fi
  727. AC_SUBST([MAYBE_CPP])
  728. if test "$have_c_glib" = "yes" ; then MAYBE_C_GLIB="c_glib" ; else MAYBE_C_GLIB="" ; fi
  729. AC_SUBST([MAYBE_C_GLIB])
  730. if test "$have_d" = "yes" -a "$have_deimos_event2" = "yes" -a "$have_deimos_openssl" = "yes"; then MAYBE_D="d" ; else MAYBE_D="" ; fi
  731. AC_SUBST([MAYBE_D])
  732. if test "$have_java" = "yes" ; then MAYBE_JAVA="java" ; else MAYBE_JAVA="" ; fi
  733. AC_SUBST([MAYBE_JAVA])
  734. if test "$have_csharp" = "yes" ; then MAYBE_CSHARP="csharp" ; else MAYBE_CSHARP="" ; fi
  735. AC_SUBST([MAYBE_CSHARP])
  736. if test "$have_python" = "yes" ; then MAYBE_PYTHON="py" ; else MAYBE_PYTHON="" ; fi
  737. AC_SUBST([MAYBE_PYTHON])
  738. if test "$have_py3" = "yes" ; then MAYBE_PY3="py3" ; else MAYBE_PY3="" ; fi
  739. AC_SUBST([MAYBE_PY3])
  740. if test "$have_ruby" = "yes" ; then MAYBE_RUBY="rb" ; else MAYBE_RUBY="" ; fi
  741. AC_SUBST([MAYBE_RUBY])
  742. if test "$have_haskell" = "yes" ; then MAYBE_HASKELL="hs" ; else MAYBE_HASKELL="" ; fi
  743. AC_SUBST([MAYBE_HASKELL])
  744. if test "$have_perl" = "yes" ; then MAYBE_PERL="perl" ; else MAYBE_PERL="" ; fi
  745. AC_SUBST([MAYBE_PERL])
  746. if test "$have_php" = "yes" ; then MAYBE_PHP="php" ; else MAYBE_PHP="" ; fi
  747. AC_SUBST([MAYBE_PHP])
  748. if test "$have_dart" = "yes" ; then MAYBE_DART="dart" ; else MAYBE_DART="" ; fi
  749. AC_SUBST([MAYBE_DART])
  750. if test "$have_go" = "yes" ; then MAYBE_GO="go" ; else MAYBE_GO="" ; fi
  751. AC_SUBST([MAYBE_GO])
  752. if test "$have_nodejs" = "yes" ; then MAYBE_NODEJS="nodejs" ; else MAYBE_NODEJS="" ; fi
  753. AC_SUBST([MAYBE_NODEJS])
  754. if test "$have_erlang" = "yes" ; then MAYBE_ERLANG="erl" ; else MAYBE_ERLANG="" ; fi
  755. AC_SUBST([MAYBE_ERLANG])
  756. if test "$have_lua" = "yes" ; then MAYBE_LUA="lua" ; else MAYBE_LUA="" ; fi
  757. AC_SUBST([MAYBE_LUA])
  758. AC_OUTPUT
  759. echo
  760. echo "$PACKAGE $VERSION"
  761. echo
  762. echo "Building Plugin Support ...... : $have_plugin"
  763. echo "Building C++ Library ......... : $have_cpp"
  764. echo "Building C (GLib) Library .... : $have_c_glib"
  765. echo "Building Java Library ........ : $have_java"
  766. echo "Building C# Library .......... : $have_csharp"
  767. echo "Building Python Library ...... : $have_python"
  768. echo "Building Ruby Library ........ : $have_ruby"
  769. echo "Building Haxe Library ........ : $have_haxe"
  770. echo "Building Haskell Library ..... : $have_haskell"
  771. echo "Building Perl Library ........ : $have_perl"
  772. echo "Building PHP Library ......... : $have_php"
  773. echo "Building Dart Library ........ : $have_dart"
  774. echo "Building Erlang Library ...... : $have_erlang"
  775. echo "Building Go Library .......... : $have_go"
  776. echo "Building D Library ........... : $have_d"
  777. echo "Building NodeJS Library ...... : $have_nodejs"
  778. echo "Building Lua Library ......... : $have_lua"
  779. if test "$have_cpp" = "yes" ; then
  780. echo
  781. echo "C++ Library:"
  782. echo " Build TZlibTransport ...... : $have_zlib"
  783. echo " Build TNonblockingServer .. : $have_libevent"
  784. echo " Build TQTcpServer (Qt4) .... : $have_qt"
  785. echo " Build TQTcpServer (Qt5) .... : $have_qt5"
  786. fi
  787. if test "$have_java" = "yes" ; then
  788. echo
  789. echo "Java Library:"
  790. echo " Using javac ............... : $JAVAC"
  791. echo " Using java ................ : $JAVA"
  792. echo " Using ant ................. : $ANT"
  793. fi
  794. if test "$have_csharp" = "yes" ; then
  795. echo
  796. echo "C# Library:"
  797. echo " Using .NET 3.5 ............ : $net_3_5"
  798. fi
  799. if test "$have_python" = "yes" ; then
  800. echo
  801. echo "Python Library:"
  802. echo " Using Python .............. : $PYTHON"
  803. if test "$have_py3" = "yes" ; then
  804. echo " Using Python3 ............. : $PYTHON3"
  805. fi
  806. if test "$have_trial" = "yes"; then
  807. echo " Using trial ............... : $TRIAL"
  808. fi
  809. fi
  810. if test "$have_php" = "yes" ; then
  811. echo
  812. echo "PHP Library:"
  813. echo " Using php-config .......... : $PHP_CONFIG"
  814. fi
  815. if test "$have_dart" = "yes" ; then
  816. echo
  817. echo "Dart Library:"
  818. echo " Using Dart ................ : $DART"
  819. echo " Using Pub ................. : $DARTPUB"
  820. fi
  821. if test "$have_ruby" = "yes" ; then
  822. echo
  823. echo "Ruby Library:"
  824. echo " Using Ruby ................ : $RUBY"
  825. fi
  826. if test "$have_haskell" = "yes" ; then
  827. echo
  828. echo "Haskell Library:"
  829. echo " Using Haskell ............. : $RUNHASKELL"
  830. echo " Using Cabal ............... : $CABAL"
  831. fi
  832. if test "$have_haxe" = "yes" ; then
  833. echo
  834. echo "Haxe Library:"
  835. echo " Using Haxe ................ : $HAXE"
  836. echo " Using Haxe version ........ : $HAXE_VERSION"
  837. fi
  838. if test "$have_perl" = "yes" ; then
  839. echo
  840. echo "Perl Library:"
  841. echo " Using Perl ................ : $PERL"
  842. fi
  843. if test "$have_erlang" = "yes" ; then
  844. echo
  845. echo "Erlang Library:"
  846. echo " Using erlc ................ : $ERLC"
  847. echo " Using rebar ............... : $REBAR"
  848. fi
  849. if test "$have_go" = "yes" ; then
  850. echo
  851. echo "Go Library:"
  852. echo " Using Go................... : $GO"
  853. echo " Using Go version........... : $($GO version)"
  854. fi
  855. if test "$have_d" = "yes" ; then
  856. echo
  857. echo "D Library:"
  858. echo " Using D Compiler .......... : $DMD"
  859. echo " Building D libevent tests . : $with_d_event_tests"
  860. echo " Building D SSL tests ...... : $with_d_ssl_tests"
  861. fi
  862. if test "$have_nodejs" = "yes" ; then
  863. echo
  864. echo "NodeJS Library:"
  865. echo " Using NodeJS .............. : $NODEJS"
  866. echo " Using NodeJS version....... : $($NODEJS --version)"
  867. fi
  868. if test "$have_lua" = "yes" ; then
  869. echo
  870. echo "Lua Library:"
  871. echo " Using Lua .............. : $LUA"
  872. fi
  873. echo
  874. echo "If something is missing that you think should be present,"
  875. echo "please skim the output of configure to find the missing"
  876. echo "component. Details are present in config.log."