comparison src/capnproto-0.6.0/c++/configure.ac @ 147:45360b968bf4

Cap'n Proto v0.6 + build for OSX
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 22 May 2017 10:01:37 +0100
parents
children
comparison
equal deleted inserted replaced
146:206f0eb279b8 147:45360b968bf4
1 ## Process this file with autoconf to produce configure.
2
3 AC_INIT([Capn Proto],[0.6.0],[capnproto@googlegroups.com],[capnproto-c++])
4
5 AC_CONFIG_SRCDIR([src/capnp/layout.c++])
6 AC_CONFIG_AUX_DIR([build-aux])
7 AC_CONFIG_HEADERS([config.h])
8 AC_CONFIG_MACRO_DIR([m4])
9
10 # autoconf's default CXXFLAGS are usually "-g -O2". A far more reasonable
11 # default is -O2 -NDEBUG.
12 AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
13 [CFLAGS="-O2 -DNDEBUG"])
14 AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
15 [CXXFLAGS="-O2 -DNDEBUG"])
16
17 AM_INIT_AUTOMAKE([tar-ustar])
18
19 AC_ARG_WITH([external-capnp],
20 [AS_HELP_STRING([--with-external-capnp],
21 [use the system capnp binary (or the one specified with $CAPNP) instead of compiling a new
22 one (useful for cross-compiling)])],
23 [external_capnp=yes],[external_capnp=no])
24
25 AC_ARG_ENABLE([reflection], [
26 AS_HELP_STRING([--disable-reflection], [
27 compile Cap'n Proto in "lite mode", in which all reflection APIs (schema.h, dynamic.h, etc.)
28 are not included. Produces a smaller library at the cost of features. All programs built
29 against the library MUST be compiled with -DCAPNP_LITE=1. Note that because the compiler
30 itself uses reflection in its implementation, you must also use --with-external-capnp when
31 using this option.])
32 ], [
33 case "${enableval}" in
34 yes)
35 lite_mode=no
36 ;;
37 no)
38 lite_mode=yes
39 AS_IF([test "$external_capnp" != "yes"], [
40 AC_MSG_ERROR([you must specify --with-external-capnp when using --disable-reflection])
41 ])
42 ;;
43 *)
44 AC_MSG_ERROR([bad value ${enableval} for --enable-reflection])
45 ;;
46 esac
47 ], [lite_mode=no])
48
49 # Checks for programs.
50 AC_PROG_CC
51 AC_PROG_CXX
52 AC_LANG([C++])
53 AX_CXX_COMPILE_STDCXX_11
54
55 AS_CASE("${host_os}", *mingw*, [
56 # We don't use pthreads on MinGW.
57 PTHREAD_CFLAGS="-mthreads"
58 PTHREAD_LIBS=""
59 PTHREAD_CC=""
60 ASYNC_LIBS="-lws2_32"
61 AC_SUBST(PTHREAD_LIBS)
62 AC_SUBST(PTHREAD_CFLAGS)
63 AC_SUBST(PTHREAD_CC)
64 AC_SUBST(ASYNC_LIBS)
65 ], *, [
66 ACX_PTHREAD
67 ASYNC_LIBS=""
68 AC_SUBST(ASYNC_LIBS)
69 ])
70
71 LT_INIT
72
73 AS_IF([test "$external_capnp" != "no"], [
74 AS_IF([test "x$CAPNP" = "x"], [CAPNP="capnp"], [with_capnp=yes])
75 AS_IF([test "x$CAPNPC_CXX" = "x"], [
76 # CAPNPC_CXX was not specified. Choose a reasonable default.
77 AS_CASE([$CAPNP], [*/*], [
78 # $CAPNP contains a slash, so it's not on $PATH. Assume capnpc-c++ is not either, but is
79 # in the same directory.
80 CAPNPC_CXX=`dirname $CAPNP`/capnpc-c++
81 ], [
82 # $CAPNP is on $PATH, so tell it to find the plugin on $PATH as well.
83 CAPNPC_CXX="c++"
84 ])
85 ])
86 AC_SUBST([CAPNP])
87 AC_SUBST([CAPNPC_CXX])
88 ])
89 AM_CONDITIONAL([USE_EXTERNAL_CAPNP], [test "$external_capnp" != "no"])
90
91 AM_CONDITIONAL([LITE_MODE], [test "$lite_mode" = "yes"])
92
93 AS_IF([test "$lite_mode" = "yes"], [
94 CXXFLAGS="-DCAPNP_LITE $CXXFLAGS"
95 CAPNP_LITE_FLAG=-DCAPNP_LITE
96 ])
97 AC_SUBST([CAPNP_LITE_FLAG])
98
99 AC_SEARCH_LIBS(sched_yield, rt)
100
101 # Users will need to use the same -stdlib as us so we'd better let pkg-config know about it.
102 STDLIB_FLAG=`echo "$CXX $CXXFLAGS" | grep -o ' [[-]]stdlib=[[^ ]]*'`
103 AC_SUBST([STDLIB_FLAG])
104
105 LIBS="$PTHREAD_LIBS $LIBS"
106 CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
107
108 AC_CONFIG_FILES([Makefile capnp.pc capnp-rpc.pc capnp-json.pc kj.pc kj-async.pc])
109 AC_OUTPUT