blob: 2c53ca0a2045929e18db4f56c137315a51ce2b16 [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])
David Reiss4ca0c8e2009-05-12 23:16:55 +000073 AX_CHECK_JAVA_CLASS(org.apache.log4j.Logger)
74 have_log4j="$success"
75 if test "x$have_log4j" = "xyes" ; then
76 ANT_FLAGS="$ANT_FLAGS -Dnoivy="
77 fi
78 AC_SUBST(ANT_FLAGS)
David Reiss62d39812008-03-02 07:00:22 +000079fi
David Reiss82c1bab2008-06-11 01:16:53 +000080AM_CONDITIONAL([WITH_JAVA],
David Reissf8dcf032008-02-23 22:07:39 +000081 [test -n "$ANT" -a -n "$JAVA" -a -n "$JAVAC"])
David Reiss1fdb5922008-02-06 22:10:12 +000082
Christopher Pirob6f18c22008-03-04 07:09:12 +000083AX_THRIFT_LIB(erlang, [Erlang], yes)
84if test "$with_erlang" = "yes"; then
85 AC_PATH_PROG([ERLC], [erlc])
86fi
David Reiss82c1bab2008-06-11 01:16:53 +000087AM_CONDITIONAL(WITH_ERLANG, [test -n "$ERLC"])
Christopher Pirob6f18c22008-03-04 07:09:12 +000088
David Reiss1a140912008-06-11 01:16:37 +000089AX_THRIFT_LIB(py, [Python], yes)
90if test "$with_py" = "yes"; then
91 AM_PATH_PYTHON(2.4,, :)
92fi
David Reiss82c1bab2008-06-11 01:16:53 +000093AM_CONDITIONAL(WITH_PYTHON, [test -n "$PYTHON" -a "$PYTHON" != ":"])
David Reiss1a140912008-06-11 01:16:37 +000094
T Jake Luciani1952e542009-02-01 04:47:30 +000095AX_THRIFT_LIB(perl, [Perl], yes)
96if test "$with_perl" = "yes"; then
97 AC_PATH_PROG([PERL], [perl])
98fi
99AM_CONDITIONAL(WITH_PERL, [test -n "$PERL"])
100
Kevin Clark4bd89162008-07-08 00:47:49 +0000101AX_THRIFT_LIB(ruby, [Ruby], yes)
102if test "$with_ruby" = "yes"; then
103 AC_PATH_PROG([RUBY], [ruby])
Bryan Duxburyec473582009-04-07 16:31:04 +0000104 AC_PATH_PROG([RSPEC], [spec])
Kevin Clark4bd89162008-07-08 00:47:49 +0000105fi
David Reiss8d07e1d2008-07-11 08:04:12 +0000106AM_CONDITIONAL(WITH_RUBY, [test -n "$RUBY"])
Bryan Duxburyec473582009-04-07 16:31:04 +0000107AM_CONDITIONAL(HAVE_RSPEC, [test -n "$RSPEC"])
108
Kevin Clark4bd89162008-07-08 00:47:49 +0000109
David Reiss832b2622007-12-28 18:25:33 +0000110AC_C_CONST
111AC_C_INLINE
112AC_C_VOLATILE
113
114AC_HEADER_STDBOOL
115AC_HEADER_STDC
116AC_HEADER_TIME
117AC_CHECK_HEADERS([arpa/inet.h])
118AC_CHECK_HEADERS([endian.h])
119AC_CHECK_HEADERS([fcntl.h])
120AC_CHECK_HEADERS([inttypes.h])
David Reiss7ed4b982008-02-11 23:24:47 +0000121AC_CHECK_HEADERS([limits.h])
David Reiss832b2622007-12-28 18:25:33 +0000122AC_CHECK_HEADERS([netdb.h])
123AC_CHECK_HEADERS([netinet/in.h])
124AC_CHECK_HEADERS([pthread.h])
125AC_CHECK_HEADERS([stddef.h])
David Reissd7a16f42008-02-19 22:47:29 +0000126AC_CHECK_HEADERS([stdlib.h])
David Reiss832b2622007-12-28 18:25:33 +0000127AC_CHECK_HEADERS([sys/socket.h])
128AC_CHECK_HEADERS([sys/time.h])
129AC_CHECK_HEADERS([unistd.h])
130AC_CHECK_HEADERS([libintl.h])
131AC_CHECK_HEADERS([malloc.h])
132
133AC_CHECK_LIB(pthread, pthread_create)
David Reisse4ca1792009-05-21 02:28:19 +0000134dnl NOTE(dreiss): I haven't been able to find any really solid docs
135dnl on what librt is and how it fits into various Unix systems.
136dnl My best guess is that it is where glibc stashes its implementation
137dnl of the POSIX Real-Time Extensions. This seems necessary on Linux,
138dnl and we haven't yet found a system where this is a problem.
139AC_CHECK_LIB(rt, clock_gettime)
David Reiss832b2622007-12-28 18:25:33 +0000140
141AC_TYPE_INT16_T
142AC_TYPE_INT32_T
143AC_TYPE_INT64_T
144AC_TYPE_INT8_T
145AC_TYPE_MODE_T
146AC_TYPE_OFF_T
147AC_TYPE_SIZE_T
David Reiss847a2942008-04-21 18:07:43 +0000148AC_TYPE_SSIZE_T
David Reiss832b2622007-12-28 18:25:33 +0000149AC_TYPE_UINT16_T
150AC_TYPE_UINT32_T
151AC_TYPE_UINT64_T
152AC_TYPE_UINT8_T
David Reiss33fc5ad2008-05-09 07:17:34 +0000153AC_CHECK_TYPES([ptrdiff_t], [], [exit 1])
David Reiss832b2622007-12-28 18:25:33 +0000154
David Reiss7ed4b982008-02-11 23:24:47 +0000155AC_STRUCT_TM
156
David Reiss85a8f7b2009-05-21 02:28:16 +0000157dnl NOTE(dreiss): AI_ADDRCONFIG is not defined on OpenBSD.
158AC_CHECK_DECL([AI_ADDRCONFIG], [],
159 [AC_DEFINE([AI_ADDRCONFIG], 0,
160 [Define if the AI_ADDRCONFIG symbol is unavailable])],
161 [
162 #include <sys/types.h>
163 #include <sys/socket.h>
164 #include <netdb.h>
165])
166
David Reiss832b2622007-12-28 18:25:33 +0000167AC_FUNC_ALLOCA
168AC_FUNC_MALLOC
David Reiss7ed4b982008-02-11 23:24:47 +0000169AC_FUNC_MEMCMP
David Reiss832b2622007-12-28 18:25:33 +0000170AC_FUNC_REALLOC
171AC_FUNC_SELECT_ARGTYPES
172AC_FUNC_STAT
173AC_FUNC_STRERROR_R
David Reiss7ed4b982008-02-11 23:24:47 +0000174AC_FUNC_STRFTIME
David Reiss832b2622007-12-28 18:25:33 +0000175AC_FUNC_VPRINTF
176AC_CHECK_FUNCS([strtoul])
177AC_CHECK_FUNCS([bzero])
David Reiss7ed4b982008-02-11 23:24:47 +0000178AC_CHECK_FUNCS([ftruncate])
David Reiss832b2622007-12-28 18:25:33 +0000179AC_CHECK_FUNCS([gethostbyname])
180AC_CHECK_FUNCS([gettimeofday])
181AC_CHECK_FUNCS([memmove])
182AC_CHECK_FUNCS([memset])
183AC_CHECK_FUNCS([mkdir])
184AC_CHECK_FUNCS([realpath])
185AC_CHECK_FUNCS([select])
186AC_CHECK_FUNCS([socket])
187AC_CHECK_FUNCS([strchr])
188AC_CHECK_FUNCS([strdup])
David Reiss7ed4b982008-02-11 23:24:47 +0000189AC_CHECK_FUNCS([strerror])
David Reiss832b2622007-12-28 18:25:33 +0000190AC_CHECK_FUNCS([strstr])
191AC_CHECK_FUNCS([strtol])
192AC_CHECK_FUNCS([sqrt])
David Reisse4ca1792009-05-21 02:28:19 +0000193dnl The following functions are optional.
194AC_CHECK_FUNCS([clock_gettime])
195AC_CHECK_FUNCS([sched_get_priority_min])
196AC_CHECK_FUNCS([sched_get_priority_max])
David Reiss832b2622007-12-28 18:25:33 +0000197
David Reisse4d4ea02009-04-02 21:37:17 +0000198AX_SIGNED_RIGHT_SHIFT
199
David Reiss22585732008-02-27 01:55:33 +0000200AX_THRIFT_GEN(cpp, [C++], yes)
201AM_CONDITIONAL([THRIFT_GEN_cpp], [test "$ax_thrift_gen_cpp" = "yes"])
David Reisse8a87de2008-02-27 02:39:25 +0000202AX_THRIFT_GEN(java, [Java], yes)
203AM_CONDITIONAL([THRIFT_GEN_java], [test "$ax_thrift_gen_java" = "yes"])
David Reissce4f4f02008-03-27 21:41:31 +0000204AX_THRIFT_GEN(csharp, [C#], yes)
205AM_CONDITIONAL([THRIFT_GEN_csharp], [test "$ax_thrift_gen_csharp" = "yes"])
David Reissbfd26dc2008-03-27 21:41:49 +0000206AX_THRIFT_GEN(py, [Python], yes)
207AM_CONDITIONAL([THRIFT_GEN_py], [test "$ax_thrift_gen_py" = "yes"])
David Reissae253582008-03-27 21:42:11 +0000208AX_THRIFT_GEN(rb, [Ruby], yes)
209AM_CONDITIONAL([THRIFT_GEN_rb], [test "$ax_thrift_gen_rb" = "yes"])
David Reissfdc21aa2008-03-27 21:42:34 +0000210AX_THRIFT_GEN(perl, [Perl], yes)
211AM_CONDITIONAL([THRIFT_GEN_perl], [test "$ax_thrift_gen_perl" = "yes"])
David Reiss32272d92009-02-17 20:28:30 +0000212AX_THRIFT_GEN(php, [PHP], yes)
213AM_CONDITIONAL([THRIFT_GEN_php], [test "$ax_thrift_gen_php" = "yes"])
David Reissf3b0db32009-02-17 20:28:01 +0000214AX_THRIFT_GEN(erl, [Erlang], yes)
215AM_CONDITIONAL([THRIFT_GEN_erl], [test "$ax_thrift_gen_erl" = "yes"])
David Reiss4b349aa2008-03-27 21:41:02 +0000216AX_THRIFT_GEN(cocoa, [Cocoa], yes)
217AM_CONDITIONAL([THRIFT_GEN_cocoa], [test "$ax_thrift_gen_cocoa" = "yes"])
David Reissb3ac8a62008-03-27 21:40:42 +0000218AX_THRIFT_GEN(st, [Smalltalk], yes)
219AM_CONDITIONAL([THRIFT_GEN_st], [test "$ax_thrift_gen_st" = "yes"])
David Reiss3d671b52008-03-27 21:40:11 +0000220AX_THRIFT_GEN(ocaml, [OCaml], yes)
221AM_CONDITIONAL([THRIFT_GEN_ocaml], [test "$ax_thrift_gen_ocaml" = "yes"])
David Reiss22812f82008-03-27 21:40:26 +0000222AX_THRIFT_GEN(hs, [Haskell], yes)
223AM_CONDITIONAL([THRIFT_GEN_hs], [test "$ax_thrift_gen_hs" = "yes"])
David Reiss782cb672009-02-17 20:28:13 +0000224AX_THRIFT_GEN(xsd, [XSD], yes)
225AM_CONDITIONAL([THRIFT_GEN_xsd], [test "$ax_thrift_gen_xsd" = "yes"])
David Reissdc0aada2008-10-21 00:09:23 +0000226AX_THRIFT_GEN(html, [HTML], yes)
227AM_CONDITIONAL([THRIFT_GEN_html], [test "$ax_thrift_gen_html" = "yes"])
David Reiss22585732008-02-27 01:55:33 +0000228
David Reiss832b2622007-12-28 18:25:33 +0000229AC_CONFIG_HEADERS(config.h:config.hin)
230
231AC_CONFIG_FILES([
232 Makefile
233 compiler/cpp/Makefile
234 lib/Makefile
235 lib/cpp/Makefile
236 lib/cpp/thrift.pc
237 lib/cpp/thrift-nb.pc
238 lib/cpp/thrift-z.pc
David Reiss1fdb5922008-02-06 22:10:12 +0000239 lib/csharp/Makefile
David Reissf8dcf032008-02-23 22:07:39 +0000240 lib/java/Makefile
T Jake Luciani1952e542009-02-01 04:47:30 +0000241 lib/perl/Makefile
242 lib/perl/test/Makefile
David Reiss832b2622007-12-28 18:25:33 +0000243 lib/py/Makefile
Kevin Clark4bd89162008-07-08 00:47:49 +0000244 lib/rb/Makefile
David Reiss8180c0c2008-02-04 21:14:14 +0000245 test/Makefile
David Reiss9ff3b9d2008-02-15 01:10:23 +0000246 test/py/Makefile
Kevin Clark4bd89162008-07-08 00:47:49 +0000247 test/rb/Makefile
David Reiss832b2622007-12-28 18:25:33 +0000248])
Marc Slemkob09f5882006-08-23 22:03:34 +0000249
250AC_OUTPUT