blob: 895175040c498b0d9bb7ecac5c3172b787812939 [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
David Reissfff84d12009-05-22 19:50:33 +000080 AC_SUBST(CLASSPATH)
David Reiss4ca0c8e2009-05-12 23:16:55 +000081 AC_SUBST(ANT_FLAGS)
David Reiss62d39812008-03-02 07:00:22 +000082fi
David Reiss82c1bab2008-06-11 01:16:53 +000083AM_CONDITIONAL([WITH_JAVA],
David Reissf8dcf032008-02-23 22:07:39 +000084 [test -n "$ANT" -a -n "$JAVA" -a -n "$JAVAC"])
David Reiss1fdb5922008-02-06 22:10:12 +000085
Christopher Pirob6f18c22008-03-04 07:09:12 +000086AX_THRIFT_LIB(erlang, [Erlang], yes)
87if test "$with_erlang" = "yes"; then
88 AC_PATH_PROG([ERLC], [erlc])
89fi
David Reiss82c1bab2008-06-11 01:16:53 +000090AM_CONDITIONAL(WITH_ERLANG, [test -n "$ERLC"])
Christopher Pirob6f18c22008-03-04 07:09:12 +000091
David Reiss1a140912008-06-11 01:16:37 +000092AX_THRIFT_LIB(py, [Python], yes)
93if test "$with_py" = "yes"; then
94 AM_PATH_PYTHON(2.4,, :)
95fi
David Reiss82c1bab2008-06-11 01:16:53 +000096AM_CONDITIONAL(WITH_PYTHON, [test -n "$PYTHON" -a "$PYTHON" != ":"])
David Reiss1a140912008-06-11 01:16:37 +000097
T Jake Luciani1952e542009-02-01 04:47:30 +000098AX_THRIFT_LIB(perl, [Perl], yes)
99if test "$with_perl" = "yes"; then
100 AC_PATH_PROG([PERL], [perl])
101fi
102AM_CONDITIONAL(WITH_PERL, [test -n "$PERL"])
103
Kevin Clark4bd89162008-07-08 00:47:49 +0000104AX_THRIFT_LIB(ruby, [Ruby], yes)
105if test "$with_ruby" = "yes"; then
106 AC_PATH_PROG([RUBY], [ruby])
Bryan Duxburyec473582009-04-07 16:31:04 +0000107 AC_PATH_PROG([RSPEC], [spec])
Kevin Clark4bd89162008-07-08 00:47:49 +0000108fi
David Reiss8d07e1d2008-07-11 08:04:12 +0000109AM_CONDITIONAL(WITH_RUBY, [test -n "$RUBY"])
Bryan Duxburyec473582009-04-07 16:31:04 +0000110AM_CONDITIONAL(HAVE_RSPEC, [test -n "$RSPEC"])
111
Kevin Clark4bd89162008-07-08 00:47:49 +0000112
David Reiss832b2622007-12-28 18:25:33 +0000113AC_C_CONST
114AC_C_INLINE
115AC_C_VOLATILE
116
117AC_HEADER_STDBOOL
118AC_HEADER_STDC
119AC_HEADER_TIME
120AC_CHECK_HEADERS([arpa/inet.h])
121AC_CHECK_HEADERS([endian.h])
122AC_CHECK_HEADERS([fcntl.h])
123AC_CHECK_HEADERS([inttypes.h])
David Reiss7ed4b982008-02-11 23:24:47 +0000124AC_CHECK_HEADERS([limits.h])
David Reiss832b2622007-12-28 18:25:33 +0000125AC_CHECK_HEADERS([netdb.h])
126AC_CHECK_HEADERS([netinet/in.h])
127AC_CHECK_HEADERS([pthread.h])
128AC_CHECK_HEADERS([stddef.h])
David Reissd7a16f42008-02-19 22:47:29 +0000129AC_CHECK_HEADERS([stdlib.h])
David Reiss832b2622007-12-28 18:25:33 +0000130AC_CHECK_HEADERS([sys/socket.h])
131AC_CHECK_HEADERS([sys/time.h])
132AC_CHECK_HEADERS([unistd.h])
133AC_CHECK_HEADERS([libintl.h])
134AC_CHECK_HEADERS([malloc.h])
135
136AC_CHECK_LIB(pthread, pthread_create)
David Reisse4ca1792009-05-21 02:28:19 +0000137dnl NOTE(dreiss): I haven't been able to find any really solid docs
138dnl on what librt is and how it fits into various Unix systems.
139dnl My best guess is that it is where glibc stashes its implementation
140dnl of the POSIX Real-Time Extensions. This seems necessary on Linux,
141dnl and we haven't yet found a system where this is a problem.
142AC_CHECK_LIB(rt, clock_gettime)
David Reiss832b2622007-12-28 18:25:33 +0000143
144AC_TYPE_INT16_T
145AC_TYPE_INT32_T
146AC_TYPE_INT64_T
147AC_TYPE_INT8_T
148AC_TYPE_MODE_T
149AC_TYPE_OFF_T
150AC_TYPE_SIZE_T
David Reiss847a2942008-04-21 18:07:43 +0000151AC_TYPE_SSIZE_T
David Reiss832b2622007-12-28 18:25:33 +0000152AC_TYPE_UINT16_T
153AC_TYPE_UINT32_T
154AC_TYPE_UINT64_T
155AC_TYPE_UINT8_T
David Reiss33fc5ad2008-05-09 07:17:34 +0000156AC_CHECK_TYPES([ptrdiff_t], [], [exit 1])
David Reiss832b2622007-12-28 18:25:33 +0000157
David Reiss7ed4b982008-02-11 23:24:47 +0000158AC_STRUCT_TM
159
David Reiss85a8f7b2009-05-21 02:28:16 +0000160dnl NOTE(dreiss): AI_ADDRCONFIG is not defined on OpenBSD.
161AC_CHECK_DECL([AI_ADDRCONFIG], [],
162 [AC_DEFINE([AI_ADDRCONFIG], 0,
163 [Define if the AI_ADDRCONFIG symbol is unavailable])],
164 [
165 #include <sys/types.h>
166 #include <sys/socket.h>
167 #include <netdb.h>
168])
169
David Reiss832b2622007-12-28 18:25:33 +0000170AC_FUNC_ALLOCA
171AC_FUNC_MALLOC
David Reiss7ed4b982008-02-11 23:24:47 +0000172AC_FUNC_MEMCMP
David Reiss832b2622007-12-28 18:25:33 +0000173AC_FUNC_REALLOC
174AC_FUNC_SELECT_ARGTYPES
175AC_FUNC_STAT
176AC_FUNC_STRERROR_R
David Reiss7ed4b982008-02-11 23:24:47 +0000177AC_FUNC_STRFTIME
David Reiss832b2622007-12-28 18:25:33 +0000178AC_FUNC_VPRINTF
179AC_CHECK_FUNCS([strtoul])
180AC_CHECK_FUNCS([bzero])
David Reiss7ed4b982008-02-11 23:24:47 +0000181AC_CHECK_FUNCS([ftruncate])
David Reiss832b2622007-12-28 18:25:33 +0000182AC_CHECK_FUNCS([gethostbyname])
183AC_CHECK_FUNCS([gettimeofday])
184AC_CHECK_FUNCS([memmove])
185AC_CHECK_FUNCS([memset])
186AC_CHECK_FUNCS([mkdir])
187AC_CHECK_FUNCS([realpath])
188AC_CHECK_FUNCS([select])
189AC_CHECK_FUNCS([socket])
190AC_CHECK_FUNCS([strchr])
191AC_CHECK_FUNCS([strdup])
David Reiss7ed4b982008-02-11 23:24:47 +0000192AC_CHECK_FUNCS([strerror])
David Reiss832b2622007-12-28 18:25:33 +0000193AC_CHECK_FUNCS([strstr])
194AC_CHECK_FUNCS([strtol])
195AC_CHECK_FUNCS([sqrt])
David Reisse4ca1792009-05-21 02:28:19 +0000196dnl The following functions are optional.
197AC_CHECK_FUNCS([clock_gettime])
198AC_CHECK_FUNCS([sched_get_priority_min])
199AC_CHECK_FUNCS([sched_get_priority_max])
David Reiss832b2622007-12-28 18:25:33 +0000200
David Reisse4d4ea02009-04-02 21:37:17 +0000201AX_SIGNED_RIGHT_SHIFT
202
David Reiss22585732008-02-27 01:55:33 +0000203AX_THRIFT_GEN(cpp, [C++], yes)
204AM_CONDITIONAL([THRIFT_GEN_cpp], [test "$ax_thrift_gen_cpp" = "yes"])
David Reisse8a87de2008-02-27 02:39:25 +0000205AX_THRIFT_GEN(java, [Java], yes)
206AM_CONDITIONAL([THRIFT_GEN_java], [test "$ax_thrift_gen_java" = "yes"])
David Reissce4f4f02008-03-27 21:41:31 +0000207AX_THRIFT_GEN(csharp, [C#], yes)
208AM_CONDITIONAL([THRIFT_GEN_csharp], [test "$ax_thrift_gen_csharp" = "yes"])
David Reissbfd26dc2008-03-27 21:41:49 +0000209AX_THRIFT_GEN(py, [Python], yes)
210AM_CONDITIONAL([THRIFT_GEN_py], [test "$ax_thrift_gen_py" = "yes"])
David Reissae253582008-03-27 21:42:11 +0000211AX_THRIFT_GEN(rb, [Ruby], yes)
212AM_CONDITIONAL([THRIFT_GEN_rb], [test "$ax_thrift_gen_rb" = "yes"])
David Reissfdc21aa2008-03-27 21:42:34 +0000213AX_THRIFT_GEN(perl, [Perl], yes)
214AM_CONDITIONAL([THRIFT_GEN_perl], [test "$ax_thrift_gen_perl" = "yes"])
David Reiss32272d92009-02-17 20:28:30 +0000215AX_THRIFT_GEN(php, [PHP], yes)
216AM_CONDITIONAL([THRIFT_GEN_php], [test "$ax_thrift_gen_php" = "yes"])
David Reissf3b0db32009-02-17 20:28:01 +0000217AX_THRIFT_GEN(erl, [Erlang], yes)
218AM_CONDITIONAL([THRIFT_GEN_erl], [test "$ax_thrift_gen_erl" = "yes"])
David Reiss4b349aa2008-03-27 21:41:02 +0000219AX_THRIFT_GEN(cocoa, [Cocoa], yes)
220AM_CONDITIONAL([THRIFT_GEN_cocoa], [test "$ax_thrift_gen_cocoa" = "yes"])
David Reissb3ac8a62008-03-27 21:40:42 +0000221AX_THRIFT_GEN(st, [Smalltalk], yes)
222AM_CONDITIONAL([THRIFT_GEN_st], [test "$ax_thrift_gen_st" = "yes"])
David Reiss3d671b52008-03-27 21:40:11 +0000223AX_THRIFT_GEN(ocaml, [OCaml], yes)
224AM_CONDITIONAL([THRIFT_GEN_ocaml], [test "$ax_thrift_gen_ocaml" = "yes"])
David Reiss22812f82008-03-27 21:40:26 +0000225AX_THRIFT_GEN(hs, [Haskell], yes)
226AM_CONDITIONAL([THRIFT_GEN_hs], [test "$ax_thrift_gen_hs" = "yes"])
David Reiss782cb672009-02-17 20:28:13 +0000227AX_THRIFT_GEN(xsd, [XSD], yes)
228AM_CONDITIONAL([THRIFT_GEN_xsd], [test "$ax_thrift_gen_xsd" = "yes"])
David Reissdc0aada2008-10-21 00:09:23 +0000229AX_THRIFT_GEN(html, [HTML], yes)
230AM_CONDITIONAL([THRIFT_GEN_html], [test "$ax_thrift_gen_html" = "yes"])
David Reiss22585732008-02-27 01:55:33 +0000231
David Reiss832b2622007-12-28 18:25:33 +0000232AC_CONFIG_HEADERS(config.h:config.hin)
233
234AC_CONFIG_FILES([
235 Makefile
236 compiler/cpp/Makefile
237 lib/Makefile
238 lib/cpp/Makefile
239 lib/cpp/thrift.pc
240 lib/cpp/thrift-nb.pc
241 lib/cpp/thrift-z.pc
David Reiss1fdb5922008-02-06 22:10:12 +0000242 lib/csharp/Makefile
David Reissf8dcf032008-02-23 22:07:39 +0000243 lib/java/Makefile
T Jake Luciani1952e542009-02-01 04:47:30 +0000244 lib/perl/Makefile
245 lib/perl/test/Makefile
David Reiss832b2622007-12-28 18:25:33 +0000246 lib/py/Makefile
Kevin Clark4bd89162008-07-08 00:47:49 +0000247 lib/rb/Makefile
David Reiss8180c0c2008-02-04 21:14:14 +0000248 test/Makefile
David Reiss9ff3b9d2008-02-15 01:10:23 +0000249 test/py/Makefile
Kevin Clark4bd89162008-07-08 00:47:49 +0000250 test/rb/Makefile
David Reiss832b2622007-12-28 18:25:33 +0000251])
Marc Slemkob09f5882006-08-23 22:03:34 +0000252
253AC_OUTPUT