blob: bb09c7ce0b751c74b3f1af16b61cb8bfd226c73f [file] [log] [blame]
David Reissfeab7732009-03-30 22:52:44 +00001#
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
T Jake Luciani03ec1e42011-01-27 02:53:57 +000020AC_PREREQ(2.65)
Marc Slemkob09f5882006-08-23 22:03:34 +000021
Jake Farrell6fcecd42012-10-11 20:34:25 +000022AC_INIT([thrift], [1.0.0-dev])
Marc Slemkob09f5882006-08-23 22:03:34 +000023
24AC_CONFIG_AUX_DIR([.])
25
jfarrell92f24b22013-08-17 15:47:13 -040026AM_INIT_AUTOMAKE([1.11 tar-ustar])
Bryan Duxburyb005c1f2011-02-09 17:05:11 +000027PKG_PROG_PKG_CONFIG
Marc Slemkob09f5882006-08-23 22:03:34 +000028
David Reissd6832192007-09-05 00:47:32 +000029AC_ARG_VAR([PY_PREFIX], [Prefix for installing Python modules.
30 (Normal --prefix is ignored for Python because
31 Python has different conventions.)
32 Default = "/usr"])
David Reisscdd6f3c2008-03-04 21:10:29 +000033AS_IF([test "x$PY_PREFIX" = x], [PY_PREFIX="/usr"])
David Reissd6832192007-09-05 00:47:32 +000034
David Reissf0c21a72008-07-11 01:26:16 +000035AC_ARG_VAR([JAVA_PREFIX], [Prefix for installing the Java lib jar.
36 (Normal --prefix is ignored for Java because
Christian Lavoieafc6d8f2011-02-20 02:39:19 +000037 Java has different conventions.)
David Reissf0c21a72008-07-11 01:26:16 +000038 Default = "/usr/local/lib"])
39AS_IF([test "x$JAVA_PREFIX" = x], [JAVA_PREFIX="/usr/local/lib"])
David Reiss832b2622007-12-28 18:25:33 +000040
Bryan Duxbury3f0b5262010-05-12 21:31:58 +000041AC_ARG_VAR([RUBY_PREFIX], [Prefix for installing Ruby modules.
42 (Normal --prefix is ignored for Ruby because
43 Ruby has different conventions.)
44 Default = none, let ruby setup decide])
45
Bryan Duxbury6a681872010-05-02 22:39:31 +000046AC_ARG_VAR([PHP_PREFIX], [Prefix for installing PHP modules.
47 (Normal --prefix is ignored for PHP because
48 PHP has different conventions.)
49 Default = "/usr/lib/php"])
50AS_IF([test "x$PHP_PREFIX" = x], [PHP_PREFIX="/usr/lib/php"])
51
Bryan Duxbury89200e12010-08-25 17:09:02 +000052AC_ARG_VAR([PHP_CONFIG_PREFIX],
53 [Prefix for installing PHP extension module .ini file.
54 (Normal --prefix is ignored for PHP because PHP has
55 different conventions.)
56 Default = "/etc/php.d"])
57AS_IF([test "x$PHP_CONFIG_PREFIX" = x], [PHP_CONFIG_PREFIX="/etc/php.d"])
58
Jake Farrell05e0cdb2011-05-05 13:45:26 +000059AC_ARG_VAR([INSTALLDIRS], [When installing Perl modules, specifies which
60 of the sets of installation directories
61 to choose: perl, site or vendor.
62 Default = "vendor"])
63AS_IF([test "x$INSTALLDIRS" = x], [INSTALLDIRS="vendor"])
64
David Reissc07057e2010-06-11 17:57:32 +000065AC_ARG_VAR([PERL_PREFIX], [Prefix for installing Perl modules.
66 (Normal --prefix is ignored for Perl because
67 Perl has different conventions.)
Jake Farrell05e0cdb2011-05-05 13:45:26 +000068 Ignored, when INSTALLDIRS set to site or vendor.
David Reissc07057e2010-06-11 17:57:32 +000069 Default = "/usr/local/lib"])
70AS_IF([test "x$PERL_PREFIX" = x], [PERL_PREFIX="/usr/local"])
71
Anthony F. Molinaroa5df7c72010-09-27 17:22:17 +000072AC_ARG_VAR([CABAL_CONFIGURE_FLAGS],
73 [Extra flags to pass to cabal: "cabal Setup.lhs configure $CABAL_CONFIGURE_FLAGS".
74 (Typically used to set --user or force --global.)])
75
76AC_SUBST(CABAL_CONFIGURE_FLAGS)
77
Jake Farrellb95b0ff2012-03-22 21:49:10 +000078AC_ARG_VAR([D_IMPORT_PREFIX], [Prefix for installing D modules.
79 [INCLUDEDIR/d2]])
80AS_IF([test "x$D_IMPORT_PREFIX" = x], [D_IMPORT_PREFIX="${includedir}/d2"])
81
82AC_ARG_VAR([DMD_LIBEVENT_FLAGS], [DMD flags for linking libevent (auto-detected if not set).])
83AC_ARG_VAR([DMD_OPENSSL_FLAGS], [DMD flags for linking OpenSSL (auto-detected if not set).])
84
David Reiss832b2622007-12-28 18:25:33 +000085AC_PROG_CC
86AC_PROG_CPP
87AC_PROG_CXX
88AC_PROG_INSTALL
89AC_PROG_LIBTOOL
90AC_PROG_MAKE_SET
91AC_PROG_YACC
92AC_PROG_LEX
93AM_PROG_LEX
David Reiss7ed4b982008-02-11 23:24:47 +000094AC_PROG_LN_S
95AC_PROG_MKDIR_P
Christian Lavoieafc6d8f2011-02-20 02:39:19 +000096AC_PROG_AWK
97AC_PROG_RANLIB
David Reiss832b2622007-12-28 18:25:33 +000098
99AC_LANG([C++])
jfarrell84cd2842014-01-14 21:51:59 -0500100AX_CXX_COMPILE_STDCXX_11([noext])
David Reiss832b2622007-12-28 18:25:33 +0000101
David Reissea4c9812010-08-31 16:51:21 +0000102AX_THRIFT_LIB(cpp, [C++], yes)
103have_cpp=no
104if test "$with_cpp" = "yes"; then
Roger Meier6bb0a7a2012-05-11 10:44:32 +0000105 AX_BOOST_BASE([1.40.0])
Jake Farrell3ad80812011-06-09 19:14:22 +0000106 if test "x$succeeded" = "xyes" ; then
David Reissef5e81b2010-08-31 16:51:28 +0000107 have_cpp="yes"
108 fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000109
David Reissea4c9812010-08-31 16:51:21 +0000110 AX_LIB_EVENT([1.0])
111 have_libevent=$success
David Reiss832b2622007-12-28 18:25:33 +0000112
David Reissea4c9812010-08-31 16:51:21 +0000113 AX_LIB_ZLIB([1.2.3])
114 have_zlib=$success
Chris Piro20c81ad2013-03-07 11:32:48 -0500115
Jake Farrelld6d3e372012-07-27 16:01:33 +0000116 AX_THRIFT_LIB(qt4, [Qt], yes)
117 have_qt=no
118 if test "$with_qt4" = "yes"; then
119 PKG_CHECK_MODULES([QT], [QtCore >= 4.3, QtNetwork >= 4.3], have_qt=yes, have_qt=no)
120 fi
Roger Meier86e89862012-02-10 19:53:20 +0000121 if test "$have_qt" = "yes"; then
122 AC_PATH_PROGS([QT_MOC], [moc-qt4 moc])
123 have_qt=$success
124 fi
David Reissea4c9812010-08-31 16:51:21 +0000125fi
126AM_CONDITIONAL([WITH_CPP], [test "$have_cpp" = "yes"])
127AM_CONDITIONAL([AMX_HAVE_LIBEVENT], [test "$have_libevent" = "yes"])
128AM_CONDITIONAL([AMX_HAVE_ZLIB], [test "$have_zlib" = "yes"])
Roger Meier86e89862012-02-10 19:53:20 +0000129AM_CONDITIONAL([AMX_HAVE_QT], [test "$have_qt" = "yes"])
David Reiss832b2622007-12-28 18:25:33 +0000130
Roger Meier32177232012-05-01 11:19:53 +0000131AX_THRIFT_LIB(c_glib, [C (GLib)], yes)
Roger Meier213a6642010-10-27 12:30:11 +0000132if test "$with_c_glib" = "yes"; then
133 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.0], have_glib2=yes, have_glib2=no)
134 PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.0], have_gobject2=yes, have_gobject2=no)
135 if test "$have_glib2" = "yes" -a "$have_gobject2" = "yes" ; then
136 have_c_glib="yes"
137 fi
138fi
139AM_CONDITIONAL(WITH_C_GLIB, [test "$have_glib2" = "yes" -a "$have_gobject2" = "yes"])
140
David Reiss520b5ee2008-03-02 07:00:26 +0000141AX_THRIFT_LIB(csharp, [C#], yes)
142if test "$with_csharp" = "yes"; then
David Reissd831a212009-02-13 03:09:52 +0000143 PKG_CHECK_MODULES(MONO, mono >= 2.0.0, net_3_5=yes, net_3_5=no)
144 PKG_CHECK_MODULES(MONO, mono >= 1.2.4, have_mono=yes, have_mono=no)
David Reiss5cc3ba82010-08-31 16:51:20 +0000145 if test "$have_mono" = "yes" ; then
146 have_csharp="yes"
147 fi
David Reiss520b5ee2008-03-02 07:00:26 +0000148fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000149AM_CONDITIONAL(WITH_MONO, [test "$have_csharp" = "yes"])
David Reissd831a212009-02-13 03:09:52 +0000150AM_CONDITIONAL(NET_2_0, [test "$net_3_5" = "no"])
David Reiss1fdb5922008-02-06 22:10:12 +0000151
David Reiss62d39812008-03-02 07:00:22 +0000152AX_THRIFT_LIB(java, [Java], yes)
153if test "$with_java" = "yes"; then
David Reissd9cdf422009-03-13 21:25:29 +0000154 AX_JAVAC_AND_JAVA
Bryan Duxbury38bab122010-08-12 00:27:14 +0000155 AC_PATH_PROG([ANT], [ant])
Jake Farrell210d7662011-05-25 21:07:29 +0000156 AX_CHECK_ANT_VERSION($ANT, 1.7)
David Reissfff84d12009-05-22 19:50:33 +0000157 AC_SUBST(CLASSPATH)
David Reiss4ca0c8e2009-05-12 23:16:55 +0000158 AC_SUBST(ANT_FLAGS)
David Reiss5cc3ba82010-08-31 16:51:20 +0000159 if test "x$JAVAC" != "x" && test "x$JAVAC" != "x" && test "x$ANT" != "x" ; then
160 have_java="yes"
161 fi
David Reiss62d39812008-03-02 07:00:22 +0000162fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000163AM_CONDITIONAL([WITH_JAVA], [test "$have_java" = "yes"])
David Reiss1fdb5922008-02-06 22:10:12 +0000164
Christopher Pirob6f18c22008-03-04 07:09:12 +0000165AX_THRIFT_LIB(erlang, [Erlang], yes)
166if test "$with_erlang" = "yes"; then
David Reiss9e2fd792010-05-18 16:52:48 +0000167 AC_ERLANG_PATH_ERL
168 AC_ERLANG_PATH_ERLC
David Reiss31e1b6e2010-08-24 20:45:24 +0000169 if test -n "$ERLC" ; then
170 AC_ERLANG_SUBST_LIB_DIR
171 # Install into the detected Erlang directory instead of $libdir/erlang/lib
172 ERLANG_INSTALL_LIB_DIR="$ERLANG_LIB_DIR"
173 AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
174 fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000175 if test -n "$ERL" -a -n "$ERLC" ; then
176 have_erlang="yes"
177 fi
Christopher Pirob6f18c22008-03-04 07:09:12 +0000178fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000179AM_CONDITIONAL(WITH_ERLANG, [test "$have_erlang" = "yes"])
Christopher Pirob6f18c22008-03-04 07:09:12 +0000180
Roger Meier8909cbd2014-01-26 11:44:27 +0100181AX_THRIFT_LIB(nodejs, [Nodejs], yes)
182have_nodejs=no
183if test "$with_nodejs" = "yes"; then
184 AC_PATH_PROGS([NODEJS], [nodejs node])
185 AC_PATH_PROG([NPM], [npm])
186 if test "x$NODEJS" != "x" -a "x$NPM" != "x"; then
187 have_nodejs="yes"
188 fi
189fi
190AM_CONDITIONAL(WITH_NODEJS, [test "$have_nodejs" = "yes"])
191AM_CONDITIONAL(HAVE_NPM, [test "x$NPM" != "x"])
192
David Reiss5cc3ba82010-08-31 16:51:20 +0000193AX_THRIFT_LIB(python, [Python], yes)
194if test "$with_python" = "yes"; then
David Reiss1a140912008-06-11 01:16:37 +0000195 AM_PATH_PYTHON(2.4,, :)
David Reiss5cc3ba82010-08-31 16:51:20 +0000196 if test "x$PYTHON" != "x" && test "x$PYTHON" != "x:" ; then
197 have_python="yes"
198 fi
David Reiss1a140912008-06-11 01:16:37 +0000199fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000200AM_CONDITIONAL(WITH_PYTHON, [test "$have_python" = "yes"])
David Reiss1a140912008-06-11 01:16:37 +0000201
Roger Meier50e43492010-10-08 17:46:06 +0000202AC_PATH_PROG([TRIAL], [trial])
203
T Jake Luciani1952e542009-02-01 04:47:30 +0000204AX_THRIFT_LIB(perl, [Perl], yes)
205if test "$with_perl" = "yes"; then
206 AC_PATH_PROG([PERL], [perl])
David Reissdcc7e9b2010-08-31 16:51:22 +0000207 if test -n "$PERL" ; then
208 AC_PROG_PERL_MODULES([Bit::Vector], success="yes", success="no")
209 have_perl_bit_vector="$success"
Roger Meieraae8acb2014-01-15 13:55:09 +0100210 AC_PROG_PERL_MODULES([Class::Accessor], success="yes", success="no")
211 have_perl_class_accessor="$success"
Bryan Duxbury12373692010-08-19 05:23:59 +0000212 fi
David Reissdcc7e9b2010-08-31 16:51:22 +0000213 if test -n "$PERL" -a "$have_perl_bit_vector" = "yes" ; then
Roger Meieraae8acb2014-01-15 13:55:09 +0100214 if test -n "$PERL" -a "$have_perl_class_accessor" = "yes" ; then
215 have_perl="yes"
216 fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000217 fi
T Jake Luciani1952e542009-02-01 04:47:30 +0000218fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000219AM_CONDITIONAL(WITH_PERL, [test "$have_perl" = "yes"])
T Jake Luciani1952e542009-02-01 04:47:30 +0000220
Bryan Duxbury6a681872010-05-02 22:39:31 +0000221AX_THRIFT_LIB(php, [PHP], yes)
222if test "$with_php" = "yes"; then
223 AC_PATH_PROG([PHP], [php])
David Reiss5cc3ba82010-08-31 16:51:20 +0000224 if test -n "$PHP" ; then
225 have_php="yes"
226 fi
Bryan Duxbury6a681872010-05-02 22:39:31 +0000227fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000228AM_CONDITIONAL(WITH_PHP, [test "$have_php" = "yes"])
Bryan Duxbury6a681872010-05-02 22:39:31 +0000229
Bryan Duxbury89200e12010-08-25 17:09:02 +0000230AX_THRIFT_LIB(php_extension, [PHP_EXTENSION], yes)
231if test "$with_php_extension" = "yes"; then
232 AC_PATH_PROG([PHP_CONFIG], [php-config])
Anthony F. Molinaroddcf32a2010-10-05 16:45:50 +0000233 if test -n "$PHP_CONFIG" ; then
234 AC_CONFIG_SUBDIRS([lib/php/src/ext/thrift_protocol])
235 have_php_extension="yes"
236 fi
Bryan Duxbury89200e12010-08-25 17:09:02 +0000237fi
Anthony F. Molinaroddcf32a2010-10-05 16:45:50 +0000238AM_CONDITIONAL(WITH_PHP_EXTENSION, [test "$have_php_extension" = "yes"])
Bryan Duxbury89200e12010-08-25 17:09:02 +0000239
Roger Meier33b720a2012-01-24 18:42:46 +0000240AC_PATH_PROG([PHPUNIT], [phpunit])
241AM_CONDITIONAL(HAVE_PHPUNIT, [test "x$PHPUNIT" != "x"])
242
Kevin Clark4bd89162008-07-08 00:47:49 +0000243AX_THRIFT_LIB(ruby, [Ruby], yes)
David Reiss5cc3ba82010-08-31 16:51:20 +0000244have_ruby=no
Kevin Clark4bd89162008-07-08 00:47:49 +0000245if test "$with_ruby" = "yes"; then
246 AC_PATH_PROG([RUBY], [ruby])
Jake Farrell9c39f772011-08-30 19:12:10 +0000247 AC_PATH_PROG([BUNDLER], [bundle])
jfarrell507740c2014-01-22 22:20:21 -0500248 if test "x$RUBY" != "x" -a "x$BUNDLER" != "x"; then
David Reiss5cc3ba82010-08-31 16:51:20 +0000249 have_ruby="yes"
250 fi
Kevin Clark4bd89162008-07-08 00:47:49 +0000251fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000252AM_CONDITIONAL(WITH_RUBY, [test "$have_ruby" = "yes"])
Jake Farrell9c39f772011-08-30 19:12:10 +0000253AM_CONDITIONAL(HAVE_BUNDLER, [test "x$BUNDLER" != "x"])
Bryan Duxburyec473582009-04-07 16:31:04 +0000254
Anthony F. Molinaroa5df7c72010-09-27 17:22:17 +0000255AX_THRIFT_LIB(haskell, [Haskell], yes)
256have_haskell=no
257RUNHASKELL=true
Bryan Duxburyc6574472010-10-06 00:12:33 +0000258CABAL=true
Anthony F. Molinaroa5df7c72010-09-27 17:22:17 +0000259if test "$with_haskell" = "yes"; then
Bryan Duxburyc6574472010-10-06 00:12:33 +0000260 AC_PATH_PROG([CABAL], [cabal])
Anthony F. Molinaroa5df7c72010-09-27 17:22:17 +0000261 AC_PATH_PROG([RUNHASKELL], [runhaskell])
Bryan Duxburyc6574472010-10-06 00:12:33 +0000262 if test "x$CABAL" != "x" -a "x$RUNHASKELL" != "x"; then
Anthony F. Molinaroa5df7c72010-09-27 17:22:17 +0000263 have_haskell="yes"
264 else
265 RUNHASKELL=true
Bryan Duxburyc6574472010-10-06 00:12:33 +0000266 CABAL=true
Anthony F. Molinaroa5df7c72010-09-27 17:22:17 +0000267 fi
268fi
Bryan Duxburyc6574472010-10-06 00:12:33 +0000269AC_SUBST(CABAL)
Anthony F. Molinaroa5df7c72010-09-27 17:22:17 +0000270AC_SUBST(RUNHASKELL)
271AM_CONDITIONAL(WITH_HASKELL, [test "$have_haskell" = "yes"])
Kevin Clark4bd89162008-07-08 00:47:49 +0000272
Christian Lavoieafc6d8f2011-02-20 02:39:19 +0000273AX_THRIFT_LIB(go, [Go], yes)
274if test "$with_go" = "yes"; then
Jens Geyer0e87c462013-06-18 22:25:07 +0200275 AC_PATH_PROG([GO], [go])
276 if [[ -x "$GO" ]] ; then
Christian Lavoieafc6d8f2011-02-20 02:39:19 +0000277 have_go="yes"
278 fi
279fi
280AM_CONDITIONAL(WITH_GO, [test "$have_go" = "yes"])
281
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000282
283AX_THRIFT_LIB(d, [D], yes)
284if test "$with_d" = "yes"; then
285 AX_DMD
286 AC_SUBST(DMD)
287 if test "x$DMD" != "x"; then
288 have_d="yes"
289 fi
290fi
291
292# Determine actual name of the generated D library for use in the command line
293# when compiling tests. This is needed because the -l<lib> syntax doesn't work
294# with OPTLINK (Windows).
295lib_prefix=lib
296lib_suffix=a
297case "$host_os" in
298 cygwin* | mingw* | pw32* | cegcc*)
299 lib_prefix=""
300 lib_suffix=lib
301 ;;
302esac
303D_LIB_NAME="${lib_prefix}thriftd.${lib_suffix}"
304AC_SUBST(D_LIB_NAME)
305D_EVENT_LIB_NAME="${lib_prefix}thriftd-event.${lib_suffix}"
306AC_SUBST(D_EVENT_LIB_NAME)
307D_SSL_LIB_NAME="${lib_prefix}thriftd-ssl.${lib_suffix}"
308AC_SUBST(D_SSL_LIB_NAME)
309
310if test "$have_d" = "yes"; then
311 AX_CHECK_D_MODULE(deimos.event2.event)
312 have_deimos_event2=$success
313
314 with_d_event_tests="no"
315 if test "$have_deimos_event2" = "yes"; then
316 if test "x$DMD_LIBEVENT_FLAGS" = "x"; then
317 if test "$dmd_optlink" = "yes"; then
318 AC_MSG_WARN([D libevent interface found, but cannot auto-detect \
319linker flags for OPTLINK. Please set DMD_LIBEVENT_FLAGS manually.])
320 else
321 AX_LIB_EVENT([2.0])
322 if test "$success" = "yes"; then
323 DMD_LIBEVENT_FLAGS=$(echo "$LIBEVENT_LDFLAGS $LIBEVENT_LIBS" | \
324 sed -e 's/^ *//g;s/ *$//g;s/^\(.\)/-L\1/g;s/ */ -L/g')
325 with_d_event_tests="yes"
326 else
327 AC_MSG_WARN([D libevent interface present, but libevent library not found.])
328 fi
329 fi
330 else
331 with_d_event_tests="yes"
332 fi
333 fi
334
335 AX_CHECK_D_MODULE(deimos.openssl.ssl)
336 have_deimos_openssl=$success
337
338 with_d_ssl_tests="no"
339 if test "$have_deimos_openssl" = "yes"; then
340 if test "x$DMD_OPENSSL_FLAGS" = "x"; then
341 if test "$dmd_optlink" = "yes"; then
342 AC_MSG_WARN([D OpenSSL interface found, but cannot auto-detect \
343linker flags for OPTLINK. Please set DMD_OPENSSL_FLAGS manually.])
344 else
345 AX_CHECK_OPENSSL([with_d_ssl_tests="yes"])
346 if test "$with_d_ssl_tests" = "yes"; then
347 DMD_OPENSSL_FLAGS=$(echo "$OPENSSL_LDFLAGS $OPENSSL_LIBS" | \
348 sed -e 's/^ *//g;s/ *$//g;s/^\(.\)/-L\1/g;s/ */ -L/g')
349 else
350 AC_MSG_WARN([D OpenSSL interface present, but OpenSSL library not found.])
351 fi
352 fi
353 else
354 with_d_ssl_tests="yes"
355 fi
356 fi
357fi
358
359AM_CONDITIONAL(WITH_D, [test "$have_d" = "yes"])
360AM_CONDITIONAL(DMD_OPTLINK, [test "$dmd_optlink" = "yes"])
361AC_SUBST(DMD_OF_DIRSEP, "$dmd_of_dirsep")
362AM_CONDITIONAL(HAVE_DEIMOS_EVENT2, [test "$have_deimos_event2" = "yes"])
363AM_CONDITIONAL(WITH_D_EVENT_TESTS, [test "$with_d_event_tests" = "yes"])
364AC_SUBST(DMD_LIBEVENT_FLAGS)
365AM_CONDITIONAL(HAVE_DEIMOS_OPENSSL, [test "$have_deimos_openssl" = "yes"])
366AM_CONDITIONAL(WITH_D_SSL_TESTS, [test "$with_d_ssl_tests" = "yes"])
367AC_SUBST(DMD_OPENSSL_FLAGS)
368
Roger Meierc88d5812014-01-26 11:51:26 +0100369AC_ARG_ENABLE([tests],
370 AS_HELP_STRING([--enable-tests], [build tests [default=yes]]),
371 [], enable_tests=yes
372)
Jake Farrell627f1a02011-09-14 03:43:49 +0000373have_tests=yes
Roger Meierc88d5812014-01-26 11:51:26 +0100374if test "$enable_tests" = "no"; then
Jake Farrell627f1a02011-09-14 03:43:49 +0000375 have_tests="no"
376fi
377AM_CONDITIONAL(WITH_TESTS, [test "$have_tests" = "yes"])
378
Roger Meierc88d5812014-01-26 11:51:26 +0100379AC_ARG_ENABLE([tutorial],
380 AS_HELP_STRING([--enable-tutorial], [build tutorial [default=yes]]),
381 [], enable_tutorial=yes
382)
383have_tutorial=yes
384if test "$enable_tutorial" = "no"; then
385 have_tutorial="no"
386fi
387AM_CONDITIONAL(WITH_TUTORIAL, [test "$have_tutorial" = "yes"])
388
Roger Meier6e969652011-12-13 00:36:01 +0000389AM_CONDITIONAL(MINGW, false)
390case "${host_os}" in
391*mingw*)
392 mingw32_support="yes"
393 AC_CHECK_HEADER(windows.h)
394 AM_CONDITIONAL(MINGW, true)
395 ;;
396*)
397 AC_ISC_POSIX
398 ;;
399esac
400
David Reiss832b2622007-12-28 18:25:33 +0000401AC_C_CONST
402AC_C_INLINE
403AC_C_VOLATILE
404
405AC_HEADER_STDBOOL
406AC_HEADER_STDC
407AC_HEADER_TIME
Christian Lavoieafc6d8f2011-02-20 02:39:19 +0000408AC_HEADER_SYS_WAIT
409AC_TYPE_SIGNAL
David Reiss832b2622007-12-28 18:25:33 +0000410AC_CHECK_HEADERS([arpa/inet.h])
Bryan Duxbury184d2622010-08-17 17:43:58 +0000411AC_CHECK_HEADERS([sys/param.h])
David Reiss832b2622007-12-28 18:25:33 +0000412AC_CHECK_HEADERS([fcntl.h])
413AC_CHECK_HEADERS([inttypes.h])
David Reiss7ed4b982008-02-11 23:24:47 +0000414AC_CHECK_HEADERS([limits.h])
David Reiss832b2622007-12-28 18:25:33 +0000415AC_CHECK_HEADERS([netdb.h])
416AC_CHECK_HEADERS([netinet/in.h])
417AC_CHECK_HEADERS([pthread.h])
418AC_CHECK_HEADERS([stddef.h])
David Reissd7a16f42008-02-19 22:47:29 +0000419AC_CHECK_HEADERS([stdlib.h])
David Reiss832b2622007-12-28 18:25:33 +0000420AC_CHECK_HEADERS([sys/socket.h])
421AC_CHECK_HEADERS([sys/time.h])
Roger Meier2fa9c312011-09-05 19:15:53 +0000422AC_CHECK_HEADERS([sys/un.h])
423AC_CHECK_HEADERS([sys/poll.h])
424AC_CHECK_HEADERS([sys/resource.h])
David Reiss832b2622007-12-28 18:25:33 +0000425AC_CHECK_HEADERS([unistd.h])
426AC_CHECK_HEADERS([libintl.h])
427AC_CHECK_HEADERS([malloc.h])
Roger Meier9d9c4b92011-02-23 20:27:54 +0000428AC_CHECK_HEADERS([openssl/ssl.h])
429AC_CHECK_HEADERS([openssl/rand.h])
430AC_CHECK_HEADERS([openssl/x509v3.h])
Roger Meier12d70532011-12-14 23:35:28 +0000431AC_CHECK_HEADERS([sched.h])
Roger Meier93576362013-03-15 19:49:23 +0100432AC_CHECK_HEADERS([wchar.h])
David Reiss832b2622007-12-28 18:25:33 +0000433
434AC_CHECK_LIB(pthread, pthread_create)
David Reisse4ca1792009-05-21 02:28:19 +0000435dnl NOTE(dreiss): I haven't been able to find any really solid docs
436dnl on what librt is and how it fits into various Unix systems.
437dnl My best guess is that it is where glibc stashes its implementation
438dnl of the POSIX Real-Time Extensions. This seems necessary on Linux,
439dnl and we haven't yet found a system where this is a problem.
440AC_CHECK_LIB(rt, clock_gettime)
David Reiss9b903442009-10-21 05:51:28 +0000441AC_CHECK_LIB(socket, setsockopt)
Roger Meier68691122011-09-09 06:19:35 +0000442
443if test "$have_cpp" = "yes" ; then
444# mingw toolchain used to build "Thrift Compiler for Windows"
445# does not support libcrypto, so we just check if we building the cpp library
Jake Farrell012dfda2011-08-29 18:18:55 +0000446AC_CHECK_LIB(crypto,
447 BN_init,
448 [AC_CHECK_LIB(ssl,
449 SSL_ctrl,
450 [LIBS="-lssl -lcrypto $LIBS"],
451 [AC_MSG_ERROR(["Error: libssl required"])],
452 -lcrypto
453 )],
454 [AC_MSG_ERROR(["Error: libcrypto required."])]
455)
Roger Meier68691122011-09-09 06:19:35 +0000456fi
David Reiss832b2622007-12-28 18:25:33 +0000457
458AC_TYPE_INT16_T
459AC_TYPE_INT32_T
460AC_TYPE_INT64_T
461AC_TYPE_INT8_T
462AC_TYPE_MODE_T
463AC_TYPE_OFF_T
464AC_TYPE_SIZE_T
David Reiss847a2942008-04-21 18:07:43 +0000465AC_TYPE_SSIZE_T
David Reiss832b2622007-12-28 18:25:33 +0000466AC_TYPE_UINT16_T
467AC_TYPE_UINT32_T
468AC_TYPE_UINT64_T
469AC_TYPE_UINT8_T
David Reiss33fc5ad2008-05-09 07:17:34 +0000470AC_CHECK_TYPES([ptrdiff_t], [], [exit 1])
David Reiss832b2622007-12-28 18:25:33 +0000471
David Reiss7ed4b982008-02-11 23:24:47 +0000472AC_STRUCT_TM
473
David Reiss85a8f7b2009-05-21 02:28:16 +0000474dnl NOTE(dreiss): AI_ADDRCONFIG is not defined on OpenBSD.
475AC_CHECK_DECL([AI_ADDRCONFIG], [],
476 [AC_DEFINE([AI_ADDRCONFIG], 0,
477 [Define if the AI_ADDRCONFIG symbol is unavailable])],
478 [
479 #include <sys/types.h>
480 #include <sys/socket.h>
481 #include <netdb.h>
482])
483
David Reiss832b2622007-12-28 18:25:33 +0000484AC_FUNC_ALLOCA
Roger Meier213a6642010-10-27 12:30:11 +0000485AC_FUNC_FORK
David Reiss832b2622007-12-28 18:25:33 +0000486AC_FUNC_MALLOC
David Reiss7ed4b982008-02-11 23:24:47 +0000487AC_FUNC_MEMCMP
David Reiss832b2622007-12-28 18:25:33 +0000488AC_FUNC_REALLOC
489AC_FUNC_SELECT_ARGTYPES
490AC_FUNC_STAT
491AC_FUNC_STRERROR_R
David Reiss7ed4b982008-02-11 23:24:47 +0000492AC_FUNC_STRFTIME
David Reiss832b2622007-12-28 18:25:33 +0000493AC_FUNC_VPRINTF
494AC_CHECK_FUNCS([strtoul])
495AC_CHECK_FUNCS([bzero])
David Reiss7ed4b982008-02-11 23:24:47 +0000496AC_CHECK_FUNCS([ftruncate])
David Reiss832b2622007-12-28 18:25:33 +0000497AC_CHECK_FUNCS([gethostbyname])
498AC_CHECK_FUNCS([gettimeofday])
499AC_CHECK_FUNCS([memmove])
500AC_CHECK_FUNCS([memset])
501AC_CHECK_FUNCS([mkdir])
502AC_CHECK_FUNCS([realpath])
503AC_CHECK_FUNCS([select])
504AC_CHECK_FUNCS([socket])
505AC_CHECK_FUNCS([strchr])
506AC_CHECK_FUNCS([strdup])
David Reiss7ed4b982008-02-11 23:24:47 +0000507AC_CHECK_FUNCS([strerror])
David Reiss832b2622007-12-28 18:25:33 +0000508AC_CHECK_FUNCS([strstr])
509AC_CHECK_FUNCS([strtol])
510AC_CHECK_FUNCS([sqrt])
David Reisse4ca1792009-05-21 02:28:19 +0000511dnl The following functions are optional.
Roger Meier213a6642010-10-27 12:30:11 +0000512AC_CHECK_FUNCS([alarm])
David Reisse4ca1792009-05-21 02:28:19 +0000513AC_CHECK_FUNCS([clock_gettime])
514AC_CHECK_FUNCS([sched_get_priority_min])
515AC_CHECK_FUNCS([sched_get_priority_max])
David Reiss832b2622007-12-28 18:25:33 +0000516
David Reiss79db3e12010-08-31 16:51:31 +0000517if test "$cross_compiling" = "no" ; then
518 AX_SIGNED_RIGHT_SHIFT
519fi
David Reisse4d4ea02009-04-02 21:37:17 +0000520
David Reiss5ddabb82010-10-06 17:09:37 +0000521dnl autoscan thinks we need this macro because we have a member function
522dnl called "error". Invoke the macro but don't run the check so autoscan
523dnl thinks we are in the clear. It's highly unlikely that we will ever
524dnl actually use the function that this checks for.
525if false ; then
526 AC_FUNC_ERROR_AT_LINE
527fi
528
Roger Meier213a6642010-10-27 12:30:11 +0000529# --- Coverage hooks ---
530
531AC_ARG_ENABLE(coverage,
532 [ --enable-coverage turn on -fprofile-arcs -ftest-coverage],
533 [case "${enableval}" in
534 yes) ENABLE_COVERAGE=1 ;;
535 no) ENABLE_COVERAGE=0 ;;
536 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cov) ;;
537 esac],
538 [ENABLE_COVERAGE=2])
539
540if test "x[$]ENABLE_COVERAGE" = "x1"; then
541 AC_MSG_WARN(enable coverage)
542 GCOV_CFLAGS="`echo \"[$]CFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
543 GCOV_CXXFLAGS="`echo \"[$]CXXFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
544 GCOV_LDFLAGS="-XCClinker -fprofile-arcs -XCClinker -ftest-coverage"
545fi
546
547AC_SUBST(ENABLE_COVERAGE)
548AC_SUBST(GCOV_CFLAGS)
549AC_SUBST(GCOV_CXXFLAGS)
550AC_SUBST(GCOV_LDFLAGS)
551
Roger Meier3faaedf2011-10-02 10:51:45 +0000552AC_ARG_ENABLE(boostthreads,
553 [ --enable-boostthreads use boost threads, instead of POSIX pthread (experimental) ],
554 [case "${enableval}" in
555 yes) ENABLE_BOOSTTHREADS=1 ;;
556 no) ENABLE_BOOSTTHREADS=0 ;;
557 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cov) ;;
558 esac],
559 [ENABLE_BOOSTTHREADS=2])
560
561
562if test "x[$]ENABLE_BOOSTTHREADS" = "x1"; then
563 AC_MSG_WARN(enable boostthreads)
564 AC_DEFINE([USE_BOOST_THREAD], [1], [experimental --enable-boostthreads that replaces POSIX pthread by boost::thread])
Roger Meier38315782011-11-06 11:29:41 +0000565 LIBS="-lboost_thread $LIBS"
Roger Meier3faaedf2011-10-02 10:51:45 +0000566fi
567
568AM_CONDITIONAL([WITH_BOOSTTHREADS], [test "x[$]ENABLE_BOOSTTHREADS" = "x1"])
569
David Reiss832b2622007-12-28 18:25:33 +0000570AC_CONFIG_HEADERS(config.h:config.hin)
Roger Meier58fe5362013-06-22 22:05:22 +0200571AC_CONFIG_HEADERS(lib/cpp/src/thrift/config.h:config.hin)
Jake Farrell240df172013-06-04 23:59:34 -0400572# gruard against pre defined config.h
573AH_TOP([
574#ifndef CONFIG_H
Roger Meier8909cbd2014-01-26 11:44:27 +0100575#define CONFIG_H
Jake Farrell240df172013-06-04 23:59:34 -0400576])
577AH_BOTTOM([
578#endif
579])
580
David Reiss832b2622007-12-28 18:25:33 +0000581
582AC_CONFIG_FILES([
583 Makefile
584 compiler/cpp/Makefile
Bryan Duxburya1e268c2010-05-03 21:33:00 +0000585 compiler/cpp/version.h
Jake Farrell16b76412012-06-22 03:51:38 +0000586 compiler/cpp/src/windows/version.h
David Reiss832b2622007-12-28 18:25:33 +0000587 lib/Makefile
588 lib/cpp/Makefile
David Reiss351e22b2010-08-31 16:51:19 +0000589 lib/cpp/test/Makefile
David Reiss832b2622007-12-28 18:25:33 +0000590 lib/cpp/thrift-nb.pc
591 lib/cpp/thrift-z.pc
Roger Meier86e89862012-02-10 19:53:20 +0000592 lib/cpp/thrift-qt.pc
Bryan Duxburyc6574472010-10-06 00:12:33 +0000593 lib/cpp/thrift.pc
Roger Meier213a6642010-10-27 12:30:11 +0000594 lib/c_glib/Makefile
595 lib/c_glib/thrift_c_glib.pc
596 lib/c_glib/test/Makefile
David Reiss1fdb5922008-02-06 22:10:12 +0000597 lib/csharp/Makefile
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000598 lib/d/Makefile
599 lib/d/test/Makefile
Bryan Duxbury7173bd92010-05-02 22:54:22 +0000600 lib/erl/Makefile
Jens Geyer0e87c462013-06-18 22:25:07 +0200601 lib/go/Makefile
Jens Geyera7da4882013-07-18 00:33:05 +0200602 lib/go/test/Makefile
Anthony F. Molinaroa5df7c72010-09-27 17:22:17 +0000603 lib/hs/Makefile
David Reissf8dcf032008-02-23 22:07:39 +0000604 lib/java/Makefile
Roger Meierf2495762011-03-17 19:13:36 +0000605 lib/js/test/Makefile
Roger Meier8909cbd2014-01-26 11:44:27 +0100606 lib/nodejs/Makefile
T Jake Luciani1952e542009-02-01 04:47:30 +0000607 lib/perl/Makefile
608 lib/perl/test/Makefile
Bryan Duxbury6a681872010-05-02 22:39:31 +0000609 lib/php/Makefile
Roger Meier33b720a2012-01-24 18:42:46 +0000610 lib/php/test/Makefile
David Reiss832b2622007-12-28 18:25:33 +0000611 lib/py/Makefile
Kevin Clark4bd89162008-07-08 00:47:49 +0000612 lib/rb/Makefile
David Reiss8180c0c2008-02-04 21:14:14 +0000613 test/Makefile
Roger Meierd3b9dca2011-06-24 14:01:10 +0000614 test/cpp/Makefile
Bryan Duxburyc6574472010-10-06 00:12:33 +0000615 test/hs/Makefile
Roger Meierb33967b2012-01-21 09:18:05 +0000616 test/php/Makefile
Roger Meier01b568c2012-01-10 21:30:02 +0000617 test/perl/Makefile
David Reiss9ff3b9d2008-02-15 01:10:23 +0000618 test/py/Makefile
Roger Meier50e43492010-10-08 17:46:06 +0000619 test/py.twisted/Makefile
Chris Piro20c81ad2013-03-07 11:32:48 -0500620 test/py.tornado/Makefile
Kevin Clark4bd89162008-07-08 00:47:49 +0000621 test/rb/Makefile
Roger Meierfa899322012-10-22 19:27:38 +0000622 tutorial/Makefile
Roger Meier18a90d12012-10-24 18:40:06 +0000623 tutorial/cpp/Makefile
Jens Geyer0e87c462013-06-18 22:25:07 +0200624 tutorial/go/Makefile
Roger Meierfa899322012-10-22 19:27:38 +0000625 tutorial/java/Makefile
626 tutorial/js/Makefile
Roger Meier64998e22014-01-27 21:15:56 +0100627 tutorial/nodejs/Makefile
Roger Meier1d66d062012-10-26 21:46:18 +0000628 tutorial/py/Makefile
629 tutorial/py.twisted/Makefile
Chris Piro20c81ad2013-03-07 11:32:48 -0500630 tutorial/py.tornado/Makefile
Roger Meiered817d02013-06-09 23:10:06 +0200631 tutorial/rb/Makefile
David Reiss832b2622007-12-28 18:25:33 +0000632])
Marc Slemkob09f5882006-08-23 22:03:34 +0000633
634AC_OUTPUT
David Reiss5cc3ba82010-08-31 16:51:20 +0000635
636
637echo
638echo "$PACKAGE $VERSION"
639echo
David Reissea4c9812010-08-31 16:51:21 +0000640echo "Building C++ Library ......... : $have_cpp"
Roger Meier213a6642010-10-27 12:30:11 +0000641echo "Building C (GLib) Library .... : $have_c_glib"
David Reiss5cc3ba82010-08-31 16:51:20 +0000642echo "Building Java Library ........ : $have_java"
643echo "Building C# Library .......... : $have_csharp"
644echo "Building Python Library ...... : $have_python"
645echo "Building Ruby Library ........ : $have_ruby"
Anthony F. Molinaroa5df7c72010-09-27 17:22:17 +0000646echo "Building Haskell Library ..... : $have_haskell"
David Reiss5cc3ba82010-08-31 16:51:20 +0000647echo "Building Perl Library ........ : $have_perl"
648echo "Building PHP Library ......... : $have_php"
649echo "Building Erlang Library ...... : $have_erlang"
Christian Lavoieafc6d8f2011-02-20 02:39:19 +0000650echo "Building Go Library .......... : $have_go"
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000651echo "Building D Library ........... : $have_d"
Roger Meier8909cbd2014-01-26 11:44:27 +0100652echo "Building NodeJS Library ...... : $have_nodejs"
Jake Farrellc9c972b2012-07-24 17:28:24 +0000653
David Reiss5cc3ba82010-08-31 16:51:20 +0000654if test "$have_cpp" = "yes" ; then
655 echo
Roger Meier86e89862012-02-10 19:53:20 +0000656 echo "C++ Library:"
657 echo " Build TZlibTransport ...... : $have_zlib"
658 echo " Build TNonblockingServer .. : $have_libevent"
659 echo " Build TQTcpServer (Qt) .... : $have_qt"
David Reiss5cc3ba82010-08-31 16:51:20 +0000660fi
661if test "$have_java" = "yes" ; then
662 echo
Roger Meier86e89862012-02-10 19:53:20 +0000663 echo "Java Library:"
664 echo " Using javac ............... : $JAVAC"
665 echo " Using java ................ : $JAVA"
666 echo " Using ant ................. : $ANT"
David Reiss5cc3ba82010-08-31 16:51:20 +0000667fi
668if test "$have_csharp" = "yes" ; then
669 echo
Roger Meier86e89862012-02-10 19:53:20 +0000670 echo "C# Library:"
671 echo " Using .NET 3.5 ............ : $net_3_5"
David Reiss5cc3ba82010-08-31 16:51:20 +0000672fi
673if test "$have_python" = "yes" ; then
674 echo
Roger Meier86e89862012-02-10 19:53:20 +0000675 echo "Python Library:"
676 echo " Using Python .............. : $PYTHON"
David Reiss5cc3ba82010-08-31 16:51:20 +0000677fi
Anthony F. Molinaroddcf32a2010-10-05 16:45:50 +0000678if test "$have_php" = "yes" ; then
679 echo
Roger Meier86e89862012-02-10 19:53:20 +0000680 echo "PHP Library:"
681 echo " Using php-config .......... : $PHP_CONFIG"
Anthony F. Molinaroddcf32a2010-10-05 16:45:50 +0000682fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000683if test "$have_ruby" = "yes" ; then
684 echo
Roger Meier86e89862012-02-10 19:53:20 +0000685 echo "Ruby Library:"
686 echo " Using Ruby ................ : $RUBY"
David Reiss5cc3ba82010-08-31 16:51:20 +0000687fi
Anthony F. Molinaroa5df7c72010-09-27 17:22:17 +0000688if test "$have_haskell" = "yes" ; then
689 echo
Roger Meier86e89862012-02-10 19:53:20 +0000690 echo "Haskell Library:"
691 echo " Using Haskell ............. : $RUNHASKELL"
692 echo " Using Cabal ............... : $CABAL"
Anthony F. Molinaroa5df7c72010-09-27 17:22:17 +0000693fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000694if test "$have_perl" = "yes" ; then
695 echo
Roger Meier86e89862012-02-10 19:53:20 +0000696 echo "Perl Library:"
697 echo " Using Perl ................ : $PERL"
David Reiss5cc3ba82010-08-31 16:51:20 +0000698fi
699if test "$have_erlang" = "yes" ; then
700 echo
Roger Meier86e89862012-02-10 19:53:20 +0000701 echo "Erlang Library:"
702 echo " Using erlc ................ : $ERLC"
David Reiss5cc3ba82010-08-31 16:51:20 +0000703fi
Christian Lavoieafc6d8f2011-02-20 02:39:19 +0000704if test "$have_go" = "yes" ; then
705 echo
Roger Meier86e89862012-02-10 19:53:20 +0000706 echo "Go Library:"
Jens Geyer0e87c462013-06-18 22:25:07 +0200707 echo " Using Go................... : $GO"
Jens Geyera7da4882013-07-18 00:33:05 +0200708 echo " Using Go version........... : $($GO version)"
Christian Lavoieafc6d8f2011-02-20 02:39:19 +0000709fi
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000710if test "$have_d" = "yes" ; then
711 echo
Jens Geyerbcca1d92013-12-26 19:24:30 +0100712 echo "D Library:"
713 echo " Using D Compiler .......... : $DMD"
714 echo " Building D libevent tests . : $with_d_event_tests"
715 echo " Building D SSL tests ...... : $with_d_ssl_tests"
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000716fi
Roger Meier8909cbd2014-01-26 11:44:27 +0100717if test "$have_nodejs" = "yes" ; then
718 echo
719 echo "NodeJS Library:"
720 echo " Using NodeJS .............. : $NODEJS"
721 echo " Using NodeJS version....... : $($NODEJS --version)"
722fi
David Reiss5cc3ba82010-08-31 16:51:20 +0000723echo
724echo "If something is missing that you think should be present,"
725echo "please skim the output of configure to find the missing"
726echo "component. Details are present in config.log."