comparison src/capnproto-git-20161025/c++/configure.ac @ 133:1ac99bfc383d

Add Cap'n Proto source
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 25 Oct 2016 11:17:01 +0100
parents
children
comparison
equal deleted inserted replaced
132:42a73082be24 133:1ac99bfc383d
1 ## Process this file with autoconf to produce configure.
2
3 AC_INIT([Capn Proto],[0.6-dev],[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 AC_SUBST(PTHREAD_LIBS)
61 AC_SUBST(PTHREAD_CFLAGS)
62 AC_SUBST(PTHREAD_CC)
63 ], *, [
64 ACX_PTHREAD
65 ])
66
67 LT_INIT
68
69 AS_IF([test "$external_capnp" != "no"], [
70 AS_IF([test "x$CAPNP" = "x"], [CAPNP="capnp"], [with_capnp=yes])
71 AS_IF([test "x$CAPNPC_CXX" = "x"], [
72 # CAPNPC_CXX was not specified. Choose a reasonable default.
73 AS_CASE([$CAPNP], [*/*], [
74 # $CAPNP contains a slash, so it's not on $PATH. Assume capnpc-c++ is not either, but is
75 # in the same directory.
76 CAPNPC_CXX=`dirname $CAPNP`/capnpc-c++
77 ], [
78 # $CAPNP is on $PATH, so tell it to find the plugin on $PATH as well.
79 CAPNPC_CXX="c++"
80 ])
81 ])
82 AC_SUBST([CAPNP])
83 AC_SUBST([CAPNPC_CXX])
84 ])
85 AM_CONDITIONAL([USE_EXTERNAL_CAPNP], [test "$external_capnp" != "no"])
86
87 AM_CONDITIONAL([LITE_MODE], [test "$lite_mode" = "yes"])
88
89 AS_IF([test "$lite_mode" = "yes"], [
90 CXXFLAGS="-DCAPNP_LITE $CXXFLAGS"
91 CAPNP_LITE_FLAG=-DCAPNP_LITE
92 ])
93 AC_SUBST([CAPNP_LITE_FLAG])
94
95 AC_SEARCH_LIBS(sched_yield, rt)
96
97 # Users will need to use the same -stdlib as us so we'd better let pkg-config know about it.
98 STDLIB_FLAG=`echo "$CXX $CXXFLAGS" | grep -o ' [[-]]stdlib=[[^ ]]*'`
99 AC_SUBST([STDLIB_FLAG])
100
101 LIBS="$PTHREAD_LIBS $LIBS"
102 CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
103
104 AC_CONFIG_FILES([Makefile capnp.pc capnp-rpc.pc capnp-json.pc kj.pc kj-async.pc])
105 AC_OUTPUT