blob: 4a88cd808fb521043a8325dba532deac332e259e [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"
David Reissfdfcebd2009-05-22 19:50:29 +000075 AX_CHECK_JAVA_CLASS(org.apache.commons.lang.builder.HashCodeBuilder)
76 have_hashcode="$success"
77 if test "x$have_log4j" = "xyes" && test "x$have_hashcode" = "xyes" ; then
David Reiss4ca0c8e2009-05-12 23:16:55 +000078 ANT_FLAGS="$ANT_FLAGS -Dnoivy="
79 fi
80 AC_SUBST(ANT_FLAGS)
David Reiss62d39812008-03-02 07:00:22 +000081fi
David Reiss82c1bab2008-06-11 01:16:53 +000082AM_CONDITIONAL([WITH_JAVA],
David Reissf8dcf032008-02-23 22:07:39 +000083 [test -n "$ANT" -a -n "$JAVA" -a -n "$JAVAC"])
David Reiss1fdb5922008-02-06 22:10:12 +000084
Christopher Pirob6f18c22008-03-04 07:09:12 +000085AX_THRIFT_LIB(erlang, [Erlang], yes)
86if test "$with_erlang" = "yes"; then
87 AC_PATH_PROG([ERLC], [erlc])
88fi
David Reiss82c1bab2008-06-11 01:16:53 +000089AM_CONDITIONAL(WITH_ERLANG, [test -n "$ERLC"])
Christopher Pirob6f18c22008-03-04 07:09:12 +000090
David Reiss1a140912008-06-11 01:16:37 +000091AX_THRIFT_LIB(py, [Python], yes)
92if test "$with_py" = "yes"; then
93 AM_PATH_PYTHON(2.4,, :)
94fi
David Reiss82c1bab2008-06-11 01:16:53 +000095AM_CONDITIONAL(WITH_PYTHON, [test -n "$PYTHON" -a "$PYTHON" != ":"])
David Reiss1a140912008-06-11 01:16:37 +000096
T Jake Luciani1952e542009-02-01 04:47:30 +000097AX_THRIFT_LIB(perl, [Perl], yes)
98if test "$with_perl" = "yes"; then
99 AC_PATH_PROG([PERL], [perl])
100fi
101AM_CONDITIONAL(WITH_PERL, [test -n "$PERL"])
102
Kevin Clark4bd89162008-07-08 00:47:49 +0000103AX_THRIFT_LIB(ruby, [Ruby], yes)
104if test "$with_ruby" = "yes"; then
105 AC_PATH_PROG([RUBY], [ruby])
Bryan Duxburyec473582009-04-07 16:31:04 +0000106 AC_PATH_PROG([RSPEC], [spec])
Kevin Clark4bd89162008-07-08 00:47:49 +0000107fi
David Reiss8d07e1d2008-07-11 08:04:12 +0000108AM_CONDITIONAL(WITH_RUBY, [test -n "$RUBY"])
Bryan Duxburyec473582009-04-07 16:31:04 +0000109AM_CONDITIONAL(HAVE_RSPEC, [test -n "$RSPEC"])
110
Kevin Clark4bd89162008-07-08 00:47:49 +0000111
David Reiss832b2622007-12-28 18:25:33 +0000112AC_C_CONST
113AC_C_INLINE
114AC_C_VOLATILE
115
116AC_HEADER_STDBOOL
117AC_HEADER_STDC
118AC_HEADER_TIME
119AC_CHECK_HEADERS([arpa/inet.h])
120AC_CHECK_HEADERS([endian.h])
121AC_CHECK_HEADERS([fcntl.h])
122AC_CHECK_HEADERS([inttypes.h])
David Reiss7ed4b982008-02-11 23:24:47 +0000123AC_CHECK_HEADERS([limits.h])
David Reiss832b2622007-12-28 18:25:33 +0000124AC_CHECK_HEADERS([netdb.h])
125AC_CHECK_HEADERS([netinet/in.h])
126AC_CHECK_HEADERS([pthread.h])
127AC_CHECK_HEADERS([stddef.h])
David Reissd7a16f42008-02-19 22:47:29 +0000128AC_CHECK_HEADERS([stdlib.h])
David Reiss832b2622007-12-28 18:25:33 +0000129AC_CHECK_HEADERS([sys/socket.h])
130AC_CHECK_HEADERS([sys/time.h])
131AC_CHECK_HEADERS([unistd.h])
132AC_CHECK_HEADERS([libintl.h])
133AC_CHECK_HEADERS([malloc.h])
134
135AC_CHECK_LIB(pthread, pthread_create)
David Reisse4ca1792009-05-21 02:28:19 +0000136dnl NOTE(dreiss): I haven't been able to find any really solid docs
137dnl on what librt is and how it fits into various Unix systems.
138dnl My best guess is that it is where glibc stashes its implementation
139dnl of the POSIX Real-Time Extensions. This seems necessary on Linux,
140dnl and we haven't yet found a system where this is a problem.
141AC_CHECK_LIB(rt, clock_gettime)
David Reiss832b2622007-12-28 18:25:33 +0000142
143AC_TYPE_INT16_T
144AC_TYPE_INT32_T
145AC_TYPE_INT64_T
146AC_TYPE_INT8_T
147AC_TYPE_MODE_T
148AC_TYPE_OFF_T
149AC_TYPE_SIZE_T
David Reiss847a2942008-04-21 18:07:43 +0000150AC_TYPE_SSIZE_T
David Reiss832b2622007-12-28 18:25:33 +0000151AC_TYPE_UINT16_T
152AC_TYPE_UINT32_T
153AC_TYPE_UINT64_T
154AC_TYPE_UINT8_T
David Reiss33fc5ad2008-05-09 07:17:34 +0000155AC_CHECK_TYPES([ptrdiff_t], [], [exit 1])
David Reiss832b2622007-12-28 18:25:33 +0000156
David Reiss7ed4b982008-02-11 23:24:47 +0000157AC_STRUCT_TM
158
David Reiss85a8f7b2009-05-21 02:28:16 +0000159dnl NOTE(dreiss): AI_ADDRCONFIG is not defined on OpenBSD.
160AC_CHECK_DECL([AI_ADDRCONFIG], [],
161 [AC_DEFINE([AI_ADDRCONFIG], 0,
162 [Define if the AI_ADDRCONFIG symbol is unavailable])],
163 [
164 #include <sys/types.h>
165 #include <sys/socket.h>
166 #include <netdb.h>
167])
168
David Reiss832b2622007-12-28 18:25:33 +0000169AC_FUNC_ALLOCA
170AC_FUNC_MALLOC
David Reiss7ed4b982008-02-11 23:24:47 +0000171AC_FUNC_MEMCMP
David Reiss832b2622007-12-28 18:25:33 +0000172AC_FUNC_REALLOC
173AC_FUNC_SELECT_ARGTYPES
174AC_FUNC_STAT
175AC_FUNC_STRERROR_R
David Reiss7ed4b982008-02-11 23:24:47 +0000176AC_FUNC_STRFTIME
David Reiss832b2622007-12-28 18:25:33 +0000177AC_FUNC_VPRINTF
178AC_CHECK_FUNCS([strtoul])
179AC_CHECK_FUNCS([bzero])
David Reiss7ed4b982008-02-11 23:24:47 +0000180AC_CHECK_FUNCS([ftruncate])
David Reiss832b2622007-12-28 18:25:33 +0000181AC_CHECK_FUNCS([gethostbyname])
182AC_CHECK_FUNCS([gettimeofday])
183AC_CHECK_FUNCS([memmove])
184AC_CHECK_FUNCS([memset])
185AC_CHECK_FUNCS([mkdir])
186AC_CHECK_FUNCS([realpath])
187AC_CHECK_FUNCS([select])
188AC_CHECK_FUNCS([socket])
189AC_CHECK_FUNCS([strchr])
190AC_CHECK_FUNCS([strdup])
David Reiss7ed4b982008-02-11 23:24:47 +0000191AC_CHECK_FUNCS([strerror])
David Reiss832b2622007-12-28 18:25:33 +0000192AC_CHECK_FUNCS([strstr])
193AC_CHECK_FUNCS([strtol])
194AC_CHECK_FUNCS([sqrt])
David Reisse4ca1792009-05-21 02:28:19 +0000195dnl The following functions are optional.
196AC_CHECK_FUNCS([clock_gettime])
197AC_CHECK_FUNCS([sched_get_priority_min])
198AC_CHECK_FUNCS([sched_get_priority_max])
David Reiss832b2622007-12-28 18:25:33 +0000199
David Reisse4d4ea02009-04-02 21:37:17 +0000200AX_SIGNED_RIGHT_SHIFT
201
David Reiss22585732008-02-27 01:55:33 +0000202AX_THRIFT_GEN(cpp, [C++], yes)
203AM_CONDITIONAL([THRIFT_GEN_cpp], [test "$ax_thrift_gen_cpp" = "yes"])
David Reisse8a87de2008-02-27 02:39:25 +0000204AX_THRIFT_GEN(java, [Java], yes)
205AM_CONDITIONAL([THRIFT_GEN_java], [test "$ax_thrift_gen_java" = "yes"])
David Reissce4f4f02008-03-27 21:41:31 +0000206AX_THRIFT_GEN(csharp, [C#], yes)
207AM_CONDITIONAL([THRIFT_GEN_csharp], [test "$ax_thrift_gen_csharp" = "yes"])
David Reissbfd26dc2008-03-27 21:41:49 +0000208AX_THRIFT_GEN(py, [Python], yes)
209AM_CONDITIONAL([THRIFT_GEN_py], [test "$ax_thrift_gen_py" = "yes"])
David Reissae253582008-03-27 21:42:11 +0000210AX_THRIFT_GEN(rb, [Ruby], yes)
211AM_CONDITIONAL([THRIFT_GEN_rb], [test "$ax_thrift_gen_rb" = "yes"])
David Reissfdc21aa2008-03-27 21:42:34 +0000212AX_THRIFT_GEN(perl, [Perl], yes)
213AM_CONDITIONAL([THRIFT_GEN_perl], [test "$ax_thrift_gen_perl" = "yes"])
David Reiss32272d92009-02-17 20:28:30 +0000214AX_THRIFT_GEN(php, [PHP], yes)
215AM_CONDITIONAL([THRIFT_GEN_php], [test "$ax_thrift_gen_php" = "yes"])
David Reissf3b0db32009-02-17 20:28:01 +0000216AX_THRIFT_GEN(erl, [Erlang], yes)
217AM_CONDITIONAL([THRIFT_GEN_erl], [test "$ax_thrift_gen_erl" = "yes"])
David Reiss4b349aa2008-03-27 21:41:02 +0000218AX_THRIFT_GEN(cocoa, [Cocoa], yes)
219AM_CONDITIONAL([THRIFT_GEN_cocoa], [test "$ax_thrift_gen_cocoa" = "yes"])
David Reissb3ac8a62008-03-27 21:40:42 +0000220AX_THRIFT_GEN(st, [Smalltalk], yes)
221AM_CONDITIONAL([THRIFT_GEN_st], [test "$ax_thrift_gen_st" = "yes"])
David Reiss3d671b52008-03-27 21:40:11 +0000222AX_THRIFT_GEN(ocaml, [OCaml], yes)
223AM_CONDITIONAL([THRIFT_GEN_ocaml], [test "$ax_thrift_gen_ocaml" = "yes"])
David Reiss22812f82008-03-27 21:40:26 +0000224AX_THRIFT_GEN(hs, [Haskell], yes)
225AM_CONDITIONAL([THRIFT_GEN_hs], [test "$ax_thrift_gen_hs" = "yes"])
David Reiss782cb672009-02-17 20:28:13 +0000226AX_THRIFT_GEN(xsd, [XSD], yes)
227AM_CONDITIONAL([THRIFT_GEN_xsd], [test "$ax_thrift_gen_xsd" = "yes"])
David Reissdc0aada2008-10-21 00:09:23 +0000228AX_THRIFT_GEN(html, [HTML], yes)
229AM_CONDITIONAL([THRIFT_GEN_html], [test "$ax_thrift_gen_html" = "yes"])
David Reiss22585732008-02-27 01:55:33 +0000230
David Reiss832b2622007-12-28 18:25:33 +0000231AC_CONFIG_HEADERS(config.h:config.hin)
232
233AC_CONFIG_FILES([
234 Makefile
235 compiler/cpp/Makefile
236 lib/Makefile
237 lib/cpp/Makefile
238 lib/cpp/thrift.pc
239 lib/cpp/thrift-nb.pc
240 lib/cpp/thrift-z.pc
David Reiss1fdb5922008-02-06 22:10:12 +0000241 lib/csharp/Makefile
David Reissf8dcf032008-02-23 22:07:39 +0000242 lib/java/Makefile
T Jake Luciani1952e542009-02-01 04:47:30 +0000243 lib/perl/Makefile
244 lib/perl/test/Makefile
David Reiss832b2622007-12-28 18:25:33 +0000245 lib/py/Makefile
Kevin Clark4bd89162008-07-08 00:47:49 +0000246 lib/rb/Makefile
David Reiss8180c0c2008-02-04 21:14:14 +0000247 test/Makefile
David Reiss9ff3b9d2008-02-15 01:10:23 +0000248 test/py/Makefile
Kevin Clark4bd89162008-07-08 00:47:49 +0000249 test/rb/Makefile
David Reiss832b2622007-12-28 18:25:33 +0000250])
Marc Slemkob09f5882006-08-23 22:03:34 +0000251
252AC_OUTPUT