blob: 6ab49db2372aac46dc351caf89e8141302ffd22d [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
Marc Slemkob09f5882006-08-23 22:03:34 +000020AC_PREREQ(2.59)
21
David Reiss10a22bf2008-04-21 18:08:07 +000022AC_INIT([thrift], [20080411])
Marc Slemkob09f5882006-08-23 22:03:34 +000023
24AC_CONFIG_AUX_DIR([.])
25
26AM_INIT_AUTOMAKE
27
David Reissd6832192007-09-05 00:47:32 +000028AC_ARG_VAR([PY_PREFIX], [Prefix for installing Python modules.
29 (Normal --prefix is ignored for Python because
30 Python has different conventions.)
31 Default = "/usr"])
David Reisscdd6f3c2008-03-04 21:10:29 +000032AS_IF([test "x$PY_PREFIX" = x], [PY_PREFIX="/usr"])
David Reissd6832192007-09-05 00:47:32 +000033
David Reissf0c21a72008-07-11 01:26:16 +000034AC_ARG_VAR([JAVA_PREFIX], [Prefix for installing the Java lib jar.
35 (Normal --prefix is ignored for Java because
36 Java has different conevntions.)
37 Default = "/usr/local/lib"])
38AS_IF([test "x$JAVA_PREFIX" = x], [JAVA_PREFIX="/usr/local/lib"])
David Reiss832b2622007-12-28 18:25:33 +000039
40AC_PROG_CC
41AC_PROG_CPP
42AC_PROG_CXX
43AC_PROG_INSTALL
44AC_PROG_LIBTOOL
45AC_PROG_MAKE_SET
46AC_PROG_YACC
47AC_PROG_LEX
48AM_PROG_LEX
David Reiss7ed4b982008-02-11 23:24:47 +000049AC_PROG_LN_S
50AC_PROG_MKDIR_P
David Reiss832b2622007-12-28 18:25:33 +000051
52AC_LANG([C++])
53AX_BOOST_BASE([1.33.1])
54
55AX_LIB_EVENT([1.0])
56AM_CONDITIONAL([AMX_HAVE_LIBEVENT], [test "$success" = "yes"])
57
58AX_LIB_ZLIB([1.2.3])
59AM_CONDITIONAL([AMX_HAVE_ZLIB], [test "$success" = "yes"])
60
David Reiss520b5ee2008-03-02 07:00:26 +000061AX_THRIFT_LIB(csharp, [C#], yes)
62if test "$with_csharp" = "yes"; then
David Reissd831a212009-02-13 03:09:52 +000063 PKG_CHECK_MODULES(MONO, mono >= 2.0.0, net_3_5=yes, net_3_5=no)
64 PKG_CHECK_MODULES(MONO, mono >= 1.2.4, have_mono=yes, have_mono=no)
David Reiss520b5ee2008-03-02 07:00:26 +000065fi
David Reiss82c1bab2008-06-11 01:16:53 +000066AM_CONDITIONAL(WITH_MONO, [test "$have_mono" = "yes"])
David Reissd831a212009-02-13 03:09:52 +000067AM_CONDITIONAL(NET_2_0, [test "$net_3_5" = "no"])
David Reiss1fdb5922008-02-06 22:10:12 +000068
David Reiss62d39812008-03-02 07:00:22 +000069AX_THRIFT_LIB(java, [Java], yes)
70if test "$with_java" = "yes"; then
David Reissd9cdf422009-03-13 21:25:29 +000071 AX_JAVAC_AND_JAVA
David Reiss62d39812008-03-02 07:00:22 +000072 AC_PATH_PROG([ANT], [ant])
Bryan Duxburyc27cda52009-08-14 20:04:15 +000073 AX_CHECK_JAVA_CLASS(org.slf4j.Logger)
74 have_slf4j="$success"
75 AX_CHECK_JAVA_CLASS(org.slf4j.impl.SimpleLogger)
76 have_slf4j_simple="$success"
David Reissfdfcebd2009-05-22 19:50:29 +000077 AX_CHECK_JAVA_CLASS(org.apache.commons.lang.builder.HashCodeBuilder)
78 have_hashcode="$success"
Bryan Duxburyc27cda52009-08-14 20:04:15 +000079 if test "x$have_slf4j_simple" = "xyes" && test "x$have_slf4j" = "xyes" && test "x$have_hashcode" = "xyes" ; then
David Reiss4ca0c8e2009-05-12 23:16:55 +000080 ANT_FLAGS="$ANT_FLAGS -Dnoivy="
81 fi
David Reissfff84d12009-05-22 19:50:33 +000082 AC_SUBST(CLASSPATH)
David Reiss4ca0c8e2009-05-12 23:16:55 +000083 AC_SUBST(ANT_FLAGS)
David Reiss62d39812008-03-02 07:00:22 +000084fi
David Reiss82c1bab2008-06-11 01:16:53 +000085AM_CONDITIONAL([WITH_JAVA],
David Reissf8dcf032008-02-23 22:07:39 +000086 [test -n "$ANT" -a -n "$JAVA" -a -n "$JAVAC"])
David Reiss1fdb5922008-02-06 22:10:12 +000087
Christopher Pirob6f18c22008-03-04 07:09:12 +000088AX_THRIFT_LIB(erlang, [Erlang], yes)
89if test "$with_erlang" = "yes"; then
90 AC_PATH_PROG([ERLC], [erlc])
91fi
David Reiss82c1bab2008-06-11 01:16:53 +000092AM_CONDITIONAL(WITH_ERLANG, [test -n "$ERLC"])
Christopher Pirob6f18c22008-03-04 07:09:12 +000093
David Reiss1a140912008-06-11 01:16:37 +000094AX_THRIFT_LIB(py, [Python], yes)
95if test "$with_py" = "yes"; then
96 AM_PATH_PYTHON(2.4,, :)
97fi
David Reiss82c1bab2008-06-11 01:16:53 +000098AM_CONDITIONAL(WITH_PYTHON, [test -n "$PYTHON" -a "$PYTHON" != ":"])
David Reiss1a140912008-06-11 01:16:37 +000099
T Jake Luciani1952e542009-02-01 04:47:30 +0000100AX_THRIFT_LIB(perl, [Perl], yes)
101if test "$with_perl" = "yes"; then
102 AC_PATH_PROG([PERL], [perl])
103fi
104AM_CONDITIONAL(WITH_PERL, [test -n "$PERL"])
105
Kevin Clark4bd89162008-07-08 00:47:49 +0000106AX_THRIFT_LIB(ruby, [Ruby], yes)
107if test "$with_ruby" = "yes"; then
108 AC_PATH_PROG([RUBY], [ruby])
Bryan Duxburyec473582009-04-07 16:31:04 +0000109 AC_PATH_PROG([RSPEC], [spec])
Kevin Clark4bd89162008-07-08 00:47:49 +0000110fi
David Reiss8d07e1d2008-07-11 08:04:12 +0000111AM_CONDITIONAL(WITH_RUBY, [test -n "$RUBY"])
Bryan Duxburyec473582009-04-07 16:31:04 +0000112AM_CONDITIONAL(HAVE_RSPEC, [test -n "$RSPEC"])
113
Kevin Clark4bd89162008-07-08 00:47:49 +0000114
David Reiss832b2622007-12-28 18:25:33 +0000115AC_C_CONST
116AC_C_INLINE
117AC_C_VOLATILE
118
119AC_HEADER_STDBOOL
120AC_HEADER_STDC
121AC_HEADER_TIME
122AC_CHECK_HEADERS([arpa/inet.h])
123AC_CHECK_HEADERS([endian.h])
124AC_CHECK_HEADERS([fcntl.h])
125AC_CHECK_HEADERS([inttypes.h])
David Reiss7ed4b982008-02-11 23:24:47 +0000126AC_CHECK_HEADERS([limits.h])
David Reiss832b2622007-12-28 18:25:33 +0000127AC_CHECK_HEADERS([netdb.h])
128AC_CHECK_HEADERS([netinet/in.h])
129AC_CHECK_HEADERS([pthread.h])
130AC_CHECK_HEADERS([stddef.h])
David Reissd7a16f42008-02-19 22:47:29 +0000131AC_CHECK_HEADERS([stdlib.h])
David Reiss832b2622007-12-28 18:25:33 +0000132AC_CHECK_HEADERS([sys/socket.h])
133AC_CHECK_HEADERS([sys/time.h])
134AC_CHECK_HEADERS([unistd.h])
135AC_CHECK_HEADERS([libintl.h])
136AC_CHECK_HEADERS([malloc.h])
137
138AC_CHECK_LIB(pthread, pthread_create)
David Reisse4ca1792009-05-21 02:28:19 +0000139dnl NOTE(dreiss): I haven't been able to find any really solid docs
140dnl on what librt is and how it fits into various Unix systems.
141dnl My best guess is that it is where glibc stashes its implementation
142dnl of the POSIX Real-Time Extensions. This seems necessary on Linux,
143dnl and we haven't yet found a system where this is a problem.
144AC_CHECK_LIB(rt, clock_gettime)
David Reiss832b2622007-12-28 18:25:33 +0000145
146AC_TYPE_INT16_T
147AC_TYPE_INT32_T
148AC_TYPE_INT64_T
149AC_TYPE_INT8_T
150AC_TYPE_MODE_T
151AC_TYPE_OFF_T
152AC_TYPE_SIZE_T
David Reiss847a2942008-04-21 18:07:43 +0000153AC_TYPE_SSIZE_T
David Reiss832b2622007-12-28 18:25:33 +0000154AC_TYPE_UINT16_T
155AC_TYPE_UINT32_T
156AC_TYPE_UINT64_T
157AC_TYPE_UINT8_T
David Reiss33fc5ad2008-05-09 07:17:34 +0000158AC_CHECK_TYPES([ptrdiff_t], [], [exit 1])
David Reiss832b2622007-12-28 18:25:33 +0000159
David Reiss7ed4b982008-02-11 23:24:47 +0000160AC_STRUCT_TM
161
David Reiss85a8f7b2009-05-21 02:28:16 +0000162dnl NOTE(dreiss): AI_ADDRCONFIG is not defined on OpenBSD.
163AC_CHECK_DECL([AI_ADDRCONFIG], [],
164 [AC_DEFINE([AI_ADDRCONFIG], 0,
165 [Define if the AI_ADDRCONFIG symbol is unavailable])],
166 [
167 #include <sys/types.h>
168 #include <sys/socket.h>
169 #include <netdb.h>
170])
171
David Reiss832b2622007-12-28 18:25:33 +0000172AC_FUNC_ALLOCA
173AC_FUNC_MALLOC
David Reiss7ed4b982008-02-11 23:24:47 +0000174AC_FUNC_MEMCMP
David Reiss832b2622007-12-28 18:25:33 +0000175AC_FUNC_REALLOC
176AC_FUNC_SELECT_ARGTYPES
177AC_FUNC_STAT
178AC_FUNC_STRERROR_R
David Reiss7ed4b982008-02-11 23:24:47 +0000179AC_FUNC_STRFTIME
David Reiss832b2622007-12-28 18:25:33 +0000180AC_FUNC_VPRINTF
181AC_CHECK_FUNCS([strtoul])
182AC_CHECK_FUNCS([bzero])
David Reiss7ed4b982008-02-11 23:24:47 +0000183AC_CHECK_FUNCS([ftruncate])
David Reiss832b2622007-12-28 18:25:33 +0000184AC_CHECK_FUNCS([gethostbyname])
185AC_CHECK_FUNCS([gettimeofday])
186AC_CHECK_FUNCS([memmove])
187AC_CHECK_FUNCS([memset])
188AC_CHECK_FUNCS([mkdir])
189AC_CHECK_FUNCS([realpath])
190AC_CHECK_FUNCS([select])
191AC_CHECK_FUNCS([socket])
192AC_CHECK_FUNCS([strchr])
193AC_CHECK_FUNCS([strdup])
David Reiss7ed4b982008-02-11 23:24:47 +0000194AC_CHECK_FUNCS([strerror])
David Reiss832b2622007-12-28 18:25:33 +0000195AC_CHECK_FUNCS([strstr])
196AC_CHECK_FUNCS([strtol])
197AC_CHECK_FUNCS([sqrt])
David Reisse4ca1792009-05-21 02:28:19 +0000198dnl The following functions are optional.
199AC_CHECK_FUNCS([clock_gettime])
200AC_CHECK_FUNCS([sched_get_priority_min])
201AC_CHECK_FUNCS([sched_get_priority_max])
David Reiss832b2622007-12-28 18:25:33 +0000202
David Reisse4d4ea02009-04-02 21:37:17 +0000203AX_SIGNED_RIGHT_SHIFT
204
David Reiss22585732008-02-27 01:55:33 +0000205AX_THRIFT_GEN(cpp, [C++], yes)
206AM_CONDITIONAL([THRIFT_GEN_cpp], [test "$ax_thrift_gen_cpp" = "yes"])
David Reisse8a87de2008-02-27 02:39:25 +0000207AX_THRIFT_GEN(java, [Java], yes)
208AM_CONDITIONAL([THRIFT_GEN_java], [test "$ax_thrift_gen_java" = "yes"])
David Reissce4f4f02008-03-27 21:41:31 +0000209AX_THRIFT_GEN(csharp, [C#], yes)
210AM_CONDITIONAL([THRIFT_GEN_csharp], [test "$ax_thrift_gen_csharp" = "yes"])
David Reissbfd26dc2008-03-27 21:41:49 +0000211AX_THRIFT_GEN(py, [Python], yes)
212AM_CONDITIONAL([THRIFT_GEN_py], [test "$ax_thrift_gen_py" = "yes"])
David Reissae253582008-03-27 21:42:11 +0000213AX_THRIFT_GEN(rb, [Ruby], yes)
214AM_CONDITIONAL([THRIFT_GEN_rb], [test "$ax_thrift_gen_rb" = "yes"])
David Reissfdc21aa2008-03-27 21:42:34 +0000215AX_THRIFT_GEN(perl, [Perl], yes)
216AM_CONDITIONAL([THRIFT_GEN_perl], [test "$ax_thrift_gen_perl" = "yes"])
David Reiss32272d92009-02-17 20:28:30 +0000217AX_THRIFT_GEN(php, [PHP], yes)
218AM_CONDITIONAL([THRIFT_GEN_php], [test "$ax_thrift_gen_php" = "yes"])
David Reissf3b0db32009-02-17 20:28:01 +0000219AX_THRIFT_GEN(erl, [Erlang], yes)
220AM_CONDITIONAL([THRIFT_GEN_erl], [test "$ax_thrift_gen_erl" = "yes"])
David Reiss4b349aa2008-03-27 21:41:02 +0000221AX_THRIFT_GEN(cocoa, [Cocoa], yes)
222AM_CONDITIONAL([THRIFT_GEN_cocoa], [test "$ax_thrift_gen_cocoa" = "yes"])
David Reissb3ac8a62008-03-27 21:40:42 +0000223AX_THRIFT_GEN(st, [Smalltalk], yes)
224AM_CONDITIONAL([THRIFT_GEN_st], [test "$ax_thrift_gen_st" = "yes"])
David Reiss3d671b52008-03-27 21:40:11 +0000225AX_THRIFT_GEN(ocaml, [OCaml], yes)
226AM_CONDITIONAL([THRIFT_GEN_ocaml], [test "$ax_thrift_gen_ocaml" = "yes"])
David Reiss22812f82008-03-27 21:40:26 +0000227AX_THRIFT_GEN(hs, [Haskell], yes)
228AM_CONDITIONAL([THRIFT_GEN_hs], [test "$ax_thrift_gen_hs" = "yes"])
David Reiss782cb672009-02-17 20:28:13 +0000229AX_THRIFT_GEN(xsd, [XSD], yes)
230AM_CONDITIONAL([THRIFT_GEN_xsd], [test "$ax_thrift_gen_xsd" = "yes"])
David Reissdc0aada2008-10-21 00:09:23 +0000231AX_THRIFT_GEN(html, [HTML], yes)
232AM_CONDITIONAL([THRIFT_GEN_html], [test "$ax_thrift_gen_html" = "yes"])
David Reiss22585732008-02-27 01:55:33 +0000233
David Reiss832b2622007-12-28 18:25:33 +0000234AC_CONFIG_HEADERS(config.h:config.hin)
235
236AC_CONFIG_FILES([
237 Makefile
238 compiler/cpp/Makefile
239 lib/Makefile
240 lib/cpp/Makefile
241 lib/cpp/thrift.pc
242 lib/cpp/thrift-nb.pc
243 lib/cpp/thrift-z.pc
David Reiss1fdb5922008-02-06 22:10:12 +0000244 lib/csharp/Makefile
David Reissf8dcf032008-02-23 22:07:39 +0000245 lib/java/Makefile
T Jake Luciani1952e542009-02-01 04:47:30 +0000246 lib/perl/Makefile
247 lib/perl/test/Makefile
David Reiss832b2622007-12-28 18:25:33 +0000248 lib/py/Makefile
Kevin Clark4bd89162008-07-08 00:47:49 +0000249 lib/rb/Makefile
David Reiss8180c0c2008-02-04 21:14:14 +0000250 test/Makefile
David Reiss9ff3b9d2008-02-15 01:10:23 +0000251 test/py/Makefile
Kevin Clark4bd89162008-07-08 00:47:49 +0000252 test/rb/Makefile
David Reiss832b2622007-12-28 18:25:33 +0000253])
Marc Slemkob09f5882006-08-23 22:03:34 +0000254
255AC_OUTPUT