forked from maekitalo/tntnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
239 lines (199 loc) · 6.41 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
AC_INIT(tntnet, 2.3rc1, [Tommi Maekitalo <tommi@tntnet.org>])
AC_CANONICAL_TARGET
LT_INIT([disable-static])
AM_INIT_AUTOMAKE
abi_current=13
abi_revision=0
abi_age=0
sonumber=${abi_current}:${abi_revision}:${abi_age}
AC_SUBST(sonumber)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([framework/common/config.h])
AC_CONFIG_SRCDIR([framework/common/tntnet.cpp])
AC_SEARCH_LIBS(gethostbyname, nsl socket resolv)
AC_SEARCH_LIBS(dlopen, dl, , AC_MSG_ERROR([dlopen not found]))
AC_PROG_CXX
AC_PROG_SED
AC_LANG(C++)
AX_CXX_COMPILE_STDCXX_11(noext, optional)
ACX_PTHREAD
LIBS="$PTHREAD_LIBS $LIBS"
CC="$PTHREAD_CC"
CXX="$PTHREAD_CXX"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CXXFLAGS"
AX_COMPILER_VENDOR
AS_IF([test "$ax_cv_cxx_compiler_vendor" = "ibm"],
[CPPFLAGS="$CPPFLAGS -qrtti -qlanglvl=newexcp -D__NOLOCK_ON_INPUT -D__NOLOCK_ON_OUTPUT"],
AX_CHECK_COMPILE_FLAG([-Wno-long-long], [CPPFLAGS="$CPPFLAGS -Wno-long-long"])
AX_CHECK_COMPILE_FLAG([-Wall], [CPPFLAGS="$CPPFLAGS -Wall"])
AX_CHECK_COMPILE_FLAG([-pedantic], [CPPFLAGS="$CPPFLAGS -pedantic"]))
AC_CHECK_HEADER([zlib.h], , AC_MSG_ERROR([zlib not found]))
AC_CHECK_HEADER([cxxtools/net/tcpsocket.h], , AC_MSG_ERROR([cxxtools headers not found]))
AC_CHECK_FUNCS([fopen64], ,[AM_CFLAGS=-DUSE_FILE32API])
AC_SUBST(AM_CFLAGS)
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([
#include <cxxtools/xml/xmldeserializer.h>
void f()
{
cxxtools::xml::XmlDeserializer d;
d.readAttributes(true);
}])], AC_DEFINE(CXXTOOLS_XMLDESERIALISER_ATTR, [], [Defined if cxxtools xmldeserializer can read attributes]))
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([
#include <cxxtools/net/tcpserver.h>
int flag = cxxtools::net::TcpServer::REUSEADDR;
])], AC_DEFINE(HAVE_CXXTOOLS_REUSEADDR, [], [Defined if cxxtools supports SO_REUSEADDR flag]))
AC_ARG_WITH([epoll],
AS_HELP_STRING([--with-epoll=yes|no|probe], [use epoll]),
[epoll_option=$withval],
[epoll_option=probe])
AS_CASE([$epoll_option],
[yes], AC_DEFINE(WITH_EPOLL, [], [Define if epoll is supported]),
[no], [],
[probe], AC_TRY_RUN([
#include <sys/epoll.h>
int main() { return epoll_create(10) <= 0; }
],
[AC_DEFINE(WITH_EPOLL, [], [Define if epoll is supported])]),
AC_MSG_ERROR([unknown epoll-value $epoll_option])
)
AC_ARG_WITH([sendfile],
AS_HELP_STRING([--with-sendfile=yes|no|probe], [use sendfile]),
[sendfile_option=$withval],
[sendfile_option=probe])
AS_CASE([$sendfile_option],
[yes], AC_DEFINE(WITH_SENDFILE, [], [Define if sendfile is supported]),
[no], [],
[probe], AC_CHECK_FUNCS([sendfile]),
AC_MSG_ERROR([unknown sendfile-value $sendfile_option])
)
AC_CHECK_HEADERS([sys/sendfile.h])
#
# SSL
#
AC_ARG_WITH([ssl],
AS_HELP_STRING([--with-ssl=gnutls|openssl|no], [build with SSL support (default is openssl)]),
[ssl_option=$withval],
[ssl_option=openssl])
AS_CASE([$ssl_option],
[gnutls],
[PKG_CHECK_MODULES([GNUTLS], [gnutls >= 2.11], [
AC_MSG_RESULT([building with GnuTLS support])
AC_DEFINE(WITH_GNUTLS, [], [Define to build with gnutls])
with_gnutls=1
],
[AC_MSG_ERROR(gnutls >= 2.11 not not found)])
],
[openssl|yes],
[AC_CHECK_HEADER([openssl/ssl.h], [
AC_MSG_RESULT([building with OpenSSL support])
AC_DEFINE(WITH_OPENSSL, [], [Define to build with openssl])
with_openssl=1
],
[AC_MSG_ERROR(openssl-headers not not found)])
],
[no],
[AC_MSG_RESULT([building without ssl support])
],
[AC_MSG_ERROR([unknown ssl-value $ssl_option])]
)
AM_CONDITIONAL(MAKE_GNUTLS, test x$with_gnutls = x1)
AM_CONDITIONAL(MAKE_OPENSSL, test x$with_openssl = x1)
#
# optional components
#
AC_ARG_ENABLE([server],
AS_HELP_STRING([--disable-server], [disable building tntnet server]),
[enable_server=$enableval],
[enable_server=yes])
AM_CONDITIONAL(MAKE_SERVER, test x$enable_server = xyes)
AC_ARG_ENABLE([sdk],
AS_HELP_STRING([--disable-sdk], [disable building sdk]),
[enable_sdk=$enableval],
[enable_sdk=yes])
AM_CONDITIONAL(MAKE_SDK, test x$enable_sdk = xyes)
AC_ARG_ENABLE([demos],
AS_HELP_STRING([--enable-demos], [enable building demos]),
[enable_demos=$enableval],
[enable_demos=no])
AM_CONDITIONAL(MAKE_DEMOS, test "$enable_demos" = "yes" -o "$enable_demos" = "install")
AM_CONDITIONAL(INSTALL_DEMOS, test "$enable_demos" = "install")
AS_IF([test "$enable_demos" = "yes"],
[
AS_IF([test "$enable_sdk" != "yes"],
[AC_MSG_ERROR([demos cannot be built without building sdk])])
AC_CHECK_PROG(ZIP, zip, 1)
AS_IF([! test "$ZIP"],
AC_MSG_ERROR([zip program not found (needed for calci18n demo)]))
AC_CHECK_HEADER([gd.h], , AC_MSG_ERROR([gd headers not found]))
AC_CHECK_HEADER([tntdb.h], , AC_MSG_ERROR([tntdb headers not found]))
]
)
#
# others
#
AC_CHECK_FUNCS([setenv])
case "${host_cpu}-${host_os}" in
*-aix*)
SHARED_LIB_FLAG=-qmkshrobj
;;
*-darwin*)
SHARED_LIB_FLAG=-dynamiclib
;;
*)
SHARED_LIB_FLAG=-shared
;;
esac
AC_SUBST(SHARED_LIB_FLAG)
AC_ARG_ENABLE([unittest],
AS_HELP_STRING([--disable-unittest], [disable unittest]),
[enable_unittest=$enableval],
[enable_unittest=enable_unittest])
AM_CONDITIONAL(MAKE_UNITTEST, test "$enable_unittest" = "enable_unittest")
AC_ARG_ENABLE([locale],
AS_HELP_STRING([--disable-locale], [disable support for locales]),
[enable_locale=$enableval],
[enable_locale=enable_locale])
if test "$enable_locale" != "no"
then
AC_DEFINE(ENABLE_LOCALE, [], [Defined if locale is used])
fi
AC_CONFIG_FILES([misc/tntnet-project], [chmod +x misc/tntnet-project])
AC_CONFIG_FILES([
Makefile
demo/Makefile
demo/accumulator/Makefile
demo/calc/Makefile
demo/calcajax/Makefile
demo/calcapp/Makefile
demo/calci18n/Makefile
demo/calcmvc/Makefile
demo/chat/Makefile
demo/comp/Makefile
demo/config/Makefile
demo/cookie/Makefile
demo/gd/Makefile
demo/hello/Makefile
demo/mvc/Makefile
demo/newsdb/Makefile
demo/rest/Makefile
demo/savepoint/Makefile
demo/session/Makefile
demo/upload/Makefile
doc/man/Makefile
etc/Makefile
framework/common/Makefile
framework/runtime/Makefile
framework/defcomp/Makefile
misc/Makefile
pkgconfig/tntnet.pc
pkgconfig/tntnet_sdk.pc
sdk/tools/common/Makefile
sdk/tools/ecppc/Makefile
sdk/tools/ecppl/Makefile
sdk/tools/ecppll/Makefile
test/Makefile
])
AC_OUTPUT