Eclipse C++ projects added to repository
[public/netxms.git] / configure.ac
CommitLineData
8e76f8aa 1# $Id$
d16cf8a5 2#
ef0c727b
VK
3# NetXMS - Network Management System
4# Configure script
d16cf8a5
AK
5#
6
a7a4c1e9 7AC_INIT([NetXMS], [2.0-RC2], [bugs@netxms.org])
ba1d810c 8AC_CONFIG_AUX_DIR(config)
8e7f84bf 9AC_CONFIG_HEADERS(config.h)
d16cf8a5 10AM_INIT_AUTOMAKE
09867021 11m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
d16cf8a5 12
aa24418a 13AC_CONFIG_MACRO_DIR([m4])
5387ff75 14
ef0c727b
VK
15#--------------------------------------------------------------------
16# Functions
17#--------------------------------------------------------------------
5387ff75 18
ef0c727b
VK
19check_substr()
20{
1010cff7 21 for w in $1; do
ef0c727b
VK
22 if test "x$w" = "x$2"; then
23 return 0;
24 fi
25 done
26 return 1
27}
16dff090 28
b535eed6
VK
29find_existing_dir()
30{
31 for d in "$@"; do
32 if test -d "$d"; then
33 __dir="$d"
34 return 0;
35 fi
36 done
37 return 1
38}
39
d3c8926d 40
ef0c727b
VK
41#--------------------------------------------------------------------
42# Initialize variables
43#--------------------------------------------------------------------
d3c8926d 44
ef0c727b 45PLATFORM=`uname -s`
c3900dbb 46CPUTYPE=`uname -p`
ef0c727b
VK
47COMPONENTS=""
48DISABLE_ICONV="no"
49DISABLE_ENCRYPTION="no"
4050bafb 50DISABLE_LMSENSORS="no"
f974a50a 51ENABLE_DEBUG="no"
25ae8377 52ENABLE_WERROR="no"
ef0c727b 53STATIC_BUILD="no"
c1165d33 54ALL_STATIC="no"
ef0c727b
VK
55DBDRIVER_SELECTED="no"
56USE_PTH="no"
57BUILD_SERVER="no"
58BUILD_AGENT="no"
59BUILD_CLIENT="no"
ef0c727b 60BUILD_STATIC_AGENT="no"
447350a9 61BUILD_SDK="no"
ef0c727b 62NEED_ZLIB="no"
f65df2b1 63MODULES="libnetxms tools install"
ef0c727b 64STATIC_SUBAGENT_LIST=""
c1165d33 65PROPOSED_STATIC_SUBAGENTS="default"
ef0c727b
VK
66SUBAGENT_DIRS=""
67SUBAGENT_LIBS=""
7c48e2aa 68SERVER_LIBS=""
ef0c727b 69SERVER_TOOLS=""
7dda4453 70SERVER_INCLUDE=""
31b0f68b 71SMSDRV_DIRS=""
6fad8870 72HDLINK_DIRS=""
52a2232c 73PDSDRV_DIRS=""
ef0c727b
VK
74TOP_LEVEL_MODULES=""
75CONTRIB_MODULES=""
c2612d83 76CLIENT_COMPONENTS=""
8b86c5dc 77BUILD_UNICODE="no"
467c489f 78FORCE_INTERNAL_EXPAT="no"
17b35ccc
VK
79USE_INTERNAL_LIBTRE="no"
80FORCE_INTERNAL_LIBTRE="no"
f5393033 81FORCE_INTERNAL_JANSSON="no"
1fd41bcd 82FORCE_INTERNAL_ZLIB="no"
cc297a70 83FORCE_32BIT_BUILD="no"
df9812a9 84FORCE_INTERNAL_GETOPT="no"
545bda2d
VK
85LDFLAGS_PREFIX=""
86LDFLAGS_SUFFIX=""
1ef5e57a
VK
87LTINIT_CC=""
88LTINIT_CXX=""
9113e749 89SQLFLAGS=""
a5a95ac8 90RUNTIME_PREFIX=""
6dde8627 91HPUX_HPPA="no"
058bf6fc 92XMPP_SUPPORT="yes"
2cfe4482 93LDAP_SUPPORT="yes"
65834be3 94DISABLE_READLINE="no"
6d14d0b0 95TUXEDO_LIBS=""
d6235717 96MONGODB_LIBS=""
b8adb0f2
VK
97DISABLE_IPV6="no"
98IPV6_SUPPORT="no"
b5e5849b 99INSTALL_LIBPATH=""
d3c8926d 100
16dff090 101
ef0c727b 102#--------------------------------------------------------------------
fecf6a2b
VK
103# Common compilation flags
104#--------------------------------------------------------------------
105
842c22f4 106CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DTRE_WCHAR=1"
fecf6a2b
VK
107
108
109#--------------------------------------------------------------------
ef0c727b
VK
110# Parse command line parameters
111#--------------------------------------------------------------------
7c9c94a7 112
a5a95ac8 113AC_ARG_WITH(runtime-prefix,
125543aa 114[AS_HELP_STRING(--with-runtime-prefix=prefix,installation prefix to be used at run time)],
a5a95ac8
VK
115[
116 RUNTIME_PREFIX="$withval"
117])
118
ef0c727b
VK
119AC_ARG_WITH(server,
120[AS_HELP_STRING(--with-server,build server)],
121[
231b0aad 122 COMPONENTS="$COMPONENTS sqlite snmp server agent sqlite_drv"
c5c0f362
VK
123])
124
125AC_ARG_WITH(snmp,
126[AS_HELP_STRING(--with-snmp,build SNMP library and tools)],
127[
128 COMPONENTS="$COMPONENTS snmp"
ef0c727b 129])
7c9c94a7 130
ef0c727b
VK
131AC_ARG_WITH(client,
132[AS_HELP_STRING(--with-client,build client library and tools)],
133[
134 COMPONENTS="$COMPONENTS client"
135])
d16cf8a5 136
a7a03ffd
VK
137AC_ARG_WITH(client-proxy,
138[AS_HELP_STRING(--with-client-proxy,build client proxy)],
139[
140 COMPONENTS="$COMPONENTS client-proxy"
141])
142
c2612d83 143AC_ARG_WITH(agent,
ef0c727b
VK
144[AS_HELP_STRING(--with-agent,build agent)],
145[
231b0aad 146 COMPONENTS="$COMPONENTS sqlite snmp agent sqlite_drv"
ef0c727b 147])
d16cf8a5 148
ef0c727b
VK
149AC_ARG_WITH(static-agent,
150[AS_HELP_STRING(--with-static-agent,build statically linked agent)],
151[
231b0aad 152 COMPONENTS="$COMPONENTS sqlite snmp static-agent sqlite_drv"
fb12fd54
VK
153 FORCE_INTERNAL_EXPAT="yes"
154 FORCE_INTERNAL_LIBTRE="yes"
155 FORCE_INTERNAL_JANSSON="yes"
156 FORCE_INTERNAL_ZLIB="yes"
ef0c727b 157])
d16cf8a5 158
ef0c727b
VK
159AC_ARG_WITH(ipso-agent,
160[AS_HELP_STRING(--with-ipso-agent,build statically linked IPSO agent)],
161[
971abf4f 162 COMPONENTS="$COMPONENTS ipso-agent"
ef0c727b 163])
521d90e7 164
7dda4453
VK
165AC_ARG_WITH(sdk,
166[AS_HELP_STRING(--with-sdk,build and install files necessary for extension development)],
167[
b550188f 168 COMPONENTS="$COMPONENTS sqlite sdk"
7dda4453
VK
169 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES include"
170 SERVER_INCLUDE="include"
447350a9 171 BUILD_SDK="yes"
4671448c
VK
172])
173
174AC_ARG_WITH(static-sdk,
175[AS_HELP_STRING(--with-static-sdk,build and install files necessary for extension development (static libs only))],
176[
b550188f 177 COMPONENTS="$COMPONENTS sqlite sdk"
4671448c
VK
178 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES include"
179 SERVER_INCLUDE="include"
180 BUILD_SDK="yes"
181 STATIC_BUILD="yes"
7dda4453
VK
182])
183
ef0c727b
VK
184AC_ARG_WITH(mdebug,
185[AS_HELP_STRING(--with-mdebug,use debug version of memory allocation functions)],
186[
187 CPPFLAGS="$CPPFLAGS -DNETXMS_MEMORY_DEBUG"
188])
d16cf8a5 189
b82ad936
AK
190AC_ARG_WITH(profiler,
191[AS_HELP_STRING(--with-profiler,link with libprofiler from gperftools)],
192[
193 LDFLAGS="$LDFLAGS -lprofiler"
194])
195
467c489f
VK
196AC_ARG_WITH(internal-libexpat,
197[AS_HELP_STRING(--with-internal-libexpat,force use of bundled libexpat)],
198[
199 FORCE_INTERNAL_EXPAT="yes"
200])
201
17b35ccc
VK
202AC_ARG_WITH(internal-libtre,
203[AS_HELP_STRING(--with-internal-libtre,force use of bundled libtre)],
204[
205 FORCE_INTERNAL_LIBTRE="yes"
206])
207
f5393033
VK
208AC_ARG_WITH(internal-libjansson,
209[AS_HELP_STRING(--with-internal-libjansson,force use of bundled libjansson)],
210[
211 FORCE_INTERNAL_JANSSON="yes"
212])
213
1fd41bcd
VK
214AC_ARG_WITH(internal-zlib,
215[AS_HELP_STRING(--with-internal-zlib,force use of bundled zlib)],
216[
217 FORCE_INTERNAL_ZLIB="yes"
218])
219
df9812a9
VK
220AC_ARG_WITH(internal-getopt,
221[AS_HELP_STRING(--with-internal-getopt,force use of bundled getopt)],
222[
223 FORCE_INTERNAL_GETOPT="yes"
224])
225
c1165d33
VK
226AC_ARG_WITH(all-static,
227[AS_HELP_STRING(--with-all-static,use -all-static flag for linking executables)],
228[
229 ALL_STATIC="yes"
230])
231
232AC_ARG_WITH(static-subagents,
919e2dce 233[AS_HELP_STRING(--with-static-subagents-list,define list of static subagents (separated by spaces))],
c1165d33
VK
234[
235 PROPOSED_STATIC_SUBAGENTS="$withval"
236])
237
50e4bc8c
VK
238AC_ARG_WITH(jdk,
239[AS_HELP_STRING(--with-jdk,build Java-dependent components)],
240[ if test "x$withval" != "xno" ; then
241 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
242 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
243 LDFLAGS="$LDFLAGS -L${withval}/lib"
244 CPPFLAGS="$CPPFLAGS -I${withval}/include"
245 fi
246 COMPONENTS="$COMPONENTS java"
247fi ])
248
b14c3f22
VK
249AC_ARG_WITH(tuxedo,
250[AS_HELP_STRING(--with-tuxedo,build Tuxedo-dependent components)],
251[ if test "x$withval" != "xno" ; then
252 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
253 TUXEDO_BASE="$withval"
254 fi
255 COMPONENTS="$COMPONENTS tuxedo"
256fi ])
257
d6235717 258AC_ARG_WITH(mongodb,
259[AS_HELP_STRING(--with-mongodb,build MongoDB-dependent components)],
260[ if test "x$withval" != "xno" ; then
261 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
262 MONGODB_BASE="$withval"
263 fi
264 COMPONENTS="$COMPONENTS mongodb"
265fi ])
266
9486b324
VK
267AC_ARG_WITH(sqlite,
268[AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
269[ if test "x$withval" != "xno" ; then
8817f620 270 COMPONENTS="$COMPONENTS sqlite_drv"
ef0c727b 271 DBDRIVER_SELECTED="yes"
9486b324
VK
272fi ])
273
c4b88c3d
VK
274AC_ARG_WITH(odbc,
275[AS_HELP_STRING(--with-odbc,build ODBC database driver)],
276[ if test "x$withval" != "xno" ; then
277 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
2cfe4482
VK
278 ODBC_LD_RUN_PATH="${withval}/lib"
279 ODBC_LDFLAGS="-L${withval}/lib"
280 ODBC_CPPFLAGS="-I${withval}/include"
ef0c727b
VK
281 fi
282 COMPONENTS="$COMPONENTS odbc"
283 DBDRIVER_SELECTED="yes"
c4b88c3d
VK
284fi ])
285
ed77e726 286AC_ARG_WITH(oracle,
41b4790d
VK
287[AS_HELP_STRING(--with-oracle,build Oracle database driver)],
288[ if test "x$withval" != "xno" ; then
df5afcf1 289 ORABASE="$ORACLE_HOME"
41b4790d 290 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
df5afcf1
VK
291 ORABASE="$withval"
292 fi
293 if test "x$ORABASE" != "x"; then
06d9dfbc 294 if test -x "$ORABASE/lib" ; then
df5afcf1
VK
295 ORACLE_LD_RUN_PATH="${ORABASE}/lib"
296 ORACLE_LDFLAGS="-L${ORABASE}/lib"
7d8c91ef 297 else
df5afcf1
VK
298 ORACLE_LD_RUN_PATH="${ORABASE}"
299 ORACLE_LDFLAGS="-L${ORABASE}"
7d8c91ef 300 fi
06d9dfbc 301 if test -x "$ORABASE/include" ; then
df5afcf1 302 ORACLE_CPPFLAGS="-I${ORABASE}/include"
7d8c91ef 303 fi
06d9dfbc 304 if test -x "$ORABASE/sdk/include" ; then
df5afcf1 305 ORACLE_CPPFLAGS="-I${ORABASE}/sdk/include"
7d8c91ef 306 fi
06d9dfbc 307 if test -x "$ORABASE/rdbms/public" ; then
df5afcf1 308 ORACLE_CPPFLAGS="-I${ORABASE}/rdbms/public"
2f6e6064 309 fi
41b4790d
VK
310 fi
311 COMPONENTS="$COMPONENTS oracle"
312 DBDRIVER_SELECTED="yes"
313fi ])
314
d16cf8a5 315AC_ARG_WITH(mysql,
c4b88c3d 316[AS_HELP_STRING(--with-mysql,build MySQL database driver)],
d16cf8a5
AK
317[ if test "x$withval" != "xno" ; then
318 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
9f1ea006
VK
319 if find_existing_dir "${withval}/lib" "${withval}/lib/mysql" "${withval}/mysql/lib"; then
320 MYSQL_LD_RUN_PATH="$__dir$"
321 MYSQL_LDFLAGS="-L$__dir"
322 fi
323 if find_existing_dir "${withval}/include" "${withval}/include/mysql" "${withval}/mysql/include"; then
324 MYSQL_CPPFLAGS="-I$__dir"
325 fi
d16cf8a5 326 else
9f1ea006
VK
327 if find_existing_dir "/usr/local/mysql/lib" "/usr/local/mysql/lib/mysql" "/usr/lib64/mysql" "/usr/lib/mysql" "/usr/mysql/lib" "/usr/mysql/lib/mysql" "/usr/local/lib/mysql"; then
328 MYSQL_LD_RUN_PATH="$__dir$"
329 MYSQL_LDFLAGS="-L$__dir"
330 fi
331 if find_existing_dir "/usr/local/mysql/include" "/usr/include/mysql" "/usr/mysql/include" "/usr/local/include/mysql" "/usr/local/mysql/include/mysql" "/usr/mysql/include/mysql"; then
332 MYSQL_CPPFLAGS="-I$__dir"
333 fi
d16cf8a5 334 fi
ef0c727b
VK
335 COMPONENTS="$COMPONENTS mysql"
336 DBDRIVER_SELECTED="yes"
6693a1d0 337fi ])
d16cf8a5
AK
338
339AC_ARG_WITH(pgsql,
c4b88c3d 340[AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
d16cf8a5 341[ if test "x$withval" != "xno" ; then
6693a1d0 342 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
b535eed6
VK
343 if find_existing_dir "${withval}/lib" "${withval}/lib/pgsql" "${withval}/lib/postgresql" "${withval}/pgsql/lib" "${withval}/postgresql/lib"; then
344 PGSQL_LD_RUN_PATH="$__dir$"
345 PGSQL_LDFLAGS="-L$__dir"
346 fi
347 if find_existing_dir "${withval}/include" "${withval}/include/pgsql" "${withval}/include/postgresql" "${withval}/pgsql/include" "${withval}/postgresql/include"; then
348 PGSQL_CPPFLAGS="-I$__dir"
349 fi
6693a1d0 350 else
b535eed6
VK
351 if find_existing_dir "/usr/local/pgsql/lib" "/usr/local/pgsql/lib/pgsql" "/usr/lib64/pgsql" "/usr/lib/pgsql" "/usr/pgsql/lib" "/usr/pgsql/lib/pgsql" "/usr/local/lib/pgsql" "/usr/local/postgresql/lib" "/usr/local/postgresql/lib/postgresql" "/usr/lib/postgresql" "/usr/postgresql/lib" "/usr/postgresql/lib/postgresql" "/usr/local/lib/postgresql"; then
352 PGSQL_LD_RUN_PATH="$__dir$"
353 PGSQL_LDFLAGS="-L$__dir"
354 fi
355 if find_existing_dir "/usr/local/pgsql/include" "/usr/include/pgsql" "/usr/pgsql/include" "/usr/local/include/pgsql" "/usr/local/pgsql/include/pgsql" "/usr/pgsql/include/pgsql" "/usr/local/postgresql/include" "/usr/include/postgresql" "/usr/postgresql/include" "/usr/local/include/postgresql" "/usr/local/postgresql/include/postgresql" "/usr/postgresql/include/postgresql"; then
356 PGSQL_CPPFLAGS="-I$__dir"
357 fi
6693a1d0 358 fi
ef0c727b
VK
359 COMPONENTS="$COMPONENTS pgsql"
360 DBDRIVER_SELECTED="yes"
6693a1d0 361fi ])
d16cf8a5 362
84277a0f
AK
363AC_ARG_WITH(db2,
364[AS_HELP_STRING(--with-db2,build DB2 database driver)],
365[ if test "x$withval" != "xno" ; then
366 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
367 if test `uname -m` = 'i386' || test `uname -m` = 'i686'; then
368 DB2_LIB_DIR=lib32
369 else
370 DB2_LIB_DIR=lib64
371 fi
372 if test -x "$withval/${DB2_LIB_DIR}" ; then
373 LD_RUN_PATH="${withval}/${DB2_LIB_DIR}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
374 LDFLAGS="$LDFLAGS -L${withval}/${DB2_LIB_DIR}"
375 else
376 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
377 LDFLAGS="$LDFLAGS -L${withval}"
378 fi
379 if test -x "$withval/include" ; then
380 CPPFLAGS="$CPPFLAGS -I${withval}/include"
381 fi
382
383 unset DB2_LIB_DIR
384 fi
385 COMPONENTS="$COMPONENTS db2"
386 DBDRIVER_SELECTED="yes"
387fi ])
388
37861c72
VK
389AC_ARG_WITH(informix,
390[AS_HELP_STRING(--with-informix,build Informix database driver)],
391[ if test "x$withval" != "xno" ; then
392 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
393 if test -x "$withval/lib/cli" ; then
394 LD_RUN_PATH="${withval}/lib/cli${LD_RUN_PATH:+:}${LD_RUN_PATH}"
395 LDFLAGS="$LDFLAGS -L${withval}/lib/cli"
396 if test -x "$withval/lib/esql" ; then
397 LD_RUN_PATH="${withval}/lib/esql${LD_RUN_PATH:+:}${LD_RUN_PATH}"
398 LDFLAGS="$LDFLAGS -L${withval}/lib/esql"
399 fi
400 else
401 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
402 LDFLAGS="$LDFLAGS -L${withval}"
403 fi
404 if test -x "$withval/incl/cli" ; then
405 CPPFLAGS="$CPPFLAGS -I${withval}/incl/cli"
406 fi
407 fi
408 COMPONENTS="$COMPONENTS informix"
409 DBDRIVER_SELECTED="yes"
410fi ])
411
ef0c727b 412AC_ARG_WITH(openssl,
1010cff7
VK
413[AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
414[
415 if test "x$withval" != "xno" ; then
416 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
417 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
418 LDFLAGS="$LDFLAGS -L${withval}/lib"
419 CPPFLAGS="$CPPFLAGS -I${withval}/include"
420 else
421 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
422 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
4d37b0c5 423 CPPFLAGS="$CPPFLAGS -I/opt/openssl/include"
ef0c727b 424 fi
1010cff7 425 fi
1010cff7 426])
ef0c727b 427
b5e5849b
VK
428AC_ARG_WITH(jemalloc,
429[AS_HELP_STRING(--with-jemalloc,specify libjemalloc location)],
430[
431 if test "x$withval" != "xno" ; then
432 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
433 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
434 LDFLAGS="$LDFLAGS -L${withval}/lib"
435 CPPFLAGS="$CPPFLAGS -I${withval}/include"
436 INSTALL_LIBPATH="${withval}/lib${INSTALL_LIBPATH:+:}${INSTALL_LIBPATH}"
437 fi
438 fi
439])
440
ef0c727b
VK
441AC_ARG_ENABLE(iconv,
442[AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)],
3a7ce527 443[
ef0c727b 444 DISABLE_ICONV="yes"
3a7ce527 445])
3a7ce527 446
b8adb0f2
VK
447AC_ARG_ENABLE(ipv6,
448[AS_HELP_STRING(--disable-ipv6,disable IPv6 support)],
449[
450 DISABLE_IPV6="yes"
451])
452
bd96aa53
VK
453AC_ARG_ENABLE(iconv-cache,
454[AS_HELP_STRING([--enable-iconv-cache=@<:@yes/no/auto@:>@],
455[cache iconv descriptors [default=auto]])],,
456[enable_iconv_cache=auto])
457
65834be3
VK
458AC_ARG_ENABLE(readline,
459[AS_HELP_STRING(--disable-readline,do not use libreadline)],
460[
461 DISABLE_READLINE="yes"
462])
463
ef0c727b
VK
464AC_ARG_ENABLE(encryption,
465[AS_HELP_STRING(--disable-encryption,disable encryption support)],
e0760102 466[
ef0c727b 467 DISABLE_ENCRYPTION="yes"
058bf6fc 468 XMPP_SUPPORT="no"
e0760102
VK
469])
470
4050bafb
VK
471AC_ARG_ENABLE(lmsensors,
472[AS_HELP_STRING(--disable-lmsensors,disable lmsensors support)],
473[
474 DISABLE_LMSENSORS="yes"
475])
476
058bf6fc
VK
477AC_ARG_ENABLE(xmpp,
478[AS_HELP_STRING(--disable-xmpp,disable XMPP support)],
479[
480 XMPP_SUPPORT="no"
481])
482
2cfe4482
VK
483AC_ARG_ENABLE(ldap,
484[AS_HELP_STRING(--disable-ldap,disable LDAP support)],
485[
486 LDAP_SUPPORT="no"
487])
488
a67fa146
VK
489AC_ARG_ENABLE(unicode,
490[AS_HELP_STRING(--enable-unicode,enable UNICODE build)],
491[
492 BUILD_UNICODE="yes"
842c22f4 493 CPPFLAGS="$CPPFLAGS -DUNICODE"
76b1d3d8 494 FORCE_INTERNAL_LIBTRE="yes"
a67fa146
VK
495])
496
f974a50a
VK
497AC_ARG_ENABLE(debug,
498[AS_HELP_STRING(--enable-debug,enable additional debugging functionality)],
499[
500 ENABLE_DEBUG="yes"
501])
502
25ae8377
VK
503AC_ARG_ENABLE(werror,
504[AS_HELP_STRING(--enable-werror,threat all warnings as errors)],
505[
506 ENABLE_WERROR="yes"
507])
508
cc297a70 509AC_ARG_ENABLE(64bit,
e5be5b83 510[AS_HELP_STRING(--disable-64bit,disable 64bit build (force 32bit build on 64bit machine))],
cc297a70
VK
511[
512 FORCE_32BIT_BUILD="yes"
513])
514
ef0c727b
VK
515AC_ARG_WITH(dist,
516[AS_HELP_STRING(--with-dist,for maintainers only)],
87f1fff0 517 DB_DRIVERS=" mysql pgsql odbc mssql sqlite oracle db2 informix"
a7a4c1e9 518 MODULES="jansson libexpat libstrophe libtre zlib libnetxms install sqlite snmp libnxsl libnxmb libnxlp libnxcc db server agent libnxmap client nxscript nxcproxy nxlptest tools"
ab2c09bb 519 SUBAGENT_DIRS="linux ds18x20 freebsd openbsd netbsd sunos aix ipso hpux odbcquery informix oracle lmsensors darwin rpi java ubntlw netsvc db2 tuxedo mongodb"
9b571a7e 520 SMSDRV_DIRS="kannel text2reach websms"
6fad8870 521 HDLINK_DIRS="jira"
52a2232c 522 PDSDRV_DIRS="rrdtool"
ef0c727b 523 NXCONFIG="nxconfig"
33a10d92 524 TOP_LEVEL_MODULES="include sql images tests"
7dda4453 525 SERVER_INCLUDE="include"
19e3290a 526 CONTRIB_MODULES="mibs backgrounds music"
d6a7a843 527 CLIENT_COMPONENTS="nxalarm nxevent nxpush nxsms"
ef0c727b
VK
528 SERVER_TOOLS="nxconfig"
529)
530
247f8a6c
AK
531AC_ARG_WITH(rpi-agent,
532[AS_HELP_STRING(--with-rpi-agent,build Raspberry Pi agent)],
533[
534 COMPONENTS="$COMPONENTS raspberrypi"
535])
536
33a10d92
VK
537AC_ARG_WITH(tests,
538[AS_HELP_STRING(--with-tests,build tests)],
539[
540 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES tests"
541])
542
d8ca9c03 543
ef0c727b 544#--------------------------------------------------------------------
12313882
VK
545# Set LD_LIBRARY_PATH from LD_RUN_PATH because on some systems
546# LD_RUN_PATH ignored by linker and some tests may fail
547#--------------------------------------------------------------------
548
e5cceced 549export LD_RUN_PATH
12313882
VK
550if test "x$LD_RUN_PATH" != "x"; then
551 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}${LD_RUN_PATH}"
552 export LD_LIBRARY_PATH
553fi
554
555
556#--------------------------------------------------------------------
ef0c727b
VK
557# Validate command line parameters and set various checking options
558#--------------------------------------------------------------------
559
8817f620
VK
560check_substr "$COMPONENTS" "sqlite"
561if test $? = 0; then
562 MODULES="$MODULES sqlite"
563fi
564
bc9361fd
VK
565check_substr "$COMPONENTS" "snmp"
566if test $? = 0; then
567 NEED_ZLIB="yes"
568 MODULES="$MODULES snmp"
569fi
570
ef0c727b 571check_substr "$COMPONENTS" "static-agent"
1010cff7 572if test $? = 0; then
e528af2b 573 if test "x$COMPONENTS" != "x sqlite snmp static-agent sqlite_drv"; then
971abf4f 574 AC_MSG_ERROR(Static agent and other components are mutually exclusive.)
ef0c727b
VK
575 fi
576 STATIC_BUILD="yes"
577 BUILD_STATIC_AGENT="yes"
60a1159a 578 MODULES="$MODULES libnxlp db agent"
3a6979cf 579 DISABLE_ICONV="yes"
ef0c727b 580 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
c1165d33 581 if test "x$PROPOSED_STATIC_SUBAGENTS" = "xdefault"; then
52056835 582 STATIC_SUBAGENT_LIST="ecs filemgr logwatch ping portcheck ups"
c1165d33
VK
583 else
584 STATIC_SUBAGENT_LIST="$PROPOSED_STATIC_SUBAGENTS"
585 fi
60a1159a 586
52056835 587 SUBAGENT_LIBS="../subagents/ecs/ecs.la ../subagents/filemgr/filemgr.la ../subagents/logwatch/logwatch.la ../subagents/ping/ping.la ../subagents/portCheck/portcheck.la ../subagents/ups/ups.la"
e8636669 588
60a1159a
VK
589 check_substr "$STATIC_SUBAGENT_LIST" "odbcquery"
590 if test $? = 0; then
591 COMPONENTS="$COMPONENTS odbc"
592 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/odbcquery/odbcquery.la"
593 fi
594
595 check_substr "$STATIC_SUBAGENT_LIST" "oracle"
596 if test $? = 0; then
597 COMPONENTS="$COMPONENTS oracle"
598 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/oracle/oracle.la"
599 fi
600
6afe141e 601 check_substr "$STATIC_SUBAGENT_LIST" "informix"
602 if test $? = 0; then
603 COMPONENTS="$COMPONENTS informix"
604 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/informix/informix.la"
605 fi
606
607 check_substr "$STATIC_SUBAGENT_LIST" "db2"
60a1159a 608 if test $? = 0; then
6afe141e 609 COMPONENTS="$COMPONENTS db2"
610 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/db2/db2.la"
60a1159a
VK
611 fi
612
ef0c727b 613 case "$PLATFORM" in
e8636669 614 Linux)
e58b0f75
VK
615 SUBAGENT_DIRS="linux ds18x20"
616 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/linux/linux.la ../subagents/ds18x20/ds18x20.la"
617 STATIC_SUBAGENT_LIST="linux ds18x20 $STATIC_SUBAGENT_LIST"
e8636669
VK
618 ;;
619 FreeBSD)
620 SUBAGENT_DIRS="freebsd"
c1165d33 621 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/freebsd/freebsd.la"
d0b5a098 622 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
e8636669 623 ;;
992ba479
AK
624 OpenBSD)
625 SUBAGENT_DIRS="openbsd"
c1165d33 626 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/openbsd/openbsd.la"
992ba479
AK
627 STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST"
628 ;;
ad0f1ada
VK
629 NetBSD)
630 SUBAGENT_DIRS="netbsd"
c1165d33 631 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/netbsd/netbsd.la"
ad0f1ada
VK
632 STATIC_SUBAGENT_LIST="netbsd $STATIC_SUBAGENT_LIST"
633 ;;
e8636669
VK
634 SunOS)
635 SUBAGENT_DIRS="sunos"
c1165d33 636 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/sunos/sunos.la"
d0b5a098
VK
637 STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
638 ;;
639 AIX)
640 SUBAGENT_DIRS="aix"
c1165d33 641 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/aix/aix.la"
d0b5a098 642 STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
e8636669 643 ;;
c29360a9
VK
644 HP-UX)
645 SUBAGENT_DIRS="hpux"
c1165d33 646 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/hpux/hpux.la"
c29360a9
VK
647 STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
648 ;;
cf52e714
AK
649 Darwin)
650 SUBAGENT_DIRS="darwin"
651 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/darwin/darwin.la"
652 STATIC_SUBAGENT_LIST="darwin $STATIC_SUBAGENT_LIST"
653 ;;
e8636669
VK
654 *)
655 # unknown
656 ;;
657 esac
ef0c727b 658fi
2b23dc1e 659
ef0c727b 660check_substr "$COMPONENTS" "ipso-agent"
1010cff7 661if test $? = 0; then
fd5a401b 662 if test "x$COMPONENTS" != "x ipso-agent"; then
971abf4f 663 AC_MSG_ERROR(IPSO agent and other components are mutually exclusive.)
ef0c727b
VK
664 fi
665 STATIC_BUILD="yes"
666 BUILD_STATIC_AGENT="yes"
3a6979cf 667 DISABLE_ICONV="yes"
ef0c727b 668 USE_PTH="yes"
60a1159a 669 MODULES="$MODULES libnxlp db agent"
ef8a3c32 670 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO -DSQLITE_THREADSAFE=0 -I/usr/local/include"
ef0c727b 671 LDFLAGS="$LDFLAGS -all-static"
971abf4f 672 STATIC_SUBAGENT_LIST="ecs ipso logwatch ping portcheck ups"
ef0c727b 673 SUBAGENT_DIRS="ipso"
c1165d33 674 SUBAGENT_LIBS="../subagents/ecs/ecs.la ../subagents/ipso/ipso.la ../subagents/logwatch/logwatch.la ../subagents/ping/ping.la ../subagents/portCheck/portcheck.la ../subagents/ups/ups.la"
ef0c727b 675fi
c688d2a7 676
ef0c727b 677check_substr "$COMPONENTS" "agent"
1010cff7 678if test $? = 0; then
ef0c727b 679 BUILD_AGENT="yes"
28ba6824 680 MODULES="$MODULES libnxlp db agent"
1010cff7
VK
681
682 case "$PLATFORM" in
683 Linux)
e58b0f75 684 SUBAGENT_DIRS="linux ds18x20"
1010cff7
VK
685 ;;
686 FreeBSD)
687 SUBAGENT_DIRS="freebsd"
688 ;;
689 OpenBSD)
690 SUBAGENT_DIRS="openbsd"
691 ;;
ad0f1ada
VK
692 NetBSD)
693 SUBAGENT_DIRS="netbsd"
694 ;;
1010cff7
VK
695 SunOS)
696 SUBAGENT_DIRS="sunos"
697 ;;
698 AIX)
699 SUBAGENT_DIRS="aix"
700 ;;
701 HP-UX)
702 SUBAGENT_DIRS="hpux"
cf52e714
AK
703 ;;
704 Darwin)
705 SUBAGENT_DIRS="darwin"
1010cff7
VK
706 ;;
707 *)
708 # unknown
709 ;;
710 esac
ef0c727b 711fi
b97191d2 712
94a7996a
VK
713check_substr "$COMPONENTS" "server"
714if test $? = 0; then
715 if test "x$DBDRIVER_SELECTED" != "xyes"; then
716 AC_MSG_ERROR(You must select at least one database driver when building server.)
717 fi
718 BUILD_SERVER="yes"
a7a4c1e9 719 MODULES="$MODULES libnxmap libnxsl libnxcc server nxscript"
94a7996a
VK
720 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
721 CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds music"
722 if test "x$XMPP_SUPPORT" = "xyes"; then
723 MODULES="libstrophe $MODULES"
724 AC_DEFINE(XMPP_SUPPORTED, 1, Define to 1 if XMPP is supported)
725 fi
726fi
727
728check_substr "$COMPONENTS" "client"
729if test $? = 0; then
730 BUILD_CLIENT="yes"
731 NEED_ZLIB="yes"
732 MODULES="$MODULES client"
733 CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxalarm nxevent nxpush nxsms"
734fi
735
736check_substr "$COMPONENTS" "client-proxy"
737if test $? = 0; then
738 MODULES="$MODULES nxcproxy"
739fi
740
ef0c727b 741check_substr "$COMPONENTS" "mysql"
1010cff7 742if test $? = 0; then
ef0c727b 743 DB_DRIVERS="$DB_DRIVERS mysql"
b67a9e12 744fi
6619a6b0 745
ef0c727b 746check_substr "$COMPONENTS" "pgsql"
1010cff7 747if test $? = 0; then
ef0c727b
VK
748 DB_DRIVERS="$DB_DRIVERS pgsql"
749fi
e8636669 750
8817f620 751check_substr "$COMPONENTS" "sqlite_drv"
1010cff7 752if test $? = 0; then
ef0c727b 753 DB_DRIVERS="$DB_DRIVERS sqlite"
e8636669
VK
754fi
755
ef0c727b 756check_substr "$COMPONENTS" "odbc"
1010cff7 757if test $? = 0; then
ef0c727b
VK
758 DB_DRIVERS="$DB_DRIVERS odbc"
759fi
760
41b4790d
VK
761check_substr "$COMPONENTS" "oracle"
762if test $? = 0; then
763 DB_DRIVERS="$DB_DRIVERS oracle"
4d1753cd 764 SUBAGENT_DIRS="$SUBAGENT_DIRS oracle"
41b4790d
VK
765fi
766
84277a0f
AK
767check_substr "$COMPONENTS" "db2"
768if test $? = 0; then
769 DB_DRIVERS="$DB_DRIVERS db2"
6afe141e 770 SUBAGENT_DIRS="$SUBAGENT_DIRS db2"
84277a0f
AK
771fi
772
87f1fff0
VK
773check_substr "$COMPONENTS" "informix"
774if test $? = 0; then
775 DB_DRIVERS="$DB_DRIVERS informix"
80e96a82 776 SUBAGENT_DIRS="$SUBAGENT_DIRS informix"
87f1fff0
VK
777fi
778
247f8a6c
AK
779check_substr "$COMPONENTS" "raspberrypi"
780if test $? = 0; then
781 NEED_ZLIB="yes"
782 SUBAGENT_DIRS="$SUBAGENT_DIRS rpi"
783fi
ef0c727b 784
50e4bc8c
VK
785check_substr "$COMPONENTS" "java"
786if test $? = 0; then
ab2c09bb 787 SUBAGENT_DIRS="$SUBAGENT_DIRS java ubntlw"
50e4bc8c
VK
788fi
789
b14c3f22
VK
790check_substr "$COMPONENTS" "tuxedo"
791if test $? = 0; then
792 SUBAGENT_DIRS="$SUBAGENT_DIRS tuxedo"
793fi
794
d6235717 795check_substr "$COMPONENTS" "mongodb"
796if test $? = 0; then
797 SUBAGENT_DIRS="$SUBAGENT_DIRS mongodb"
798fi
799
b550188f
VK
800check_substr "$COMPONENTS" "sdk"
801if test $? = 0; then
a7a4c1e9 802 MODULES="$MODULES libnxmap client libnxsl libnxmb libnxlp libnxcc db nxscript"
b550188f
VK
803fi
804
805
ef0c727b
VK
806#--------------------------------------------------------------------
807# Check for programs
808#--------------------------------------------------------------------
809
810if test "x$PLATFORM" = "xHP-UX"; then
f172d7b7 811 AC_CHECK_PROG([CC], [aCC], [aCC])
e7d9c4ae 812 AC_CHECK_PROG([CCC], [aCC], [aCC])
ef0c727b 813fi
df9812a9 814if test "x$PLATFORM" = "xAIX"; then
f172d7b7 815 AC_CHECK_PROG([CC], [xlc_r], [xlc_r])
df9812a9
VK
816 AC_CHECK_PROG([CCC], [xlC_r], [xlC_r])
817fi
9113e749 818if test "x$PLATFORM" = "xSunOS"; then
f172d7b7 819 AC_CHECK_PROG([CC], [cc], [cc])
9113e749
VK
820 AC_CHECK_PROG([CCC], [CC], [CC])
821fi
ef8a3c32
VK
822if test "x$PLATFORM" = "xMinix"; then
823 AC_CHECK_PROG([CC], [clang], [clang])
824 AC_CHECK_PROG([CCC], [clang++], [clang++])
825fi
f172d7b7 826AC_PROG_CC
ef0c727b
VK
827AC_PROG_CPP
828AC_PROG_CXX
c3cfc039 829if test "x$CXX" = "xg++"; then
753206b5
AK
830 AC_CHECK_PROG([GPLUSPLUS], [g++], [yes], [no])
831 if test "x$GPLUSPLUS" = "xno"; then
c3cfc039
VK
832 AC_MSG_ERROR([*** FATAL: Cannot find any usable C++ compiler])
833 fi
834fi
ef8a3c32
VK
835if test "x$CXX" = "xclang++"; then
836 LIBS="$LIBS -lc++"
837fi
fdf7ec40 838AM_PROG_AS
ef0c727b
VK
839AC_PROG_INSTALL
840AC_PROG_LEX
76154a95 841AC_CHECK_PROGS(YACC,bison byacc,yacc)
ef0c727b
VK
842AC_PROG_LN_S
843
844AC_ARG_VAR(PERL,local path to the perl interpreter)
845perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
846AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
847
848
849#--------------------------------------------------------------------
ef0c727b
VK
850# C/C++ capabilities
851#--------------------------------------------------------------------
852
853AC_C_CONST
854AC_PROG_GCC_TRADITIONAL
1d9cc60e 855AC_C_BIGENDIAN
ef0c727b
VK
856
857
858#--------------------------------------------------------------------
859# Platform-dependent settings
860#--------------------------------------------------------------------
861
862case "$PLATFORM" in
863 AIX)
545bda2d 864 LDFLAGS_PREFIX="-no-undefined -Wl,-brtl $LDFLAGS"
ef0c727b
VK
865 ;;
866 HP-UX)
f0c1ad9c 867 CPPFLAGS="$CPPFLAGS -D_HPUX -D_HPUX_SOURCE -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_REENTRANT -D_INCLUDE_LONGLONG -D_LARGEFILE64_SOURCE"
ef0c727b 868 if test "x$CXX" = "xaCC"; then
5a64ab96 869 CPPFLAGS="$CPPFLAGS -D_HP_ATOMIC_INLINE"
53c96e2d 870 CFLAGS="$CFLAGS -AC99"
6e872345 871 CXXFLAGS="-mt $CXXFLAGS +W749 +W829 +W4232"
ef0c727b
VK
872 LDFLAGS="$LDFLAGS -mt"
873 fi
6dde8627
VK
874 if test `uname -m` != 'ia64'; then
875 HPUX_HPPA="yes"
876 fi
ef0c727b 877 ;;
75c30ed4 878 SunOS)
b92efe0e 879 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__"
44ca59aa
VK
880 AC_MSG_CHECKING(whether C compiler accepts -O2)
881 OLD_CPPFLAGS="$CPPFLAGS"
882 CPPFLAGS="$CPPFLAGS -O2"
12313882 883 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
44ca59aa
VK
884 [ AC_MSG_RESULT(yes) ],
885 [
886 CPPFLAGS="$OLD_CPPFLAGS"
887 AC_MSG_RESULT(no)
888 ])
75c30ed4 889 ;;
56b2f755 890 Linux)
f47bd4ca 891 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -O2"
56b2f755 892 ;;
d1056954 893 Darwin)
f47bd4ca 894 CPPFLAGS="$CPPFLAGS -Wno-deprecated-declarations -O2"
d1056954 895 ;;
ef8a3c32
VK
896 Minix)
897 CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
898 LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
899 USE_PTH="yes"
900 ;;
ef0c727b
VK
901 *)
902 ;;
903esac
904
905
906#--------------------------------------------------------------------
c90d3610 907# C++ compiler tuning:
cc297a70 908# * Disable C++ exceptions and RTTI
779ce551 909# * Turn on 64bit mode on HP-UX/Itanium
cc297a70 910# * Turn on 64bit mode on AIX
d358c73f 911# * Turn on 64bit mode on Solaris
3bc41d67 912# * Disable inconsistent C/C++ linkage warnings for Solaris Studio
ef0c727b
VK
913#--------------------------------------------------------------------
914
5482ef16 915if test "x$ac_compiler_gnu" = "xyes" ; then
9113e749 916 SQLFLAGS="-x c -Wundef"
6e383343 917 CPPFLAGS="$CPPFLAGS -Wformat"
ef0c727b
VK
918
919 AC_LANG_PUSH([C++])
920
921 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
e6b112bc 922 OLD_CXXFLAGS="$CXXFLAGS"
ef0c727b
VK
923 CXXFLAGS="$CXXFLAGS -fno-rtti"
924 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
925 [ AC_MSG_RESULT(yes) ],
926 [
927 CXXFLAGS="$OLD_CXXFLAGS"
928 AC_MSG_RESULT(no)
929 ])
930
3118008e
VK
931 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
932 OLD_CXXFLAGS="$CXXFLAGS"
933 CXXFLAGS="$CXXFLAGS -fno-exceptions"
934 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
935 [ AC_MSG_RESULT(yes) ],
936 [
937 CXXFLAGS="$OLD_CXXFLAGS"
938 AC_MSG_RESULT(no)
939 ])
ef0c727b
VK
940
941 AC_LANG_POP([C++])
942
9b318048
VK
943 MACHINE=`uname -m`
944 if test "x$MACHINE" = "xi686" -o "x$MACHINE" = "xi586"; then
945 AC_MSG_CHECKING(whether C compiler accepts -march=$MACHINE)
946 OLD_CPPFLAGS="$CPPFLAGS"
947 CPPFLAGS="$CPPFLAGS -march=$MACHINE"
948 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
949 [
950 AC_MSG_RESULT(yes)
951 ],
952 [
953 CPPFLAGS="$OLD_CPPFLAGS"
954 AC_MSG_RESULT(no)
955 ])
956 fi
957
779ce551 958 if test "x$PLATFORM" = "xHP-UX"; then
cc297a70
VK
959 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
960 AC_MSG_CHECKING(whether C compiler accepts -milp32)
961 OLD_CPPFLAGS="$CPPFLAGS"
962 CPPFLAGS="$CPPFLAGS -milp32"
963 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
964 [
965 LDFLAGS="-milp32 $LDFLAGS"
966 AC_MSG_RESULT(yes)
967 ],
968 [
969 CPPFLAGS="$OLD_CPPFLAGS"
970 AC_MSG_RESULT(no)
971 ])
972 else
973 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
974 OLD_CPPFLAGS="$CPPFLAGS"
975 CPPFLAGS="$CPPFLAGS -mlp64"
976 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
977 [
978 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
979 AC_MSG_RESULT(yes)
980 ],
981 [
982 CPPFLAGS="$OLD_CPPFLAGS"
983 AC_MSG_RESULT(no)
984 ])
985 fi
986 fi
987
988 if test "x$PLATFORM" = "xAIX"; then
989 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
990 AC_MSG_CHECKING(whether C compiler accepts -maix32)
991 OLD_CPPFLAGS="$CPPFLAGS"
992 CPPFLAGS="$CPPFLAGS -maix32"
fecf6a2b 993 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
994 [
995 LDFLAGS="-maix32 $LDFLAGS"
5482ef16
VK
996 LTINIT_CC="$CC -maix32"
997 LTINIT_CXX="$CXX -maix32"
1c45282c 998 OBJECT_MODE=32
cc297a70
VK
999 AC_MSG_RESULT(yes)
1000 ],
1001 [
1002 CPPFLAGS="$OLD_CPPFLAGS"
1003 AC_MSG_RESULT(no)
1004 ])
1005 else
1006 AC_MSG_CHECKING(whether C compiler accepts -maix64)
1007 OLD_CPPFLAGS="$CPPFLAGS"
1008 CPPFLAGS="$CPPFLAGS -maix64"
fecf6a2b 1009 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
1010 [
1011 LDFLAGS="-maix64 $LDFLAGS"
5482ef16
VK
1012 LTINIT_CC="$CC -maix64"
1013 LTINIT_CXX="$CXX -maix64"
1c45282c 1014 OBJECT_MODE=64
cc297a70
VK
1015 AC_MSG_RESULT(yes)
1016 ],
1017 [
1018 CPPFLAGS="$OLD_CPPFLAGS"
1019 AC_MSG_RESULT(no)
1020 ])
1021 fi
779ce551 1022 fi
d358c73f
VK
1023
1024 if test "x$PLATFORM" = "xSunOS"; then
1025 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1026 AC_MSG_CHECKING(whether C compiler accepts -m32)
1027 OLD_CPPFLAGS="$CPPFLAGS"
1028 CPPFLAGS="$CPPFLAGS -m32"
1029 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1030 [
1031 LDFLAGS="-m32 $LDFLAGS"
1032 AC_MSG_RESULT(yes)
1033 ],
1034 [
1035 CPPFLAGS="$OLD_CPPFLAGS"
1036 AC_MSG_RESULT(no)
1037 ])
1038 else
1039 AC_MSG_CHECKING(whether C compiler accepts -m64)
1040 OLD_CPPFLAGS="$CPPFLAGS"
1041 CPPFLAGS="$CPPFLAGS -m64"
1042 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1043 [
1044 LDFLAGS="-m64 $LDFLAGS"
1045 AC_MSG_RESULT(yes)
1046 ],
1047 [
1048 CPPFLAGS="$OLD_CPPFLAGS"
1049 AC_MSG_RESULT(no)
1050 ])
1051 fi
1052 fi
779ce551 1053
3ac3594a
VK
1054
1055 if test "x$PLATFORM" = "xLinux"; then
1056 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1057 AC_MSG_CHECKING(whether C compiler accepts -m32)
1058 OLD_CPPFLAGS="$CPPFLAGS"
1059 CPPFLAGS="$CPPFLAGS -m32"
1060 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1061 [
1062 LDFLAGS="-m32 $LDFLAGS"
1063 AC_MSG_RESULT(yes)
1064 ],
1065 [
1066 CPPFLAGS="$OLD_CPPFLAGS"
1067 AC_MSG_RESULT(no)
1068 ])
1069 fi
1070 fi
1071
ce5592b2
VK
1072 if test "x$ENABLE_DEBUG" = "xyes"; then
1073 CPPFLAGS="$CPPFLAGS -ggdb3"
1074 fi
ef0c727b
VK
1075fi
1076
cfd95c74
VK
1077if test "x$CXX" = "xaCC" ; then
1078 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
451b735a
VK
1079 if test "x$HPUX_HPPA" = "xyes"; then
1080 ARCHFLAG="+DA1.1"
1081 else
1082 ARCHFLAG="+DD32"
1083 fi
1084 AC_MSG_CHECKING(whether C compiler accepts $ARCHFLAG)
4d37b0c5 1085 OLD_CPPFLAGS="$CPPFLAGS"
451b735a 1086 CPPFLAGS="$ARCHFLAG $CPPFLAGS"
cfd95c74
VK
1087 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1088 [
451b735a
VK
1089 LDFLAGS="$ARCHFLAG $LDFLAGS"
1090 CCASFLAGS="$ARCHFLAG $CCASFLAGS"
cfd95c74
VK
1091 AC_MSG_RESULT(yes)
1092 ],
1093 [
4d37b0c5
VK
1094 CPPFLAGS="$OLD_CPPFLAGS"
1095 AC_MSG_RESULT(no)
cfd95c74 1096 ])
4d37b0c5 1097 else
451b735a
VK
1098 if test "x$HPUX_HPPA" = "xyes"; then
1099 ARCHFLAG="+DA2.0W"
1100 else
1101 ARCHFLAG="+DD64"
1102 fi
1103 AC_MSG_CHECKING(whether C compiler accepts $ARCHFLAG)
cfd95c74 1104 OLD_CPPFLAGS="$CPPFLAGS"
451b735a 1105 CPPFLAGS="$ARCHFLAG $CPPFLAGS"
cfd95c74
VK
1106 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1107 [
451b735a
VK
1108 LDFLAGS="$ARCHFLAG $LDFLAGS"
1109 CCASFLAGS="$ARCHFLAG $CCASFLAGS"
cfd95c74
VK
1110 AC_MSG_RESULT(yes)
1111 ],
1112 [
1113 CPPFLAGS="$OLD_CPPFLAGS"
1114 AC_MSG_RESULT(no)
1115 ])
4d37b0c5 1116 fi
ef0c727b
VK
1117fi
1118
df9812a9 1119if test "x$CXX" = "xxlC_r" ; then
d1cb61cf 1120 SQLFLAGS="-qnoppline"
9b99f1c0
VK
1121 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1122 AC_MSG_CHECKING(whether C compiler accepts -q32)
1123 OLD_CPPFLAGS="$CPPFLAGS"
1124 CPPFLAGS="-q32 $CPPFLAGS"
1125 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1126 [
1127 LDFLAGS="-q32 $LDFLAGS"
df9812a9 1128 OBJECT_MODE=32
9b99f1c0
VK
1129 AC_MSG_RESULT(yes)
1130 ],
1131 [
1132 CPPFLAGS="$OLD_CPPFLAGS"
1133 AC_MSG_RESULT(no)
1134 ])
1135 else
1136 AC_MSG_CHECKING(whether C compiler accepts -q64)
1137 OLD_CPPFLAGS="$CPPFLAGS"
1138 CPPFLAGS="-q64 $CPPFLAGS"
1139 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1140 [
1141 LDFLAGS="-q64 $LDFLAGS"
df9812a9 1142 OBJECT_MODE=64
9b99f1c0
VK
1143 AC_MSG_RESULT(yes)
1144 ],
1145 [
1146 CPPFLAGS="$OLD_CPPFLAGS"
1147 AC_MSG_RESULT(no)
1148 ])
1149 fi
1150fi
1151
9113e749
VK
1152if test "x$CXX" = "xCC" ; then
1153 SQLFLAGS="-Qn"
1154 CPPFLAGS="$CPPFLAGS -mt"
3bc41d67 1155 CXXFLAGS="$CXXFLAGS -erroff=badargtype2w,wbadinit"
9113e749
VK
1156
1157 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1158 AC_MSG_CHECKING(whether C compiler accepts -m32)
f5e5296e
VK
1159 count=`$CC -flags | grep '^\-m32 ' | wc -l`
1160 if test $count -eq 1; then
1161 AC_MSG_RESULT(yes)
1162 CPPFLAGS="$CPPFLAGS -m32"
1163 LDFLAGS="-m32 $LDFLAGS"
1164 else
1165 AC_MSG_RESULT(no)
1166 fi
9113e749 1167 else
c3900dbb 1168 TEST_XARCH="no"
9113e749 1169 AC_MSG_CHECKING(whether C compiler accepts -m64)
f5e5296e
VK
1170 count=`$CC -flags | grep '^\-m64 ' | wc -l`
1171 if test $count -eq 1; then
1172 AC_MSG_RESULT(yes)
1173 CPPFLAGS="$CPPFLAGS -m64"
1174 LDFLAGS="-m64 $LDFLAGS"
1175 else
1176 AC_MSG_RESULT(no)
1177 TEST_XARCH="yes"
1178 fi
c3900dbb
VK
1179 if test "x$TEST_XARCH" = "xyes"; then
1180 if test "x$CPUTYPE" = "xsparc"; then
1181 ARCH="-xarch=v9"
1182 else
1183 ARCH="-xarch=amd64"
1184 fi
1185 AC_MSG_CHECKING(whether C compiler accepts $ARCH)
1186 OLD_CPPFLAGS="$CPPFLAGS"
1187 CPPFLAGS="$CPPFLAGS $ARCH"
1188 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1189 [
1190 LDFLAGS="$ARCH $LDFLAGS"
1191 AC_MSG_RESULT(yes)
1192 ],
1193 [
1194 CPPFLAGS="$OLD_CPPFLAGS"
1195 AC_MSG_RESULT(no)
1196 ])
1197 fi
9113e749
VK
1198 fi
1199fi
1200
edb018d7
VK
1201
1202#--------------------------------------------------------------------
1203# Initialize libtool
1204#--------------------------------------------------------------------
1205
1206if test "x$STATIC_BUILD" = "xyes"; then
1207 enable_shared=no
1208 enable_static=yes
1209else
1210 enable_shared=yes
e99eba92
VK
1211 if test "x$BUILD_SDK" = "xyes"; then
1212 enable_static=yes
1213 else
1214 enable_static=no
1215 fi
edb018d7 1216fi
1ef5e57a
VK
1217
1218if test "x$LTINIT_CC" != "x"; then
1219 SAVED_CC="$CC"
1220 CC="$LTINIT_CC"
1221fi
1222if test "x$LTINIT_CXX" != "x"; then
1223 SAVED_CXX="$CXX"
1224 CXX="$LTINIT_CXX"
1225fi
1226
ff12e2f1 1227LT_PREREQ([2.2])
1ef5e57a
VK
1228LT_INIT([dlopen])
1229
1230if test "x$SAVED_CC" != "x"; then
1231 CC="$SAVED_CC"
1232fi
1233if test "x$SAVED_CXX" != "x"; then
1234 CXX="$SAVED_CXX"
1235fi
edb018d7
VK
1236
1237
cfd95c74
VK
1238#--------------------------------------------------------------------
1239# Additional include and library directories
1240#--------------------------------------------------------------------
ef0c727b 1241
cfd95c74
VK
1242if test "x$CXX" != "xaCC"; then
1243 if test -d /usr/local/include; then
5482ef16 1244 if test "x$ac_compiler_gnu" = "xyes"; then
cfd95c74
VK
1245 AC_MSG_CHECKING(whether -I/usr/local/include needed)
1246 OLD_CPPFLAGS="$CPPFLAGS"
1247 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
2adc2d49 1248 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
cfd95c74
VK
1249 [
1250 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
1251 AC_MSG_RESULT(yes)
1252 ],
1253 [
1254 CPPFLAGS="$OLD_CPPFLAGS"
1255 AC_MSG_RESULT(no)
1256 ]
1257 )
1258 else
1259 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
1260 fi
1261 fi
1262
1263 if test -d /usr/kerberos/include; then
1264 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1265 fi
ef0c727b 1266
cfd95c74
VK
1267 if test -d /usr/local/lib; then
1268 LDFLAGS="$LDFLAGS -L/usr/local/lib"
1269 fi
1270fi
ef0c727b 1271
de4c0511
VK
1272
1273#--------------------------------------------------------------------
1274# Check for additional system libraries
1275#--------------------------------------------------------------------
1276
1277AC_CHECK_LIB(xnet, accept)
1278AC_CHECK_LIB(socket, if_nameindex)
1279AC_CHECK_LIB(dl, dlopen)
1280AC_CHECK_LIB(kstat, kstat_open)
1281
1282# sockets/resolver
1283if test "$BUILD_SERVER-$XMPP_SUPPORT" = "yes-yes"; then
1284 AC_CHECK_HEADERS([arpa/nameser_compat.h])
1285 AC_CHECK_FUNC(res_query, , [AC_CHECK_LIB(resolv, res_query, [], [AC_CHECK_LIB(resolv, __res_query)])])
1286fi
1287AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1288AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1289AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1290
1291if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1292 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1293fi
1294
1295if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1296 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1297 LIBS="-lnsl -lsocket $LIBS"
1298 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1299 if test "$my_ac_link_result" = "no" ; then
1300 AC_MSG_RESULT([failure])
1301 AC_MSG_ERROR([unable to use gethostbyname()])
1302 else
1303 AC_MSG_RESULT([success])
1304 fi
1305fi
1306
1307
ef0c727b
VK
1308#--------------------------------------------------------------------
1309# Check for threads library - either POSIX or GNU
1310#--------------------------------------------------------------------
1311
1312if test "x$USE_PTH" = "xyes"; then
1313 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
ef8a3c32
VK
1314 CPPFLAGS="$CPPFLAGS -D_USE_GNU_PTH"
1315 LIBS="$LIBS -lpth"
ef0c727b
VK
1316else
1317 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
1318
1319 if test "x$CXX" = "xaCC"; then
1320 PTHREAD_LIBS=""
1321 else
1322 PTHREAD_LIBS="error"
1323 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
1324 AC_EGREP_CPP(yes,
1325 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
1326 yes
1327 #endif
1328 ], AC_MSG_RESULT(yes)
fecf6a2b 1329 PTHREAD_LIBS="-pthread",
ef0c727b
VK
1330 AC_MSG_RESULT(no))
1331 if test "x$PTHREAD_LIBS" = "xerror"; then
1332 AC_CHECK_LIB(pthread, pthread_attr_init,
1333 PTHREAD_LIBS="-lpthread")
1334 fi
f725c1b7 1335 # On HP-UX (at least 11.00) pthread library contains
b041c587 1336 # __pthread_attr_init_system instead of pthread_attr_init
f725c1b7 1337 if test "x$PTHREAD_LIBS" = "xerror"; then
b041c587 1338 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
f725c1b7
VK
1339 PTHREAD_LIBS="-lpthread")
1340 fi
ef0c727b
VK
1341 if test "x$PTHREAD_LIBS" = "xerror"; then
1342 AC_CHECK_LIB(pthreads, pthread_attr_init,
1343 PTHREAD_LIBS="-lpthreads")
1344 fi
1345 if test "x$PTHREAD_LIBS" = "xerror"; then
1346 AC_CHECK_FUNC(pthread_attr_init,
1347 PTHREAD_LIBS="")
1348 fi
1349 fi
1350
1351 if test "x$PTHREAD_LIBS" = "xerror"; then
1352 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
1353 fi
8d131dda 1354 LIBS="$LIBS $PTHREAD_LIBS"
ef0c727b
VK
1355
1356 # Extensions to posix threads
1357 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 1358#include <pthread.h>
ef0c727b
VK
1359 ])
1360 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
1361
1362 # Check for recursive mutexes
39086394
VK
1363 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
1364 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
1365#include <pthread.h>
1366#if HAVE_PTHREAD_NP_H
1367#include <pthread_np.h>
1368#endif
ef0c727b
VK
1369 ])
1370
1371 # Check for read/write locks
1372 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
1373 # additional defines
1374 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
1375 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
1376 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
afd0c386
VK
1377 [AC_COMPILE_IFELSE([
1378 AC_LANG_PROGRAM([
9c29f76e
VK
1379#include <sys/types.h>
1380#include <pthread.h>
afd0c386
VK
1381 ],
1382 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b 1383 ac_cv_struct_pthread_rw=yes, [
afd0c386
VK
1384 AC_COMPILE_IFELSE([
1385 AC_LANG_PROGRAM([
9c29f76e
VK
1386#define _XOPEN_SOURCE 500
1387#include <sys/types.h>
1388#include <pthread.h>
afd0c386
VK
1389 ],
1390 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b
VK
1391 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
1392 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1393 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
1394 fi
1395 ])])
1396 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1397 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
1398 fi
1399 fi
1400
1401fi
1402
1403
1404#--------------------------------------------------------------------
1405# Checks for OpenSSL
1406#--------------------------------------------------------------------
1407
1408if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
1409 AC_CHECK_LIB(crypto, RSA_new,
1410 [
2cfe4482 1411 AC_DEFINE(WITH_OPENSSL, 1, Define to 1 if you have OpenSSL library and headers)
ef0c727b 1412 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
e0a77f08 1413 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
ef0c727b 1414 AC_CHECK_LIB(crypto, EVP_bf_cbc,
e0a77f08 1415 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
ef0c727b 1416 AC_CHECK_LIB(crypto, EVP_idea_cbc,
e0a77f08 1417 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
ef0c727b 1418 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
e0a77f08 1419 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
d27e7413 1420 SERVER_LIBS="$SERVER_LIBS -lssl"
e0a77f08
VK
1421 if test "x$HAVE_LIBCRYPTO" = "xyes"; then
1422 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
1423# LIBS="$LIBS -Wl,-Bstatic -lcrypto -Wl,-Bdynamic"
1424 LIBS="$LIBS -lcrypto"
1425 else
1426 LIBS="$LIBS -lcrypto"
1427 fi
1428 else
058bf6fc 1429 AC_MSG_ERROR(libcrypto does not provide any suitable encryption algorithm)
e0a77f08 1430 fi
ef0c727b
VK
1431 ],
1432 [
058bf6fc 1433 AC_MSG_ERROR(libcrypto is required for encryption support)
ef0c727b
VK
1434 ])
1435fi
1436
1437
1438#--------------------------------------------------------------------
0322eed7
VK
1439# Checks for header files
1440#--------------------------------------------------------------------
1441
1442AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h alloca.h])
2e98cdb4 1443AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h sys/wait.h])
e9c8eb1d 1444AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h netinet/tcp.h net/nh.h sys/socket.h])
0322eed7
VK
1445AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
1446AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
c1099678 1447AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h locale.h])
df9812a9 1448AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
5962498b 1449AC_CHECK_HEADERS([grp.h pwd.h malloc.h])
f09c2d05 1450AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
1451[[#ifdef HAVE_SYS_TYPES_H
1452# include <sys/types.h>
1453#endif
1454#ifdef HAVE_SYS_TIME_H
1455# include <sys/time.h>
1456#endif
1457#ifdef HAVE_SYS_SOCKET_H
1458# include <sys/socket.h>
1459#endif
1460]])
1461
1462
1463#--------------------------------------------------------------------
b8adb0f2
VK
1464# Checks for IPv6 support
1465#--------------------------------------------------------------------
1466
1467if test "x$DISABLE_IPV6" != "xyes"; then
1468 AC_CHECK_DECL(AF_INET6,,,[
1469#if HAVE_NETINET_IN_H
1470#include <netinet/in.h>
1471#endif
1472 ])
1473 if test "x$ac_cv_have_decl_AF_INET6" = "xyes"; then
1474 AC_CHECK_TYPE(struct sockaddr_in6, [
1475 AC_DEFINE(WITH_IPV6, 1, Define to have IPv6 support)
1476 IPV6_SUPPORT="yes"
1477 ],,[
1478#if HAVE_NETINET_IN_H
1479#include <netinet/in.h>
1480#endif
1481 ])
1482 fi
1483fi
1484
1485#--------------------------------------------------------------------
ef0c727b
VK
1486# Checks for other libs.
1487#--------------------------------------------------------------------
d16cf8a5 1488
e0760102 1489if test "x$BUILD_SERVER" = "xyes" ; then
7c48e2aa 1490 AC_CHECK_LIB(termcap, tgetstr, [SERVER_LIBS="$SERVER_LIBS -ltermcap"], [AC_CHECK_LIB(ncurses, tgetstr, [SERVER_LIBS="$SERVER_LIBS -lncurses"], AC_CHECK_LIB(curses, tgetstr, [SERVER_LIBS="$SERVER_LIBS -lcurses"]))])
65834be3
VK
1491 if test "x$DISABLE_READLINE" = "xno"; then
1492 AC_CHECK_LIB(readline, readline, [SERVER_LIBS="$SERVER_LIBS -lreadline"], [AC_CHECK_LIB(edit, readline, [SERVER_LIBS="$SERVER_LIBS -ledit"])])
1493 fi
1fd17e2d 1494 AC_CHECK_LIB(rt, timer_create, [SERVER_LIBS="$SERVER_LIBS -lrt"])
7c48e2aa
VK
1495 SAVED_LDFLAGS="$LDFLAGS"
1496 LDFLAGS="$LDFLAGS $SERVER_LIBS"
1497
1fd17e2d
VK
1498 AC_CHECK_FUNCS([readline timer_create])
1499 AC_CHECK_TYPES([timer_t])
0322eed7
VK
1500
1501 # Check if passing rl_insert to rl_bind_key needs cast
1502 if test "$ac_cv_func_readline" = "yes"; then
1503 AC_LANG_PUSH([C++])
1504
1505 AC_MSG_CHECKING(for rl_insert cast)
1506
afd0c386 1507 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1508 [
1509#include <stdio.h>
1510#include <readline/readline.h>
afd0c386 1511 ],[ rl_bind_key('\t', (Function *)rl_insert); ])],
0322eed7
VK
1512 [
1513 AC_MSG_RESULT((Function *))
1514 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
1515 ],[
afd0c386 1516 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1517 [
1518#include <stdio.h>
1519#include <readline/readline.h>
afd0c386 1520 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ])],
0322eed7
VK
1521 [
1522 AC_MSG_RESULT((rl_command_func_t *))
1523 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
1524 ],[
1525 AC_MSG_RESULT(not needed)
1526 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
1527 ]
1528 )
1529 ]
1530 )
1531
1532 AC_LANG_POP([C++])
1533 fi
7c48e2aa 1534 LDFLAGS="$SAVED_LDFLAGS"
e0760102
VK
1535fi
1536
ef0c727b 1537if test "x$NEED_ZLIB" = "xyes"; then
1fd41bcd
VK
1538 if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
1539 HAVE_ZLIB=no
1540 else
1541 HAVE_ZLIB=yes
1542 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
1543 if test "x$HAVE_ZLIB" = "xyes"; then
1544 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
1545 fi
1546 fi
1547 if test "x$HAVE_ZLIB" = "xno"; then
1548 MODULES="zlib $MODULES"
1549 fi
ef0c727b
VK
1550fi
1551
467c489f
VK
1552if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
1553 HAVE_LIBEXPAT=no
1554else
1555 HAVE_LIBEXPAT=yes
1556 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
1557 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
1558fi
80ce37ac
VK
1559if test "x$HAVE_LIBEXPAT" = "xno"; then
1560 MODULES="libexpat $MODULES"
1bb6b449 1561fi
ef0c727b 1562
17b35ccc
VK
1563if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
1564 HAVE_LIBTRE=no
1565else
1566 HAVE_LIBTRE=yes
1567 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
1568 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
1569fi
1570if test "x$HAVE_LIBTRE" = "xno"; then
1571 MODULES="libtre $MODULES"
1572 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
a67fa146 1573
720c23d0
VK
1574 tre_version_1='0'
1575 tre_version_2='8'
1576 tre_version_3='0'
a67fa146
VK
1577 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
1578 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
1579 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
1580 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
1581 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
1582 AC_SUBST(TRE_VERSION, $tre_version)
1583
1584 AC_DEFINE(TRE_REGEX_T_FIELD,value,[Define to a field in the regex_t struct where TRE should store a pointer to the internal tre_tnfa_t structure])
1585 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
17b35ccc 1586fi
ef0c727b 1587
f5393033
VK
1588if test "x$FORCE_INTERNAL_JANSSON" = "xyes"; then
1589 HAVE_JANSSON=no
1590else
1591 HAVE_JANSSON=yes
1592 AC_CHECK_HEADER(jansson.h,,HAVE_JANSSON=no)
1593 AC_CHECK_LIB(jansson, json_object, [ HAVE_JANSSON=yes ], [ HAVE_JANSSON=no ])
1594fi
1595if test "x$HAVE_JANSSON" = "xno"; then
1596 MODULES="jansson $MODULES"
1597fi
1598
4050bafb
VK
1599if test "x$DISABLE_LMSENSORS" = "xno"; then
1600 HAVE_LMSENSORS=yes
1601 AC_CHECK_HEADER(sensors/sensors.h,,HAVE_LMSENSORS=no)
1602 if test "x$HAVE_LMSENSORS" = "xyes"; then
1603 AC_CHECK_LIB(sensors, sensors_init, [ DUMMY="" ], [ HAVE_LMSENSORS=no ])
1604 fi
1605 if test "x$HAVE_LMSENSORS" = "xyes"; then
1606 SUBAGENT_DIRS="$SUBAGENT_DIRS lmsensors"
1607 fi
38bfa5da
AK
1608fi
1609
0a4194c2
AK
1610AC_CHECK_HEADER(curl/curl.h,HAVE_LIBCURL=yes,HAVE_LIBCURL=no)
1611if test "x$HAVE_LIBCURL" = "xyes"; then
2368dc85
VK
1612 AC_CHECK_LIB(curl, curl_global_init, [ HAVE_LIBCURL=yes ], [ HAVE_LIBCURL=no ])
1613 AC_CHECK_DECLS([CURLOPT_NOSIGNAL, curl_version_info],,,[
1614#ifdef HAVE_CURL_CURL_H
1615#include <curl/curl.h>
1616#endif
1617])
0a4194c2 1618fi
d9177dd1 1619
0a4194c2 1620if test "x$HAVE_LIBCURL" = "xyes"; then
c80c69bd 1621 SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
9b571a7e 1622 SMSDRV_DIRS="$SMSDRV_DIRS kannel text2reach websms"
6fad8870 1623 HDLINK_DIRS="$HDLINK_DIRS jira"
3bc41d67 1624 AC_DEFINE(HAVE_LIBCURL, 1, Define to 1 if libcurl is available)
0a4194c2
AK
1625fi
1626
2cfe4482
VK
1627if test "x$LDAP_SUPPORT" = "xyes"; then
1628 AC_CHECK_HEADER(ldap.h,HAVE_LDAP=yes,HAVE_LDAP=no)
1629 if test "x$HAVE_LDAP" = "xyes"; then
1630 AC_CHECK_LIB(ldap, ldap_init, [ HAVE_LDAP=yes ], [ HAVE_LDAP=no ])
e8ef7fe1
VK
1631 if test "x$HAVE_LDAP" = "xyes"; then
1632 AC_CHECK_LIB(lber, ber_init, [ SERVER_LIBS="-llber $SERVER_LIBS" ], [ ])
1633 fi
2cfe4482 1634 fi
d9177dd1 1635 if test "x$HAVE_LDAP" = "xyes"; then
1636 SERVER_LIBS="-lldap $SERVER_LIBS"
2cfe4482 1637 AC_DEFINE(WITH_LDAP, 1, Define to 1 if you have LDAP libraries and headers)
d95c3dad
A
1638 AC_CHECK_HEADERS([ldap_ssl.h],,,
1639 [
1640#include <ldap.h>
a164b767 1641 ])
d95c3dad
A
1642 AC_CHECK_TYPES([ber_int_t],,,
1643 [
1644#include <ldap.h>
1645#if HAVE_LDAP_SSL_H
1646#include <ldap_ssl.h>
1647#endif
daa828ee 1648 ])
d95c3dad
A
1649
1650 OLD_LIBS="$LIBS"
1651 LIBS="$LIBS -lldap"
1652 AC_CHECK_FUNCS([ldap_initialize ldapssl_init])
1653 AC_CHECK_FUNCS([ldap_control_create ldap_create_control nsldapi_build_control])
1654 AC_CHECK_FUNCS([ldap_create_page_control ldap_parse_page_control])
1655 LIBS="$OLD_LIBS"
1656
1657 AC_CHECK_DECLS([nsldapi_build_control],,,
1658 [
1659#include <ldap.h>
1660#if HAVE_LDAP_SSL_H
1661#include <ldap_ssl.h>
1662#endif
b00236dd 1663 ])
d9177dd1 1664 fi
2cfe4482 1665 LDAP_SUPPORT="$HAVE_LDAP"
d9177dd1 1666fi
1667
ef0c727b
VK
1668#--------------------------------------------------------------------
1669# Checks for data types
1670#--------------------------------------------------------------------
1671
d16cf8a5
AK
1672AC_CHECK_SIZEOF(short)
1673AC_CHECK_SIZEOF(int)
1674AC_CHECK_SIZEOF(long)
1675AC_CHECK_SIZEOF(long long)
1676
1677AC_TYPE_PID_T
d16cf8a5
AK
1678AC_TYPE_SIZE_T
1679AC_STRUCT_TIMEZONE
1680
3071f10a 1681AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
51128b42 1682AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
1683#if HAVE_SYS_TYPES_H
1684#include <sys/types.h>
1685#endif
1686#if HAVE_SYS_SOCKET_H
1687#include <sys/socket.h>
1688#endif
1689])
e0293f7f
VK
1690AC_CHECK_TYPES([struct stat64],,,[
1691#if HAVE_SYS_STAT_H
1692#include <sys/stat.h>
1693#endif
1694])
521d90e7 1695
e25cadc9 1696
ef0c727b
VK
1697#--------------------------------------------------------------------
1698# Checks for functions
1699#--------------------------------------------------------------------
d16cf8a5
AK
1700
1701AC_FUNC_ERROR_AT_LINE
d16cf8a5 1702AC_FUNC_MEMCMP
d16cf8a5
AK
1703AC_FUNC_SELECT_ARGTYPES
1704AC_FUNC_STRFTIME
1705AC_FUNC_STRTOD
1706AC_FUNC_VPRINTF
1707
80ce37ac 1708AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
c1099678 1709AC_CHECK_FUNCS([strrchr strlwr strtol strtoul strtoll strtoull setlocale])
467e30e1 1710AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
c601fc15 1711AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
ecdf8898 1712AC_CHECK_FUNCS([fopen64 strptime timegm gethostbyname2_r getaddrinfo])
5962498b 1713AC_CHECK_FUNCS([itoa _itoa isatty getgrnam getpwnam malloc_info malloc_trim])
aa24418a 1714
9757ca46 1715AC_CHECK_DECLS([nanosleep, daemon, strerror])
be6467e9 1716
6f95ef89
VK
1717# Do not use inet_pton on Solaris as it has binary compatibility problems
1718if test "$PLATFORM" != "SunOS"; then
1719 AC_CHECK_FUNCS([inet_pton])
1720fi
1721
b0823d06
VK
1722# Check if strerror_r is POSIX-compliant
1723if test "$ac_cv_func_strerror_r" = "yes"; then
1724 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1725 AC_LANG_PUSH([C++])
1726 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
1727#if HAVE_STRING_H
1728#include <string.h>
1729#endif
1730#if HAVE_ERRNO_H
1731#include <errno.h>
1732#endif
b0823d06 1733 ]],[[
7f9423af
VK
1734 int e;
1735 char buffer[256];
1736 e = strerror_r(1, buffer, 256);
1737 return e;
b0823d06
VK
1738 ]])
1739 ],[
1740 AC_MSG_RESULT(yes)
1741 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1742 ],[
1743 AC_MSG_RESULT(no)
1744 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1745 ])
1746 AC_LANG_POP([C++])
1747fi
1748
be6467e9
VK
1749# Check if struct tm has tm_gmtoff member
1750AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1751AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1752#if HAVE_TIME_H
1753#include <time.h>
1754#endif
1755#if HAVE_SYS_TIME_H
1756#include <sys/time.h>
1757#endif
1758]],[[
be6467e9
VK
1759 struct tm t;
1760 return t.tm_gmtoff;
be6467e9
VK
1761]])
1762],[
1763AC_MSG_RESULT(yes)
1764AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1765],[
1766AC_MSG_RESULT(no)
1767])
d16cf8a5 1768
f91feddc 1769AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
1770AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1771
c6491611
VK
1772# asprintf, scprintf, etc.
1773AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1774AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
342a701d 1775AC_CHECK_FUNCS([snprintf vsnprintf])
c6491611
VK
1776
1777AC_MSG_CHECKING(whether snprintf returns required buffer size)
1778AC_RUN_IFELSE(
1779 [AC_LANG_PROGRAM([
1780#include <stdio.h>
1781#include <string.h>
1782 ], [
1783 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1784 ])
1785 ],
1786 [ AC_MSG_RESULT(yes)
1787 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1788 ],
1789 [ AC_MSG_RESULT(no) ],
1790 [ AC_MSG_RESULT(no) ]
1791)
1792
1793
ef0c727b
VK
1794#--------------------------------------------------------------------
1795# Checks for macros and definitions
1796#--------------------------------------------------------------------
dff54fed 1797
ef0c727b
VK
1798AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1799#ifdef HAVE_SYS_TYPES_H
99e50bb7 1800#include <sys/types.h>
ef0c727b
VK
1801#endif
1802#if HAVE_BYTESWAP_H
1803#include <byteswap.h>
1804#endif
1805#if HAVE_NETINET_IN_H
1806#include <netinet/in.h>
1807#endif
1808#if HAVE_NET_NH_H
1809#include <net/nh.h>
1810#endif
1811])
aa24418a
VK
1812AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1813#ifdef HAVE_UNISTD_H
1814#include <unistd.h>
1815#endif
1816#ifdef HAVE_DLFCN_H
1817#include <dlfcn.h>
1818#endif
1819])
ce7565e7
VK
1820AC_CHECK_DECLS([va_copy, __va_copy],,,[
1821#ifdef HAVE_UNISTD_H
1822#include <unistd.h>
1823#endif
1824#ifdef HAVE_STDARG_H
1825#include <stdarg.h>
1826#endif
1827#ifdef HAVE_STDLIB_H
1828#include <stdlib.h>
1829#endif
1830])
dff54fed 1831
dff54fed 1832
ef0c727b 1833#--------------------------------------------------------------------
df9812a9
VK
1834# getopt
1835#--------------------------------------------------------------------
1836
1837if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
1838 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
1839else
1840 AC_CHECK_HEADERS([getopt.h])
1841 AC_CHECK_LIB(gnugetopt, getopt_long)
1842 AC_CHECK_DECLS([getopt_long],,,[
1843#if HAVE_GETOPT_H
1844#include <getopt.h>
1845#endif
1846 ])
1847fi
1848
1849
1850#--------------------------------------------------------------------
671651a1
VK
1851# Linux specific checks
1852#--------------------------------------------------------------------
1853
1854if test "x$PLATFORM" = "xLinux"; then
1855 AC_CHECK_HEADERS([sys/reboot.h],,,[[ ]])
1856 AC_CHECK_DECLS([reboot, RB_AUTOBOOT, RB_POWER_OFF, RB_HALT_SYSTEM],,,[
1857#if HAVE_SYS_REBOOT_H
1858#include <sys/reboot.h>
1859#endif
1860 ])
1861 AC_CHECK_FUNCS([reboot],,,[
1862#if HAVE_SYS_REBOOT_H
1863#include <sys/reboot.h>
1864#endif
1865 ])
f92a016a
VK
1866
1867 AC_CHECK_HEADERS([jemalloc/jemalloc.h],
1868 [
1869 AC_CHECK_LIB(jemalloc, malloc,
1870 [
1871 WITH_JEMALLOC="yes"
1872 AC_DEFINE(WITH_JEMALLOC,1,Define to 1 if libjemalloc is used)
1873 ])
1874 ])
671651a1
VK
1875fi
1876
1877
1878#--------------------------------------------------------------------
ef0c727b
VK
1879# AIX specific checks
1880#--------------------------------------------------------------------
d16cf8a5 1881
ef0c727b
VK
1882if test "x$PLATFORM" = "xAIX"; then
1883 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
efdaffe4 1884 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
df9812a9
VK
1885#if HAVE_PROCINFO_H
1886#include <procinfo.h>
1887#endif
1888 ])
ef0c727b
VK
1889 AC_CHECK_FUNCS([getprocs64],,,[
1890#if HAVE_PROCINFO_H
1891#include <procinfo.h>
6cd41ceb 1892#endif
ef0c727b 1893 ])
7e56bf2e
VK
1894fi
1895
cd4c8ca3 1896
ef0c727b 1897#--------------------------------------------------------------------
f47bd4ca
VK
1898# Solaris specific checks
1899#--------------------------------------------------------------------
1900
1901if test "x$PLATFORM" = "xSunOS"; then
1902 AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
1903#include <sys/atomic.h>
1904 ])
1905fi
1906
1907
1908#--------------------------------------------------------------------
ba8db57b
VK
1909# HP-UX specific checks
1910#--------------------------------------------------------------------
1911
1912if test "x$PLATFORM" = "xHP-UX"; then
3268bb77 1913 AC_CHECK_HEADERS([atomic.h sys/mib.h],,,[[ ]])
f09c2d05
VK
1914 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1915#if HAVE_NET_IF_H
1916#include <net/if.h>
1917#endif
1918 ])
1919 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1920#if HAVE_SYS_MIB_H
1921#include <sys/mib.h>
1922#endif
1923 ])
cfd95c74
VK
1924
1925 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
1926 AC_LANG_PUSH([C++])
1927 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1928#include <sys/pstat.h>
1929 ]], [[
1930pst_diskinfo d;
1931int x;
1932x = (int)d.psd_dkread;
1933x = (int)d.psd_dkwrite;
1934 ]])],
1935 [
1936 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
1937 AC_MSG_RESULT(yes)
1938 ],
1939 [
1940 AC_MSG_RESULT(no)
1941 ])
1942 AC_LANG_POP([C++])
ba8db57b
VK
1943fi
1944
1945
1946#--------------------------------------------------------------------
aa24418a
VK
1947# *BSD specific checks
1948#--------------------------------------------------------------------
1949
1950AC_CHECK_LIB(kvm, kvm_open)
1951AC_CHECK_FUNCS([kvm_getswapinfo])
1952AC_CHECK_TYPES([struct kinfo_proc2],,,[
1953#if HAVE_SYS_SYSCTL_H
1954#include <sys/sysctl.h>
1955#endif
1956])
1957
1958
28ba6824
VK
1959#--------------------------------------------------------------------
1960# FreeBSD specific checks
1961#--------------------------------------------------------------------
1962
1963if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
1964 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1965#if HAVE_SYS_TYPES_H
1966#include <sys/types.h>
1967#endif
1968#if HAVE_SYS_SOCKET_H
1969#include <sys/socket.h>
1970#endif
1971#include <net/route.h>
1972 ])
28ba6824
VK
1973fi
1974
1975
aa24418a 1976#--------------------------------------------------------------------
ea6615cf
VK
1977# OpenBSD specific checks
1978#--------------------------------------------------------------------
1979
1980if test "x$PLATFORM" = "xOpenBSD"; then
1981 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
1982 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1983#include <sys/param.h>
1984#include <sys/proc.h>
1985#include <kvm.h>
1986#include <sys/user.h>
1987 ]],[[
1988 int count;
1989 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
1990 return 0;
1991 ]])
1992 ],[
1993 AC_MSG_RESULT(yes)
1994 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1995 ],[
1996 AC_MSG_RESULT(no)
1997 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1998 ])
1999
2000 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
2001 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2002#include <sys/param.h>
2003#include <sys/proc.h>
2004#include <kvm.h>
2005#include <sys/user.h>
2006 ]],[[
2007 struct kinfo_proc p;
2008 return p.kp_proc.p_pid;
2009 ]])
2010 ],[
2011 AC_MSG_RESULT(yes)
2012 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
2013 ],[
2014 AC_MSG_RESULT(no)
2015 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
2016 ])
2017fi
2018
2019
2020#--------------------------------------------------------------------
ef8a3c32
VK
2021# Minix specific checks
2022#--------------------------------------------------------------------
2023
2024if test "x$PLATFORM" = "xMinix"; then
2025 AC_CHECK_HEADERS([minix/minlib.h])
2026fi
2027
2028
2029#--------------------------------------------------------------------
ef0c727b
VK
2030# Check for UNICODE stuff
2031#--------------------------------------------------------------------
3e39fcde 2032
5a82ecc7 2033AC_CHECK_HEADERS([wchar.h wctype.h iconv.h widec.h])
aa24418a 2034AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
2035#if HAVE_WCHAR_H
2036#include <wchar.h>
2037#endif
2038])
f172d7b7
VK
2039AC_CHECK_SIZEOF(wchar_t,,[
2040#if HAVE_WCHAR_H
2041#include <wchar.h>
2042#endif
2043])
fdf1ed50
VK
2044AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper towlower])
2045AC_CHECK_FUNCS([wcslwr wcserror wcserror_r wfopen wfopen64 fputws putws])
2046AC_CHECK_FUNCS([wopen wstat waccess wgetenv wrename wunlink wremove wchdir])
2047AC_CHECK_FUNCS([wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod vwscanf])
2048AC_CHECK_FUNCS([vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
9138dfe2 2049AC_CHECK_FUNCS([itow _itow])
dff54fed 2050
3265ba38 2051if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 2052 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 2053 [ ac_found_iconv=yes
8d131dda 2054 LIBS="$LIBS -liconv"
75c30ed4
VK
2055 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
2056 ],
2057 [
2058 AC_CHECK_LIB(iconv, iconv,
2059 [ ac_found_iconv=yes
8d131dda 2060 LIBS="$LIBS -liconv"
75c30ed4
VK
2061 ])
2062 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
2063 ])
dff54fed
VK
2064else
2065 ac_found_iconv=no
ef0c727b 2066 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 2067fi
93571e7f 2068
3bf0df9f
VK
2069AC_MSG_CHECKING(whether fgetws can be used with popen)
2070AC_RUN_IFELSE(
2071 [AC_LANG_PROGRAM([
2072#include <stdio.h>
2073#ifdef HAVE_UNISTD_H
2074#include <unistd.h>
2075#endif
2076#if HAVE_WCHAR_H
2077#include <wchar.h>
2078#endif
2079 ], [[
2080 int rc = 1;
2081 wchar_t line[4096];
2082 FILE *f = popen("echo test", "r");
2083 if(f!=NULL)
2084 {
2085 fgetws(line, 4096, f);
2086 pclose(f);
2087 rc = 0;
2088 }
2089 return rc;
2090 ]])
2091 ],
2092 [ AC_MSG_RESULT(yes)
2093 AC_DEFINE(SAFE_FGETWS_WITH_POPEN, 1, Define to 1 if fgetws can be used with popen)
2094 ],
2095 [ AC_MSG_RESULT(no) ],
2096 [ AC_MSG_RESULT(no) ]
2097)
2098
93571e7f
VK
2099AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
2100AC_RUN_IFELSE(
2101 [AC_LANG_PROGRAM([
2102#if HAVE_ICONV_H
2103#include <iconv.h>
2104#endif
2105 ], [
2106 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
2107 ])
2108 ],
2109 [ AC_MSG_RESULT(yes)
2110 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
2111 valid_ucs2_code="UCS-2-INTERNAL"
2112 ],
2113 [ AC_MSG_RESULT(no) ],
2114 [ AC_MSG_RESULT(no) ]
2115)
2116
2117AC_MSG_CHECKING(whether iconv supports UCS-2)
2118AC_RUN_IFELSE(
2119 [AC_LANG_PROGRAM([
2120#if HAVE_ICONV_H
2121#include <iconv.h>
2122#endif
2123 ], [
2124 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
2125 ])
2126 ],
2127 [ AC_MSG_RESULT(yes)
2128 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
2129 valid_ucs2_code="UCS-2"
2130 ],
2131 [ AC_MSG_RESULT(no) ],
8b86c5dc 2132 [ AC_MSG_RESULT(no) ]
93571e7f
VK
2133)
2134
2135AC_MSG_CHECKING(whether iconv supports UCS2)
2136AC_RUN_IFELSE(
2137 [AC_LANG_PROGRAM([
2138#if HAVE_ICONV_H
2139#include <iconv.h>
2140#endif
2141 ], [
2142 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
2143 ])
2144 ],
2145 [ AC_MSG_RESULT(yes)
2146 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
2147 valid_ucs2_code="UCS2"
2148 ],
2149 [ AC_MSG_RESULT(no) ],
2150 [ AC_MSG_RESULT(no) ]
2151)
2152
44bccbbc
VK
2153AC_MSG_CHECKING(whether iconv supports UCS-2BE)
2154AC_RUN_IFELSE(
2155 [AC_LANG_PROGRAM([
2156#if HAVE_ICONV_H
2157#include <iconv.h>
2158#endif
2159 ], [
2160 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
2161 ])
2162 ],
2163 [ AC_MSG_RESULT(yes)
2164 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
2165 valid_ucs2_code="UCS-2BE"
2166 ],
2167 [ AC_MSG_RESULT(no) ],
2168 [ AC_MSG_RESULT(no) ]
2169)
2170
6e17f325
VK
2171AC_MSG_CHECKING(whether iconv supports UCS-2LE)
2172AC_RUN_IFELSE(
2173 [AC_LANG_PROGRAM([
2174#if HAVE_ICONV_H
2175#include <iconv.h>
2176#endif
2177 ], [
2178 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
2179 ])
2180 ],
2181 [ AC_MSG_RESULT(yes)
2182 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
2183 valid_ucs2_code="UCS-2LE"
2184 ],
2185 [ AC_MSG_RESULT(no) ],
2186 [ AC_MSG_RESULT(no) ]
2187)
2188
4a4e1feb
VK
2189AC_MSG_CHECKING(whether iconv supports UTF-16)
2190AC_RUN_IFELSE(
2191 [AC_LANG_PROGRAM([
2192#if HAVE_ICONV_H
2193#include <iconv.h>
2194#endif
2195 ], [
2196 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
2197 ])
2198 ],
2199 [ AC_MSG_RESULT(yes)
2200 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
2201 valid_ucs2_code="UTF-16"
2202 ],
2203 [ AC_MSG_RESULT(no) ],
2204 [ AC_MSG_RESULT(no) ]
2205)
2206
8b86c5dc
VK
2207AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
2208AC_RUN_IFELSE(
2209 [AC_LANG_PROGRAM([
2210#if HAVE_ICONV_H
2211#include <iconv.h>
2212#endif
2213 ], [
2214 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
2215 ])
2216 ],
2217 [ AC_MSG_RESULT(yes)
2218 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
2219 valid_ucs4_code="UCS-4-INTERNAL"
2220 ],
2221 [ AC_MSG_RESULT(no) ],
2222 [ AC_MSG_RESULT(no) ]
2223)
2224
2225AC_MSG_CHECKING(whether iconv supports UCS-4)
2226AC_RUN_IFELSE(
2227 [AC_LANG_PROGRAM([
2228#if HAVE_ICONV_H
2229#include <iconv.h>
2230#endif
2231 ], [
2232 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
2233 ])
2234 ],
2235 [ AC_MSG_RESULT(yes)
2236 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
2237 valid_ucs4_code="UCS-4"
2238 ],
2239 [ AC_MSG_RESULT(no) ],
2240 [ AC_MSG_RESULT(no) ]
2241)
2242
2243AC_MSG_CHECKING(whether iconv supports UCS4)
2244AC_RUN_IFELSE(
2245 [AC_LANG_PROGRAM([
2246#if HAVE_ICONV_H
2247#include <iconv.h>
2248#endif
2249 ], [
2250 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
2251 ])
2252 ],
2253 [ AC_MSG_RESULT(yes)
2254 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
2255 valid_ucs4_code="UCS4"
2256 ],
2257 [ AC_MSG_RESULT(no) ],
2258 [ AC_MSG_RESULT(no) ]
2259)
2260
2261AC_MSG_CHECKING(whether iconv supports UCS-4BE)
2262AC_RUN_IFELSE(
2263 [AC_LANG_PROGRAM([
2264#if HAVE_ICONV_H
2265#include <iconv.h>
2266#endif
2267 ], [
2268 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
2269 ])
2270 ],
2271 [ AC_MSG_RESULT(yes)
2272 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
2273 valid_ucs4_code="UCS-4BE"
2274 ],
2275 [ AC_MSG_RESULT(no) ],
2276 [ AC_MSG_RESULT(no) ]
2277)
2278
6e17f325
VK
2279AC_MSG_CHECKING(whether iconv supports UCS-4LE)
2280AC_RUN_IFELSE(
2281 [AC_LANG_PROGRAM([
2282#if HAVE_ICONV_H
2283#include <iconv.h>
2284#endif
2285 ], [
2286 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
2287 ])
2288 ],
2289 [ AC_MSG_RESULT(yes)
2290 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
2291 valid_ucs4_code="UCS-4LE"
2292 ],
2293 [ AC_MSG_RESULT(no) ],
2294 [ AC_MSG_RESULT(no) ]
2295)
2296
4a4e1feb
VK
2297AC_MSG_CHECKING(whether iconv supports UTF-32)
2298AC_RUN_IFELSE(
2299 [AC_LANG_PROGRAM([
2300#if HAVE_ICONV_H
2301#include <iconv.h>
2302#endif
2303 ], [
2304 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
2305 ])
2306 ],
2307 [ AC_MSG_RESULT(yes)
2308 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
2309 valid_ucs4_code="UTF-32"
2310 ],
2311 [ AC_MSG_RESULT(no) ],
2312 [ AC_MSG_RESULT(no) ]
2313)
2314
93571e7f
VK
2315AC_MSG_CHECKING(whether iconv supports //IGNORE)
2316AC_RUN_IFELSE(
2317 [AC_LANG_PROGRAM([
2318#if HAVE_ICONV_H
2319#include <iconv.h>
2320#endif
2321 ], [
2322 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
2323 ])
2324 ],
2325 [ AC_MSG_RESULT(yes)
2326 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
2327 ],
2328 [ AC_MSG_RESULT(no) ],
2329 [ AC_MSG_RESULT(no) ]
2330)
3e39fcde 2331
bd96aa53
VK
2332AC_MSG_CHECKING(whether iconv supports state reset)
2333AC_RUN_IFELSE(
2334 [AC_LANG_PROGRAM([
2335#include <stdio.h>
2336#if HAVE_ICONV_H
2337#include <iconv.h>
2338#endif
2339 ], [
2340 iconv_t cd = iconv_open("UTF-8","$valid_ucs2_code");
2341 if (cd == (iconv_t)(-1)) return 1;
2342 return iconv(cd, NULL, NULL, NULL, NULL) != 0;
2343 ])
2344 ],
2345 [ AC_MSG_RESULT(yes)
2346 AC_DEFINE(HAVE_ICONV_STATE_RESET, 1, Define to 1 if iconv supports state reset)
2347 ],
2348 [ AC_MSG_RESULT(no) ],
2349 [ AC_MSG_RESULT(no) ]
2350)
2351
2352AC_MSG_CHECKING(whether iconv descriptor cache is needed)
2353case $enable_iconv_cache in
2354 auto)
2355 case $PLATFORM in
2356 SunOS|HP-UX|AIX)
2357 enable_iconv_cache=yes
2358 ;;
2359 *)
2360 enable_iconv_cache=no
2361 ;;
2362 esac
2363 ;;
2364 yes|no)
2365 ;;
2366 *)
2367 AC_MSG_ERROR([Value given to --enable-iconv-cache must be one of yes, no or auto])
2368 ;;
2369esac
2370if test "x$enable_iconv_cache" = "xyes"; then
2371 AC_DEFINE(WITH_ICONV_CACHE, 1, Define to 1 to enable iconv descriptor cache)
2372fi
2373AC_MSG_RESULT($enable_iconv_cache)
2374
19619a35
AK
2375# taken from ZSH's configure
2376# Check if iconv uses const in prototype declaration
24b1570c 2377if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 2378 AC_LANG_PUSH([C++])
19619a35 2379 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
2380 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2381#include <stdlib.h>
f6a2136d 2382#if HAVE_ICONV_H
7f9423af 2383#include <iconv.h>
f6a2136d 2384#endif
f6a2136d
VK
2385 ]],
2386 [[
3e51d371
VK
2387 char **p = NULL;
2388 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 2389 ]])],
3e51d371
VK
2390 [ac_cv_iconv_const=const],
2391 [ac_cv_iconv_const=])])
53c96e2d 2392 AC_LANG_POP([C++])
19619a35
AK
2393 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2394 [Define as const if the declaration of iconv() needs const.])
2395fi
2396
a67fa146
VK
2397if test "x$ac_cv_type_wchar_t" = "xyes"; then
2398 if test $ac_cv_sizeof_wchar_t -eq 2; then
2399 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2400 fi
8b86c5dc 2401
a67fa146
VK
2402 if test $ac_cv_sizeof_wchar_t -eq 4; then
2403 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2404 fi
2405
2406 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2407 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2408 fi
2409else
2410 if test "x$BUILD_UNICODE" = "xyes"; then
2411 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2412 fi
8b86c5dc
VK
2413fi
2414
c29360a9 2415
ef0c727b 2416#--------------------------------------------------------------------
ca0f4ea3
VK
2417# MySQL
2418#--------------------------------------------------------------------
2419
2420check_substr "$COMPONENTS" "mysql"
2421if test $? = 0; then
9f1ea006
VK
2422 OLD_CPPFLAGS="$CPPFLAGS"
2423 OLD_LDFLAGS="$LDFLAGS"
2424 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2425
2426 CPPFLAGS="$CPPFLAGS $MYSQL_CPPFLAGS"
2427 LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
2428 if test "x$MYSQL_LD_RUN_PATH" != "x"; then
2429 LD_RUN_PATH="${MYSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2430 fi
2431
b93fd1c1 2432 AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MySQL client installation]))
9f1ea006 2433
6fce76d8 2434 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 2435 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 2436
8d131dda
VK
2437 OLD_LIBS="$LIBS"
2438 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 2439
ca0f4ea3 2440 AC_CHECK_FUNCS(mysql_real_escape_string)
9f1ea006
VK
2441
2442 CPPFLAGS="$OLD_CPPFLAGS"
2443 LDFLAGS="$OLD_LDFLAGS"
2444 LD_RUN_PATH="$OLD_LD_RUN_PATH"
8d131dda 2445 LIBS="$OLD_LIBS"
ca0f4ea3
VK
2446fi
2447
2448
2449#--------------------------------------------------------------------
58ed4897
VK
2450# PostgreSQL
2451#--------------------------------------------------------------------
2452
203458b7 2453check_substr "$COMPONENTS" "pgsql"
58ed4897 2454if test $? = 0; then
b535eed6
VK
2455 OLD_CPPFLAGS="$CPPFLAGS"
2456 OLD_LDFLAGS="$LDFLAGS"
2457 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2458
2459 CPPFLAGS="$CPPFLAGS $PGSQL_CPPFLAGS"
2460 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
2461 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2462 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2463 fi
2464
9f1ea006
VK
2465 AC_CHECK_HEADER(libpq-fe.h,,AC_MSG_ERROR([Cannot find libpq-fe.h - check your PostgreSQL client installation]))
2466
58ed4897 2467 AC_CHECK_LIB(m, floor)
b535eed6
VK
2468 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2469 if test "x$PLATFORM" = "xSunOS"; then
2470 PGSQL_LDFLAGS="$PGSQL_LDFLAGS/sparcv9"
2471 LDFLAGS="$OLD_LDFLAGS $PGSQL_LDFLAGS"
2472 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2473 PGSQL_LD_RUN_PATH="$PGSQL_LD_RUN_PATH/sparcv9"
2474 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${OLD_LD_RUN_PATH:+:}${OLD_LD_RUN_PATH}"
2475 fi
2476 unset ac_cv_lib_pq_PQconnectdb
2477 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2478 AC_MSG_ERROR(libpq is required for PostgreSQL support)])
2479 else
2480 AC_MSG_ERROR(libpq is required for PostgreSQL support)
2481 fi
2482 ])
6fce76d8 2483
b535eed6
VK
2484 CPPFLAGS="$OLD_CPPFLAGS"
2485 LDFLAGS="$OLD_LDFLAGS"
2486 LD_RUN_PATH="$OLD_LD_RUN_PATH"
58ed4897
VK
2487fi
2488
2489
2490#--------------------------------------------------------------------
9c29f76e
VK
2491# ODBC
2492#--------------------------------------------------------------------
2493
2494check_substr "$COMPONENTS" "odbc"
2495if test $? = 0; then
2cfe4482
VK
2496 OLD_CPPFLAGS="$CPPFLAGS"
2497 OLD_LDFLAGS="$LDFLAGS"
2498 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2499
2500 CPPFLAGS="$CPPFLAGS $ODBC_CPPFLAGS"
b535eed6 2501 LDFLAGS="$LDFLAGS $ODBC_LDFLAGS"
2cfe4482
VK
2502 if test "x$ODBC_LD_RUN_PATH" != "x"; then
2503 LD_RUN_PATH="${ODBC_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2504 fi
2505
6fce76d8 2506 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 2507 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
2508 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2509 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
2510 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
2511 fi
2cfe4482
VK
2512
2513 CPPFLAGS="$OLD_CPPFLAGS"
2514 LDFLAGS="$OLD_LDFLAGS"
2515 LD_RUN_PATH="$OLD_LD_RUN_PATH"
9c29f76e
VK
2516fi
2517
2518
2519#--------------------------------------------------------------------
41b4790d
VK
2520# Oracle
2521#--------------------------------------------------------------------
2522
2523check_substr "$COMPONENTS" "oracle"
2524if test $? = 0; then
2cfe4482
VK
2525 OLD_CPPFLAGS="$CPPFLAGS"
2526 OLD_LDFLAGS="$LDFLAGS"
2527 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2528
2529 CPPFLAGS="$CPPFLAGS $ORACLE_CPPFLAGS"
b535eed6 2530 LDFLAGS="$LDFLAGS $ORACLE_LDFLAGS"
2cfe4482
VK
2531 if test "x$ORACLE_LD_RUN_PATH" != "x"; then
2532 LD_RUN_PATH="${ORACLE_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2533 fi
2534
41b4790d 2535 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
e5cceced 2536 AC_CHECK_LIB(nnz12, nzstrcpy, [NNZ_LIB=-lnnz12],
7d8c91ef 2537 [
e5cceced
VK
2538 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
2539 [
2540 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
2541 ], [-lclntsh])
7d8c91ef
VK
2542 ], [-lclntsh])
2543 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
2544 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 2545 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
2546 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2547 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
2548 fi
2cfe4482
VK
2549
2550 CPPFLAGS="$OLD_CPPFLAGS"
2551 LDFLAGS="$OLD_LDFLAGS"
2552 LD_RUN_PATH="$OLD_LD_RUN_PATH"
41b4790d
VK
2553fi
2554
84277a0f
AK
2555#--------------------------------------------------------------------
2556# DB2
2557#--------------------------------------------------------------------
2558
2559check_substr "$COMPONENTS" "db2"
2560if test $? = 0; then
2561 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
2562 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
2563 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
6afe141e 2564 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2565 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
2566 fi
84277a0f 2567fi
41b4790d
VK
2568
2569#--------------------------------------------------------------------
37861c72
VK
2570# Informix
2571#--------------------------------------------------------------------
2572
2573check_substr "$COMPONENTS" "informix"
2574if test $? = 0; then
2575 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
2576 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
2577 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
2578 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2579 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
2580 fi
37861c72
VK
2581fi
2582
c3cfc039
VK
2583
2584#--------------------------------------------------------------------
50e4bc8c
VK
2585# Java
2586#--------------------------------------------------------------------
2587
2588check_substr "$COMPONENTS" "java"
2589if test $? = 0; then
2590 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
50e4bc8c
VK
2591fi
2592
2593
2594#--------------------------------------------------------------------
b14c3f22
VK
2595# Tuxedo
2596#--------------------------------------------------------------------
2597
2598check_substr "$COMPONENTS" "tuxedo"
2599if test $? = 0; then
2600 OLD_CPPFLAGS="$CPPFLAGS"
2601 OLD_LDFLAGS="$LDFLAGS"
2602 OLD_LIBS="$LIBS"
2603
2604 if test "x$TUXEDO_BASE" != "x"; then
2605 TUXEDO_CPPFLAGS="-I$TUXEDO_BASE/include"
2606 TUXEDO_LDFLAGS="-L$TUXEDO_BASE/lib"
2607 CPPFLAGS="$CPPFLAGS $TUXEDO_CPPFLAGS"
2608 LDFLAGS="$LDFLAGS $TUXEDO_LDFLAGS"
2609 fi
2610
2611 AC_CHECK_HEADER(atmi.h,,AC_MSG_ERROR([*** Cannot find atmi.h - check your Tuxedo installation ***]))
2612
2613 # https://community.oracle.com/thread/2346582
2614 if test "x$PLATFORM" = "xLinux"; then
2615 TUXEDO_LDFLAGS="$TUXEDO_LDFLAGS -Xlinker --no-as-needed"
2616 LDFLAGS="$LDFLAGS -Xlinker --no-as-needed"
2617 fi
6d14d0b0
VK
2618
2619 if test "$PLATFORM" = "SunOS"; then
2620 AC_CHECK_LIB(rt, nanosleep, [ TUXEDO_LIBS="$TUXEDO_LIBS -lrt" ])
2621 fi
2622
73517e51
VK
2623 if test "$PLATFORM" = "AIX"; then
2624 AC_MSG_CHECKING(for xa_switchp in libengine)
2625 OLD_LIBS_LIBENGINE="$LIBS"
2626 LIBS="$LIBS -lengine"
2627 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ extern char *xa_switchp; ]], [[ *xa_switchp = 0; ]])],
2628 [
2629 AC_MSG_RESULT(yes)
2630 TUXEDO_LIBS="$TUXEDO_LIBS -lengine"
2631 ],
2632 [ AC_MSG_RESULT(no) ])
2633 LIBS="$OLD_LIBS_LIBENGINE"
2634 fi
2635
6d14d0b0 2636 LIBS="$LIBS $TUXEDO_LIBS"
73517e51 2637 AC_CHECK_LIB(tux, tpcall, [], [AC_MSG_ERROR(libtux is required for Tuxedo support)])
b14c3f22
VK
2638
2639 CPPFLAGS="$OLD_CPPFLAGS"
2640 LDFLAGS="$OLD_LDFLAGS"
2641 LIBS="$OLD_LIBS"
73517e51
VK
2642
2643 if test "x$PLATFORM" = "xAIX"; then
2644 if test -e $TUXEDO_BASE/lib/tpinit.o; then
2645 TUXEDO_LIBS="$TUXEDO_BASE/lib/tpinit.o $TUXEDO_LIBS"
2646 fi
2647 fi
b14c3f22
VK
2648fi
2649
d6235717 2650#--------------------------------------------------------------------
2651# MongoDB
2652#--------------------------------------------------------------------
2653
2654check_substr "$COMPONENTS" "mongodb"
2655if test $? = 0; then
2656 OLD_CPPFLAGS="$CPPFLAGS"
2657 OLD_LDFLAGS="$LDFLAGS"
2658 OLD_LIBS="$LIBS"
2659
2660 if test "x$MONGODB_BASE" != "x"; then
2661 MONGODB_CPPFLAGS="-I$MONGODB_BASE/include/libmongoc-1.0/ -I$MONGODB_BASE/include/libbson-1.0/"
2662 MONGODB_LDFLAGS="-L$MONGODB_BASE/lib"
2663 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
2664 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
2665 else
2666 MONGODB_CPPFLAGS="-I/usr/local/include/libmongoc-1.0/ -I/usr/local/include/libbson-1.0/"
2667 MONGODB_LDFLAGS="-L/usr/local/lib"
2668 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
2669 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
2670 fi
2671
2672 AC_CHECK_HEADER(mongoc.h,,AC_MSG_ERROR([*** Cannot find mongoc.h - check your MongoDB installation ***]))
2673 AC_CHECK_LIB(mongoc-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lmongoc-1.0" ])
2674 AC_CHECK_LIB(bson-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lbson-1.0" ])
2675
2676 LIBS="$LIBS $MONGODB_LIBS"
2677
2678 CPPFLAGS="$OLD_CPPFLAGS"
2679 LDFLAGS="$OLD_LDFLAGS"
2680 LIBS="$OLD_LIBS"
2681fi
b14c3f22
VK
2682
2683#--------------------------------------------------------------------
ca0f4ea3
VK
2684# Other settings
2685#--------------------------------------------------------------------
2686
a5a95ac8
VK
2687if test "x$RUNTIME_PREFIX" = "x"; then
2688 if test "x${BUILD_UNICODE}" = "xyes"; then
f434ab60 2689 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\" -DSTATEDIR=L\\\"\${localstatedir}/lib/netxms\\\""
a5a95ac8 2690 else
f434ab60 2691 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\" -DSTATEDIR=\\\"\${localstatedir}/lib/netxms\\\""
a5a95ac8 2692 fi
b07c50cc 2693else
a5a95ac8 2694 if test "x${BUILD_UNICODE}" = "xyes"; then
f434ab60 2695 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"$RUNTIME_PREFIX\\\" -DDATADIR=L\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=L\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=L\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=L\\\"$RUNTIME_PREFIX/lib/netxms\\\" -DSTATEDIR=L\\\"$RUNTIME_PREFIX/var/lib/netxms\\\""
a5a95ac8 2696 else
f434ab60 2697 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"$RUNTIME_PREFIX\\\" -DDATADIR=\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=\\\"$RUNTIME_PREFIX/lib/netxms\\\" -DSTATEDIR=\\\"$RUNTIME_PREFIX/var/lib/netxms\\\""
a5a95ac8 2698 fi
b07c50cc 2699fi
545bda2d 2700LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 2701
25ae8377
VK
2702if test "x${ENABLE_WERROR}" = "xyes"; then
2703 CPPFLAGS="$CPPFLAGS -Werror"
2704fi
2705
cbc4d191
VK
2706if test "x$PLATFORM" = "xDarwin"; then
2707 SHLIB_SUFFIX=".so"
2708else
2709 if test "x$shrext_cmds" != "x"; then
2710 SHLIB_SUFFIX="$shrext_cmds"
2711 else
2712 SHLIB_SUFFIX=".so"
2713 fi
2b479c92 2714fi
cbc4d191 2715AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$SHLIB_SUFFIX"), [Define to platform's shared library suffix])
2b479c92 2716
8c9993b4
VK
2717if test "x$ENABLE_DEBUG" = "xno"; then
2718 CPPFLAGS="$CPPFLAGS -DNDEBUG"
2719fi
2720
f92a016a
VK
2721if test "x$WITH_JEMALLOC" = "xyes"; then
2722 LIBS="$LIBS -ljemalloc"
2723fi
2724
551ec9ca 2725AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 2726AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
f5393033 2727AM_CONDITIONAL([USE_INTERNAL_JANSSON], [test "x$HAVE_JANSSON" = "xno"])
1fd41bcd 2728AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
c1165d33
VK
2729AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
2730AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
eca43970 2731AM_CONDITIONAL([USE_ENCRYPTION], [test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"])
6dde8627 2732AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
058bf6fc 2733AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
8b86c5dc 2734
ca0f4ea3
VK
2735
2736#--------------------------------------------------------------------
8a96930f
AK
2737# Cleanup variables
2738#--------------------------------------------------------------------
2739
2740AS_IF([test "x$with_dist" = "xyes"],
2741[
2742 SUBAGENT_DIRS=`echo $SUBAGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2743 MODULES=`echo $MODULES|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2744 SMSDRV_DIRS=`echo $SMSDRV_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2745 HDLINK_DIRS=`echo $HDLINK_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2746])
2747
2748#--------------------------------------------------------------------
ef0c727b
VK
2749# Substitute variables
2750#--------------------------------------------------------------------
82fa7c5d 2751
ef0c727b
VK
2752AC_SUBST(DB_DRIVERS)
2753AC_SUBST(MODULES)
2754AC_SUBST(SUBAGENT_DIRS)
7dda4453 2755AC_SUBST(SERVER_INCLUDE)
7c48e2aa 2756AC_SUBST(SERVER_LIBS)
ef0c727b 2757AC_SUBST(SERVER_TOOLS)
c20f8eb7 2758AC_SUBST(SMSDRV_DIRS)
6fad8870 2759AC_SUBST(HDLINK_DIRS)
52a2232c 2760AC_SUBST(PDSDRV_DIRS)
ef0c727b
VK
2761AC_SUBST(TOP_LEVEL_MODULES)
2762AC_SUBST(CONTRIB_MODULES)
c2612d83 2763AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
2764AC_SUBST(STATIC_SUBAGENT_LIST)
2765AC_SUBST(SUBAGENT_LIBS)
2766AC_SUBST(BUILD_SERVER)
447350a9 2767AC_SUBST(BUILD_SDK)
2cfe4482
VK
2768AC_SUBST(MYSQL_CPPFLAGS)
2769AC_SUBST(MYSQL_LDFLAGS)
6fce76d8 2770AC_SUBST(MYSQL_LIBS)
2cfe4482
VK
2771AC_SUBST(PGSQL_CPPFLAGS)
2772AC_SUBST(PGSQL_LDFLAGS)
6fce76d8 2773AC_SUBST(PGSQL_LIBS)
2cfe4482
VK
2774AC_SUBST(ORACLE_CPPFLAGS)
2775AC_SUBST(ORACLE_LDFLAGS)
7d8c91ef 2776AC_SUBST(ORACLE_LIBS)
2cfe4482
VK
2777AC_SUBST(ODBC_CPPFLAGS)
2778AC_SUBST(ODBC_LDFLAGS)
6fce76d8 2779AC_SUBST(ODBC_LIBS)
2cfe4482
VK
2780AC_SUBST(DB2_CPPFLAGS)
2781AC_SUBST(DB2_LDFLAGS)
84277a0f 2782AC_SUBST(DB2_LIBS)
2cfe4482
VK
2783AC_SUBST(INFORMIX_CPPFLAGS)
2784AC_SUBST(INFORMIX_LDFLAGS)
87f1fff0 2785AC_SUBST(INFORMIX_LIBS)
11ce9a66 2786AC_SUBST(OBJECT_MODE)
9113e749 2787AC_SUBST(SQLFLAGS)
cbc4d191 2788AC_SUBST(SHLIB_SUFFIX)
b14c3f22
VK
2789AC_SUBST(TUXEDO_CPPFLAGS)
2790AC_SUBST(TUXEDO_LDFLAGS)
6d14d0b0 2791AC_SUBST(TUXEDO_LIBS)
d6235717 2792AC_SUBST(MONGODB_CPPFLAGS)
2793AC_SUBST(MONGODB_LDFLAGS)
2794AC_SUBST(MONGODB_LIBS)
b5e5849b 2795AC_SUBST(INSTALL_LIBPATH)
d16cf8a5 2796
ef0c727b
VK
2797#--------------------------------------------------------------------
2798# Shared libs versions
d16cf8a5
AK
2799#
2800# versioning scheme: current:revision:age
2801#
2802# current
2803# The number of the current interface exported by the library. A current
2804# value of `0', means that you are calling the interface exported by this
2805# library interface 0.
2806#
2807# revision
2808# The implementation number of the most recent interface exported by this
2809# library. In this case, a revision value of `0' means that this is the
2810# first implementation of the interface.
2811# If the next release of this library exports the same interface, but has a
2812# different implementation (perhaps some bugs have been fixed), the revision
2813# number will be higher, but current number will be the same. In that case,
2814# when given a choice, the library with the highest revision will always
2815# be used by the runtime loader.
2816#
2817# age
2818# The number of previous additional interfaces supported by this library.
2819# If age were `2', then this library can be linked into executables which
2820# were built with a release of this library that exported the current
2821# interface number, current, or any of the previous two interfaces.
2822# By definition age must be less than or equal to current. At the outset,
2823# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 2824#--------------------------------------------------------------------
d16cf8a5 2825
359784de 2826NETXMS_LIBRARY_VERSION=2:0:0
c7d14846 2827AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 2828
ef0c727b
VK
2829#--------------------------------------------------------------------
2830# Generate output files
2831#--------------------------------------------------------------------
d16cf8a5
AK
2832
2833AC_CONFIG_FILES([
0c3c0c39
AK
2834 Makefile
2835 contrib/Makefile
36874eca
VK
2836 contrib/backgrounds/Makefile
2837 contrib/integration/Makefile
2838 contrib/integration/HP_EVA/Makefile
bad6cc0c 2839 contrib/integration/HP_P2000/Makefile
36874eca 2840 contrib/mibs/Makefile
19e3290a 2841 contrib/music/Makefile
0c3c0c39 2842 contrib/startup/Makefile
fa66d60c 2843 contrib/startup/debian/Makefile
daaefaaf 2844 contrib/startup/gentoo/Makefile
7483d0bf 2845 contrib/startup/hp-ux/Makefile
0c3c0c39 2846 contrib/startup/redhat/Makefile
5de3893d 2847 contrib/startup/suse/Makefile
9993edf4 2848 contrib/startup/ubuntu/Makefile
6adf3219 2849 contrib/startup/solaris/Makefile
27fc5ee9
AK
2850 debian/Makefile
2851 debian/patches/Makefile
2852 debian/source/Makefile
0c3c0c39 2853 doc/Makefile
a48203d2
VK
2854 doc/internal/Makefile
2855 doc/manuals/Makefile
2856 doc/misc/Makefile
0c3c0c39
AK
2857 images/Makefile
2858 include/Makefile
2859 m4/Makefile
0c3c0c39 2860 src/Makefile
9191f6ad 2861 src/agent/Makefile
6ac698ed 2862 src/agent/appagent/Makefile
9191f6ad
VK
2863 src/agent/core/Makefile
2864 src/agent/install/Makefile
359784de 2865 src/agent/libnxagent/Makefile
52275230 2866 src/agent/libnxappc/Makefile
a2a24e9d 2867 src/agent/libnxsd/Makefile
9191f6ad 2868 src/agent/subagents/Makefile
9191f6ad 2869 src/agent/subagents/aix/Makefile
df8b3df7 2870 src/agent/subagents/darwin/Makefile
52f5ee00
VK
2871 src/agent/subagents/db2/Makefile
2872 src/agent/subagents/dbquery/Makefile
ab1e80fd 2873 src/agent/subagents/devemu/Makefile
e58b0f75 2874 src/agent/subagents/ds18x20/Makefile
80e96a82 2875 src/agent/subagents/ecs/Makefile
ab1e80fd 2876 src/agent/subagents/filemgr/Makefile
9191f6ad 2877 src/agent/subagents/freebsd/Makefile
80e96a82
VK
2878 src/agent/subagents/hpux/Makefile
2879 src/agent/subagents/informix/Makefile
9191f6ad 2880 src/agent/subagents/ipso/Makefile
50e4bc8c
VK
2881 src/agent/subagents/java/Makefile
2882 src/agent/subagents/java/java/Makefile
2883 src/agent/subagents/java/java/src/Makefile
2884 src/agent/subagents/java/java/src/main/Makefile
2885 src/agent/subagents/java/java/src/main/java/Makefile
2886 src/agent/subagents/java/java/src/main/java/org/Makefile
2887 src/agent/subagents/java/java/src/main/java/org/netxms/Makefile
2888 src/agent/subagents/java/java/src/main/java/org/netxms/agent/Makefile
3118008e 2889 src/agent/subagents/java/java/src/main/java/org/netxms/agent/adapters/Makefile
d2f78ba0 2890 src/agent/subagents/java/sample/Makefile
688dad5a
VK
2891 src/agent/subagents/java/sample/src/Makefile
2892 src/agent/subagents/java/sample/src/main/Makefile
2893 src/agent/subagents/java/sample/src/main/java/Makefile
2894 src/agent/subagents/java/sample/src/main/java/org/Makefile
2895 src/agent/subagents/java/sample/src/main/java/org/netxms/Makefile
2896 src/agent/subagents/java/sample/src/main/java/org/netxms/agent/Makefile
2897 src/agent/subagents/java/sample/src/main/java/org/netxms/agent/demo/Makefile
80e96a82 2898 src/agent/subagents/linux/Makefile
df8b3df7 2899 src/agent/subagents/lmsensors/Makefile
80e96a82
VK
2900 src/agent/subagents/logwatch/Makefile
2901 src/agent/subagents/netbsd/Makefile
df8b3df7 2902 src/agent/subagents/netsvc/Makefile
80e96a82
VK
2903 src/agent/subagents/odbcquery/Makefile
2904 src/agent/subagents/openbsd/Makefile
4d1753cd 2905 src/agent/subagents/oracle/Makefile
9191f6ad 2906 src/agent/subagents/ping/Makefile
80e96a82 2907 src/agent/subagents/portCheck/Makefile
df8b3df7 2908 src/agent/subagents/rpi/Makefile
9191f6ad 2909 src/agent/subagents/sms/Makefile
80e96a82 2910 src/agent/subagents/sunos/Makefile
b14c3f22 2911 src/agent/subagents/tuxedo/Makefile
d6235717 2912 src/agent/subagents/mongodb/Makefile
de1205d5 2913 src/agent/subagents/ubntlw/Makefile
9191f6ad 2914 src/agent/subagents/ups/Makefile
80e96a82
VK
2915 src/agent/subagents/winnt/Makefile
2916 src/agent/subagents/winperf/Makefile
52f5ee00 2917 src/agent/subagents/wmi/Makefile
0bd64860 2918 src/agent/tools/Makefile
6ac698ed 2919 src/agent/tools/nxappget/Makefile
0bd64860 2920 src/agent/tools/nxapush/Makefile
c2612d83 2921 src/client/Makefile
551592f4 2922 src/client/install/Makefile
be03fec6 2923 src/client/libnxclient/Makefile
c94fa5c2 2924 src/client/nxalarm/Makefile
e84701c5
VK
2925 src/client/nxevent/Makefile
2926 src/client/nxpush/Makefile
59ffa5b7 2927 src/client/nxsms/Makefile
d1834406
VK
2928 src/db/Makefile
2929 src/db/dbdrv/Makefile
87f1fff0
VK
2930 src/db/dbdrv/db2/Makefile
2931 src/db/dbdrv/informix/Makefile
d1834406
VK
2932 src/db/dbdrv/odbc/Makefile
2933 src/db/dbdrv/mssql/Makefile
2934 src/db/dbdrv/mysql/Makefile
87f1fff0 2935 src/db/dbdrv/oracle/Makefile
d1834406
VK
2936 src/db/dbdrv/pgsql/Makefile
2937 src/db/dbdrv/sqlite/Makefile
d1834406 2938 src/db/libnxdb/Makefile
9191f6ad
VK
2939 src/install/Makefile
2940 src/install/windows/Makefile
f5393033 2941 src/jansson/Makefile
9191f6ad
VK
2942 src/libexpat/Makefile
2943 src/libexpat/libexpat/Makefile
2944 src/libnetxms/Makefile
a7a4c1e9 2945 src/libnxcc/Makefile
9191f6ad
VK
2946 src/libnxlp/Makefile
2947 src/libnxmap/Makefile
0d956dd9 2948 src/libnxmb/Makefile
10d5b2b2 2949 src/libnxsl/Makefile
058bf6fc 2950 src/libstrophe/Makefile
a67fa146
VK
2951 src/libtre/Makefile
2952 src/libtre/win32/Makefile
a7a03ffd 2953 src/nxcproxy/Makefile
8dca469f 2954 src/nxlptest/Makefile
9191f6ad 2955 src/nxscript/Makefile
0c3c0c39
AK
2956 src/server/Makefile
2957 src/server/core/Makefile
644f97f5 2958 src/server/drivers/Makefile
386f88e3 2959 src/server/drivers/airespace/Makefile
0239cfea 2960 src/server/drivers/at/Makefile
644f97f5 2961 src/server/drivers/baystack/Makefile
b1bd1fb2 2962 src/server/drivers/cat2900xl/Makefile
910846cc 2963 src/server/drivers/catalyst/Makefile
fce03ab9 2964 src/server/drivers/cisco-esw/Makefile
ae8ea5a6 2965 src/server/drivers/cisco-sb/Makefile
8bdfaed8 2966 src/server/drivers/dell-pwc/Makefile
a548def4 2967 src/server/drivers/dlink/Makefile
644f97f5 2968 src/server/drivers/ers8000/Makefile
d7e23292 2969 src/server/drivers/h3c/Makefile
d594d378 2970 src/server/drivers/hpsw/Makefile
4e592faf
VK
2971 src/server/drivers/lib/Makefile
2972 src/server/drivers/lib/avaya-ers/Makefile
b1bd1fb2 2973 src/server/drivers/lib/cisco/Makefile
a73592db 2974 src/server/drivers/mikrotik/Makefile
81ecaf38 2975 src/server/drivers/netscreen/Makefile
e10e890e 2976 src/server/drivers/ntws/Makefile
c183a9f9 2977 src/server/drivers/ping3/Makefile
9b13553b 2978 src/server/drivers/procurve/Makefile
ac7e4032 2979 src/server/drivers/qtech-olt/Makefile
217e4d6a 2980 src/server/drivers/symbol-ws/Makefile
e5f4e3ac 2981 src/server/drivers/tb/Makefile
8cf94ffe 2982 src/server/drivers/ubnt/Makefile
6fad8870
VK
2983 src/server/hdlink/Makefile
2984 src/server/hdlink/jira/Makefile
d770a97c
VK
2985 src/server/include/Makefile
2986 src/server/libnxsrv/Makefile
2987 src/server/netxmsd/Makefile
52a2232c
VK
2988 src/server/pdsdrv/Makefile
2989 src/server/pdsdrv/rrdtool/Makefile
d8f2e39b 2990 src/server/smsdrv/Makefile
8d7f1bea 2991 src/server/smsdrv/dummy/Makefile
d8f2e39b 2992 src/server/smsdrv/generic/Makefile
e47404b3 2993 src/server/smsdrv/kannel/Makefile
91369aca 2994 src/server/smsdrv/nxagent/Makefile
aab8a8b6 2995 src/server/smsdrv/portech/Makefile
9b571a7e 2996 src/server/smsdrv/text2reach/Makefile
8d7f1bea 2997 src/server/smsdrv/websms/Makefile
0c3c0c39 2998 src/server/tools/Makefile
0c3c0c39
AK
2999 src/server/tools/nxaction/Makefile
3000 src/server/tools/nxadm/Makefile
9191f6ad 3001 src/server/tools/nxap/Makefile
5b0c7d0d
VK
3002 src/server/tools/nxconfig/Makefile
3003 src/server/tools/nxconfig/res/Makefile
f90d7fc5 3004 src/server/tools/nxdbmgr/Makefile
9191f6ad 3005 src/server/tools/nxget/Makefile
d24fdaf4 3006 src/server/tools/nxupload/Makefile
c5c0f362
VK
3007 src/snmp/Makefile
3008 src/snmp/libnxsnmp/Makefile
3009 src/snmp/nxmibc/Makefile
3010 src/snmp/nxsnmpget/Makefile
3011 src/snmp/nxsnmpset/Makefile
3012 src/snmp/nxsnmpwalk/Makefile
9191f6ad 3013 src/sqlite/Makefile
f65df2b1 3014 src/tools/Makefile
f65df2b1 3015 src/tools/nxdevcfg/Makefile
56e13b13 3016 src/tools/nxencpasswd/Makefile
271e3971 3017 src/tools/nxgenguid/Makefile
1fd41bcd 3018 src/zlib/Makefile
9191f6ad 3019 sql/Makefile
33a10d92
VK
3020 tests/Makefile
3021 tests/include/Makefile
3022 tests/test-libnetxms/Makefile
a7a4c1e9 3023 tests/test-libnxcc/Makefile
66c11d49 3024 tests/test-libnxdb/Makefile
0c3c0c39 3025 tools/Makefile
d16cf8a5
AK
3026])
3027
12249937
VK
3028AC_OUTPUT
3029
ef0c727b 3030echo "Updating libtool"
5cecf50e
AK
3031sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
3032
779ce551 3033# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
5482ef16 3034if test "x$ac_compiler_gnu" = "xyes" && test "x$PLATFORM" = "xHP-UX"; then
779ce551
VK
3035 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
3036fi
3037
b677ef59
VK
3038# On AIX, correct OBJECT_MODE must be set before linking
3039# To avoid manual setting by user, we add this to libtool script
3040if test "x$PLATFORM" = "xAIX"; then
3041 head -n 1 ./libtool > ./libtool.new
3042 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
3043 tail -n +2 ./libtool >> ./libtool.new
3044 mv libtool.new libtool
3045 chmod +x ./libtool
3046fi
3047
ef0c727b
VK
3048#--------------------------------------------------------------------
3049# Print summary
3050#--------------------------------------------------------------------
a7442678 3051
a7442678
AK
3052echo
3053echo
3054echo
3055echo '---------------------------------------------------------------------'
3056echo ' Configure results'
3057echo '---------------------------------------------------------------------'
3058echo
8b86c5dc 3059 echo "Prefix : ${prefix}"
cbc4d191
VK
3060 echo "Platform : ${PLATFORM}"
3061 echo "Shared library suffix : ${SHLIB_SUFFIX}"
b8adb0f2
VK
3062if test "x$IPV6_SUPPORT" = "xyes"; then
3063 echo "IPv6 support : YES"
3064else
3065 echo "IPv6 support : NO"
3066fi
a7442678 3067if test "x${BUILD_SERVER}" = "xyes"; then
8b86c5dc 3068 echo "Build Server : YES"
7c48e2aa 3069 echo "Server libs : ${SERVER_LIBS}"
2cfe4482
VK
3070 if test "x${LDAP_SUPPORT}" = "xyes"; then
3071 echo "LDAP support : YES"
3072 else
3073 echo "LDAP support : NO"
3074 fi
058bf6fc
VK
3075 if test "x${XMPP_SUPPORT}" = "xyes"; then
3076 echo "XMPP support : YES"
3077 else
3078 echo "XMPP support : NO"
3079 fi
a7442678 3080else
8b86c5dc 3081 echo "Build Server : NO"
a7442678
AK
3082fi
3083if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
8b86c5dc 3084 echo "Encryption enabled : YES"
a7442678 3085else
8b86c5dc 3086 echo "Encryption enabled : NO"
a7442678
AK
3087fi
3088if test "x${DB_DRIVERS}" != "x"; then
8b86c5dc 3089 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678 3090else
8b86c5dc 3091 echo "Build DB-Drivers : NO"
a7442678
AK
3092fi
3093if test "x${BUILD_CLIENT}" = "xyes"; then
8b86c5dc 3094 echo "Build Clients : YES"
a7442678 3095else
8b86c5dc 3096 echo "Build Clients : NO"
a7442678
AK
3097fi
3098if test "x${BUILD_AGENT}" = "xyes"; then
8b86c5dc
VK
3099 echo "Build Agent : YES"
3100 echo "Subagents list : ${SUBAGENT_DIRS}"
a7442678 3101else
8b86c5dc 3102 echo "Build Agent : NO"
a7442678 3103fi
e8636669 3104if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
8b86c5dc
VK
3105 echo "Build Static Agent : YES"
3106 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
e8636669 3107else
8b86c5dc 3108 echo "Build Static Agent : NO"
e8636669 3109fi
8b86c5dc 3110if test "x${BUILD_UNICODE}" = "xyes"; then
a67fa146 3111 echo "UNICODE build : YES"
8b86c5dc 3112else
a67fa146 3113 echo "UNICODE build : NO"
8b86c5dc 3114fi
551ec9ca
VK
3115if test "x${HAVE_LIBEXPAT}" = "xno"; then
3116 echo "Use internal libexpat : YES"
1bb6b449 3117else
551ec9ca 3118 echo "Use internal libexpat : NO"
1bb6b449 3119fi
17b35ccc
VK
3120if test "x${HAVE_LIBTRE}" = "xno"; then
3121 echo "Use internal libtre : YES"
3122else
3123 echo "Use internal libtre : NO"
3124fi
f5393033
VK
3125if test "x${HAVE_JANSSON}" = "xno"; then
3126 echo "Use internal libjansson : YES"
3127else
3128 echo "Use internal libjansson : NO"
3129fi
1fd41bcd
VK
3130if test "x${NEED_ZLIB}" = "xyes"; then
3131 if test "x${HAVE_ZLIB}" = "xno"; then
3132 echo "Use internal zlib : YES"
3133 else
3134 echo "Use internal zlib : NO"
3135 fi
3136fi
cc297a70
VK
3137if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
3138 echo "Force 32bit build : YES"
3139else
3140 echo "Force 32bit build : NO"
3141fi
7d8c91ef 3142
9113e749
VK
3143echo "C compiler : ${CC}"
3144echo "C++ compiler : ${CXX}"
7d8c91ef
VK
3145echo "CPPFLAGS : ${CPPFLAGS}"
3146echo "CXXFLAGS : ${CXXFLAGS}"
3147echo "CFLAGS : ${CFLAGS}"
3148echo "LDFLAGS : ${LDFLAGS}"
8d131dda 3149echo "LIBS : ${LIBS}"
7d8c91ef 3150
2cfe4482
VK
3151if test "x${MYSQL_CPPFLAGS}" != "x"; then
3152 echo "MySQL CPPFLAGS : ${MYSQL_CPPFLAGS}"
3153fi
3154if test "x${MYSQL_LDFLAGS}" != "x"; then
3155 echo "MySQL LDFLAGS : ${MYSQL_LDFLAGS}"
3156fi
6fce76d8 3157if test "x${MYSQL_LIBS}" != "x"; then
2cfe4482
VK
3158 echo "MySQL LIBS : ${MYSQL_LIBS}"
3159fi
3160
3161if test "x${PGSQL_CPPFLAGS}" != "x"; then
3162 echo "PostgreSQL CPPFLAGS : ${PGSQL_CPPFLAGS}"
3163fi
3164if test "x${PGSQL_LDFLAGS}" != "x"; then
3165 echo "PostgreSQL LDFLAGS : ${PGSQL_LDFLAGS}"
6fce76d8
VK
3166fi
3167if test "x${PGSQL_LIBS}" != "x"; then
2cfe4482
VK
3168 echo "PostgreSQL LIBS : ${PGSQL_LIBS}"
3169fi
3170
3171if test "x${ORACLE_CPPFLAGS}" != "x"; then
3172 echo "Oracle CPPFLAGS : ${ORACLE_CPPFLAGS}"
3173fi
3174if test "x${ORACLE_LDFLAGS}" != "x"; then
3175 echo "Oracle LDFLAGS : ${ORACLE_LDFLAGS}"
6fce76d8 3176fi
7d8c91ef 3177if test "x${ORACLE_LIBS}" != "x"; then
2cfe4482
VK
3178 echo "Oracle LIBS : ${ORACLE_LIBS}"
3179fi
3180
3181if test "x${ODBC_CPPFLAGS}" != "x"; then
3182 echo "ODBC CPPFLAGS : ${ODBC_CPPFLAGS}"
3183fi
3184if test "x${ODBC_LDFLAGS}" != "x"; then
3185 echo "ODBC LDFLAGS : ${ODBC_LDFLAGS}"
7d8c91ef 3186fi
6fce76d8 3187if test "x${ODBC_LIBS}" != "x"; then
2cfe4482
VK
3188 echo "ODBC LIBS : ${ODBC_LIBS}"
3189fi
3190
3191if test "x${DB2_CPPFLAGS}" != "x"; then
3192 echo "DB2 CPPFLAGS : ${DB2_CPPFLAGS}"
3193fi
3194if test "x${DB2_LDFLAGS}" != "x"; then
3195 echo "DB2 LDFLAGS : ${DB2_LDFLAGS}"
6fce76d8 3196fi
84277a0f 3197if test "x${DB2_LIBS}" != "x"; then
2cfe4482
VK
3198 echo "DB2 LIBS : ${DB2_LIBS}"
3199fi
3200
3201if test "x${INFORMIX_CPPFLAGS}" != "x"; then
3202 echo "Informix CPPFLAGS : ${INFORMIX_CPPFLAGS}"
3203fi
3204if test "x${INFORMIX_LDFLAGS}" != "x"; then
3205 echo "Informix LDFLAGS : ${INFORMIX_LDFLAGS}"
84277a0f 3206fi
37861c72 3207if test "x${INFORMIX_LIBS}" != "x"; then
2cfe4482 3208 echo "Informix LIBS : ${INFORMIX_LIBS}"
37861c72 3209fi
ecbed20c 3210
b14c3f22
VK
3211if test "x${TUXEDO_CPPFLAGS}" != "x"; then
3212 echo "Tuxedo CPPFLAGS : ${TUXEDO_CPPFLAGS}"
3213fi
3214if test "x${TUXEDO_LDFLAGS}" != "x"; then
3215 echo "Tuxedo LDFLAGS : ${TUXEDO_LDFLAGS}"
3216fi
73517e51
VK
3217if test "x${TUXEDO_LIBS}" != "x"; then
3218 echo "Tuxedo LIBS : ${TUXEDO_LIBS}"
3219fi
b14c3f22 3220
d6235717 3221if test "x${MONGODB_CPPFLAGS}" != "x"; then
3222 echo "MongoDB CPPFLAGS : ${MONGODB_CPPFLAGS}"
3223fi
3224if test "x${MONGODB_LDFLAGS}" != "x"; then
3225 echo "MongoDB LDFLAGS : ${MONGODB_LDFLAGS}"
3226fi
3227
ecbed20c
VK
3228FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
3229echo "/* Automatically generated by configure */" > $FLAGS_CPP
d541b129
VK
3230echo "#include <nms_common.h>" >> $FLAGS_CPP
3231echo "const TCHAR *g_cppFlags = _T(\"${CPPFLAGS}\");" >> $FLAGS_CPP
3232echo "const TCHAR *g_cFlags = _T(\"${CFLAGS}\");" >> $FLAGS_CPP
3233echo "const TCHAR *g_cxxFlags = _T(\"${CXXFLAGS}\");" >> $FLAGS_CPP
3234echo "const TCHAR *g_ldFlags = _T(\"${LDFLAGS}\");" >> $FLAGS_CPP
3235echo "const TCHAR *g_libs = _T(\"${LIBS}\");" >> $FLAGS_CPP
7dda4453
VK
3236echo "const TCHAR *g_cc = _T(\"${CC}\");" >> $FLAGS_CPP
3237echo "const TCHAR *g_cxx = _T(\"${CXX}\");" >> $FLAGS_CPP
3238echo "const TCHAR *g_ld = _T(\"${LD}\");" >> $FLAGS_CPP
3239echo "const TCHAR *g_perl = _T(\"${PERL}\");" >> $FLAGS_CPP
71eb7113 3240echo "const TCHAR *g_serverLibs = _T(\"${SERVER_LIBS}\");" >> $FLAGS_CPP