Fixed Windows build error
[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"
d8637bab 518 MODULES="appagent 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"
50638b08 520 SMSDRV_DIRS="kannel slack 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"
d8637bab 578 MODULES="$MODULES appagent 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"
d8637bab 669 MODULES="$MODULES appagent 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"
d8637bab 680 MODULES="$MODULES appagent 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
d8637bab 802 MODULES="$MODULES appagent 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 918
94a82f76
VK
919 AC_MSG_CHECKING(whether C compiler accepts -Wno-unused-result)
920 OLD_CPPFLAGS="$CPPFLAGS"
921 CPPFLAGS="$CPPFLAGS -Wno-unused-result"
922 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
923 [ AC_MSG_RESULT(yes) ],
924 [
925 CPPFLAGS="$OLD_CPPFLAGS"
926 AC_MSG_RESULT(no)
927 ])
928
ef0c727b
VK
929 AC_LANG_PUSH([C++])
930
931 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
e6b112bc 932 OLD_CXXFLAGS="$CXXFLAGS"
ef0c727b
VK
933 CXXFLAGS="$CXXFLAGS -fno-rtti"
934 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
935 [ AC_MSG_RESULT(yes) ],
936 [
937 CXXFLAGS="$OLD_CXXFLAGS"
938 AC_MSG_RESULT(no)
939 ])
940
3118008e
VK
941 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
942 OLD_CXXFLAGS="$CXXFLAGS"
943 CXXFLAGS="$CXXFLAGS -fno-exceptions"
944 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
945 [ AC_MSG_RESULT(yes) ],
946 [
947 CXXFLAGS="$OLD_CXXFLAGS"
948 AC_MSG_RESULT(no)
949 ])
ef0c727b
VK
950
951 AC_LANG_POP([C++])
952
9b318048
VK
953 MACHINE=`uname -m`
954 if test "x$MACHINE" = "xi686" -o "x$MACHINE" = "xi586"; then
955 AC_MSG_CHECKING(whether C compiler accepts -march=$MACHINE)
956 OLD_CPPFLAGS="$CPPFLAGS"
957 CPPFLAGS="$CPPFLAGS -march=$MACHINE"
958 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
959 [
960 AC_MSG_RESULT(yes)
961 ],
962 [
963 CPPFLAGS="$OLD_CPPFLAGS"
964 AC_MSG_RESULT(no)
965 ])
966 fi
967
779ce551 968 if test "x$PLATFORM" = "xHP-UX"; then
cc297a70
VK
969 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
970 AC_MSG_CHECKING(whether C compiler accepts -milp32)
971 OLD_CPPFLAGS="$CPPFLAGS"
972 CPPFLAGS="$CPPFLAGS -milp32"
973 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
974 [
975 LDFLAGS="-milp32 $LDFLAGS"
976 AC_MSG_RESULT(yes)
977 ],
978 [
979 CPPFLAGS="$OLD_CPPFLAGS"
980 AC_MSG_RESULT(no)
981 ])
982 else
983 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
984 OLD_CPPFLAGS="$CPPFLAGS"
985 CPPFLAGS="$CPPFLAGS -mlp64"
986 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
987 [
988 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
989 AC_MSG_RESULT(yes)
990 ],
991 [
992 CPPFLAGS="$OLD_CPPFLAGS"
993 AC_MSG_RESULT(no)
994 ])
995 fi
996 fi
997
998 if test "x$PLATFORM" = "xAIX"; then
999 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1000 AC_MSG_CHECKING(whether C compiler accepts -maix32)
1001 OLD_CPPFLAGS="$CPPFLAGS"
1002 CPPFLAGS="$CPPFLAGS -maix32"
fecf6a2b 1003 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
1004 [
1005 LDFLAGS="-maix32 $LDFLAGS"
5482ef16
VK
1006 LTINIT_CC="$CC -maix32"
1007 LTINIT_CXX="$CXX -maix32"
1c45282c 1008 OBJECT_MODE=32
cc297a70
VK
1009 AC_MSG_RESULT(yes)
1010 ],
1011 [
1012 CPPFLAGS="$OLD_CPPFLAGS"
1013 AC_MSG_RESULT(no)
1014 ])
1015 else
1016 AC_MSG_CHECKING(whether C compiler accepts -maix64)
1017 OLD_CPPFLAGS="$CPPFLAGS"
1018 CPPFLAGS="$CPPFLAGS -maix64"
fecf6a2b 1019 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
1020 [
1021 LDFLAGS="-maix64 $LDFLAGS"
5482ef16
VK
1022 LTINIT_CC="$CC -maix64"
1023 LTINIT_CXX="$CXX -maix64"
1c45282c 1024 OBJECT_MODE=64
cc297a70
VK
1025 AC_MSG_RESULT(yes)
1026 ],
1027 [
1028 CPPFLAGS="$OLD_CPPFLAGS"
1029 AC_MSG_RESULT(no)
1030 ])
1031 fi
779ce551 1032 fi
d358c73f
VK
1033
1034 if test "x$PLATFORM" = "xSunOS"; then
1035 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1036 AC_MSG_CHECKING(whether C compiler accepts -m32)
1037 OLD_CPPFLAGS="$CPPFLAGS"
1038 CPPFLAGS="$CPPFLAGS -m32"
1039 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1040 [
1041 LDFLAGS="-m32 $LDFLAGS"
1042 AC_MSG_RESULT(yes)
1043 ],
1044 [
1045 CPPFLAGS="$OLD_CPPFLAGS"
1046 AC_MSG_RESULT(no)
1047 ])
1048 else
1049 AC_MSG_CHECKING(whether C compiler accepts -m64)
1050 OLD_CPPFLAGS="$CPPFLAGS"
1051 CPPFLAGS="$CPPFLAGS -m64"
1052 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1053 [
1054 LDFLAGS="-m64 $LDFLAGS"
1055 AC_MSG_RESULT(yes)
1056 ],
1057 [
1058 CPPFLAGS="$OLD_CPPFLAGS"
1059 AC_MSG_RESULT(no)
1060 ])
1061 fi
1062 fi
779ce551 1063
3ac3594a
VK
1064
1065 if test "x$PLATFORM" = "xLinux"; then
1066 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1067 AC_MSG_CHECKING(whether C compiler accepts -m32)
1068 OLD_CPPFLAGS="$CPPFLAGS"
1069 CPPFLAGS="$CPPFLAGS -m32"
1070 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1071 [
1072 LDFLAGS="-m32 $LDFLAGS"
1073 AC_MSG_RESULT(yes)
1074 ],
1075 [
1076 CPPFLAGS="$OLD_CPPFLAGS"
1077 AC_MSG_RESULT(no)
1078 ])
1079 fi
1080 fi
1081
ce5592b2
VK
1082 if test "x$ENABLE_DEBUG" = "xyes"; then
1083 CPPFLAGS="$CPPFLAGS -ggdb3"
1084 fi
ef0c727b
VK
1085fi
1086
cfd95c74
VK
1087if test "x$CXX" = "xaCC" ; then
1088 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
451b735a
VK
1089 if test "x$HPUX_HPPA" = "xyes"; then
1090 ARCHFLAG="+DA1.1"
1091 else
1092 ARCHFLAG="+DD32"
1093 fi
1094 AC_MSG_CHECKING(whether C compiler accepts $ARCHFLAG)
4d37b0c5 1095 OLD_CPPFLAGS="$CPPFLAGS"
451b735a 1096 CPPFLAGS="$ARCHFLAG $CPPFLAGS"
cfd95c74
VK
1097 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1098 [
451b735a
VK
1099 LDFLAGS="$ARCHFLAG $LDFLAGS"
1100 CCASFLAGS="$ARCHFLAG $CCASFLAGS"
cfd95c74
VK
1101 AC_MSG_RESULT(yes)
1102 ],
1103 [
4d37b0c5
VK
1104 CPPFLAGS="$OLD_CPPFLAGS"
1105 AC_MSG_RESULT(no)
cfd95c74 1106 ])
4d37b0c5 1107 else
451b735a
VK
1108 if test "x$HPUX_HPPA" = "xyes"; then
1109 ARCHFLAG="+DA2.0W"
1110 else
1111 ARCHFLAG="+DD64"
1112 fi
1113 AC_MSG_CHECKING(whether C compiler accepts $ARCHFLAG)
cfd95c74 1114 OLD_CPPFLAGS="$CPPFLAGS"
451b735a 1115 CPPFLAGS="$ARCHFLAG $CPPFLAGS"
cfd95c74
VK
1116 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1117 [
451b735a
VK
1118 LDFLAGS="$ARCHFLAG $LDFLAGS"
1119 CCASFLAGS="$ARCHFLAG $CCASFLAGS"
cfd95c74
VK
1120 AC_MSG_RESULT(yes)
1121 ],
1122 [
1123 CPPFLAGS="$OLD_CPPFLAGS"
1124 AC_MSG_RESULT(no)
1125 ])
4d37b0c5 1126 fi
ef0c727b
VK
1127fi
1128
df9812a9 1129if test "x$CXX" = "xxlC_r" ; then
d1cb61cf 1130 SQLFLAGS="-qnoppline"
9b99f1c0
VK
1131 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1132 AC_MSG_CHECKING(whether C compiler accepts -q32)
1133 OLD_CPPFLAGS="$CPPFLAGS"
1134 CPPFLAGS="-q32 $CPPFLAGS"
1135 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1136 [
1137 LDFLAGS="-q32 $LDFLAGS"
df9812a9 1138 OBJECT_MODE=32
9b99f1c0
VK
1139 AC_MSG_RESULT(yes)
1140 ],
1141 [
1142 CPPFLAGS="$OLD_CPPFLAGS"
1143 AC_MSG_RESULT(no)
1144 ])
1145 else
1146 AC_MSG_CHECKING(whether C compiler accepts -q64)
1147 OLD_CPPFLAGS="$CPPFLAGS"
1148 CPPFLAGS="-q64 $CPPFLAGS"
1149 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1150 [
1151 LDFLAGS="-q64 $LDFLAGS"
df9812a9 1152 OBJECT_MODE=64
9b99f1c0
VK
1153 AC_MSG_RESULT(yes)
1154 ],
1155 [
1156 CPPFLAGS="$OLD_CPPFLAGS"
1157 AC_MSG_RESULT(no)
1158 ])
1159 fi
1160fi
1161
9113e749
VK
1162if test "x$CXX" = "xCC" ; then
1163 SQLFLAGS="-Qn"
1164 CPPFLAGS="$CPPFLAGS -mt"
3bc41d67 1165 CXXFLAGS="$CXXFLAGS -erroff=badargtype2w,wbadinit"
9113e749
VK
1166
1167 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1168 AC_MSG_CHECKING(whether C compiler accepts -m32)
f5e5296e
VK
1169 count=`$CC -flags | grep '^\-m32 ' | wc -l`
1170 if test $count -eq 1; then
1171 AC_MSG_RESULT(yes)
1172 CPPFLAGS="$CPPFLAGS -m32"
1173 LDFLAGS="-m32 $LDFLAGS"
1174 else
1175 AC_MSG_RESULT(no)
1176 fi
9113e749 1177 else
c3900dbb 1178 TEST_XARCH="no"
9113e749 1179 AC_MSG_CHECKING(whether C compiler accepts -m64)
f5e5296e
VK
1180 count=`$CC -flags | grep '^\-m64 ' | wc -l`
1181 if test $count -eq 1; then
1182 AC_MSG_RESULT(yes)
1183 CPPFLAGS="$CPPFLAGS -m64"
1184 LDFLAGS="-m64 $LDFLAGS"
1185 else
1186 AC_MSG_RESULT(no)
1187 TEST_XARCH="yes"
1188 fi
c3900dbb
VK
1189 if test "x$TEST_XARCH" = "xyes"; then
1190 if test "x$CPUTYPE" = "xsparc"; then
1191 ARCH="-xarch=v9"
1192 else
1193 ARCH="-xarch=amd64"
1194 fi
1195 AC_MSG_CHECKING(whether C compiler accepts $ARCH)
1196 OLD_CPPFLAGS="$CPPFLAGS"
1197 CPPFLAGS="$CPPFLAGS $ARCH"
1198 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1199 [
1200 LDFLAGS="$ARCH $LDFLAGS"
1201 AC_MSG_RESULT(yes)
1202 ],
1203 [
1204 CPPFLAGS="$OLD_CPPFLAGS"
1205 AC_MSG_RESULT(no)
1206 ])
1207 fi
9113e749
VK
1208 fi
1209fi
1210
edb018d7
VK
1211
1212#--------------------------------------------------------------------
1213# Initialize libtool
1214#--------------------------------------------------------------------
1215
1216if test "x$STATIC_BUILD" = "xyes"; then
1217 enable_shared=no
1218 enable_static=yes
1219else
1220 enable_shared=yes
e99eba92
VK
1221 if test "x$BUILD_SDK" = "xyes"; then
1222 enable_static=yes
1223 else
1224 enable_static=no
1225 fi
edb018d7 1226fi
1ef5e57a
VK
1227
1228if test "x$LTINIT_CC" != "x"; then
1229 SAVED_CC="$CC"
1230 CC="$LTINIT_CC"
1231fi
1232if test "x$LTINIT_CXX" != "x"; then
1233 SAVED_CXX="$CXX"
1234 CXX="$LTINIT_CXX"
1235fi
1236
ff12e2f1 1237LT_PREREQ([2.2])
1ef5e57a
VK
1238LT_INIT([dlopen])
1239
1240if test "x$SAVED_CC" != "x"; then
1241 CC="$SAVED_CC"
1242fi
1243if test "x$SAVED_CXX" != "x"; then
1244 CXX="$SAVED_CXX"
1245fi
edb018d7
VK
1246
1247
cfd95c74
VK
1248#--------------------------------------------------------------------
1249# Additional include and library directories
1250#--------------------------------------------------------------------
ef0c727b 1251
cfd95c74
VK
1252if test "x$CXX" != "xaCC"; then
1253 if test -d /usr/local/include; then
5482ef16 1254 if test "x$ac_compiler_gnu" = "xyes"; then
cfd95c74
VK
1255 AC_MSG_CHECKING(whether -I/usr/local/include needed)
1256 OLD_CPPFLAGS="$CPPFLAGS"
1257 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
2adc2d49 1258 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
cfd95c74
VK
1259 [
1260 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
1261 AC_MSG_RESULT(yes)
1262 ],
1263 [
1264 CPPFLAGS="$OLD_CPPFLAGS"
1265 AC_MSG_RESULT(no)
1266 ]
1267 )
1268 else
1269 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
1270 fi
1271 fi
1272
1273 if test -d /usr/kerberos/include; then
1274 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1275 fi
ef0c727b 1276
cfd95c74
VK
1277 if test -d /usr/local/lib; then
1278 LDFLAGS="$LDFLAGS -L/usr/local/lib"
1279 fi
1280fi
ef0c727b 1281
de4c0511
VK
1282
1283#--------------------------------------------------------------------
1284# Check for additional system libraries
1285#--------------------------------------------------------------------
1286
1287AC_CHECK_LIB(xnet, accept)
1288AC_CHECK_LIB(socket, if_nameindex)
1289AC_CHECK_LIB(dl, dlopen)
1290AC_CHECK_LIB(kstat, kstat_open)
1291
1292# sockets/resolver
1293if test "$BUILD_SERVER-$XMPP_SUPPORT" = "yes-yes"; then
1294 AC_CHECK_HEADERS([arpa/nameser_compat.h])
1295 AC_CHECK_FUNC(res_query, , [AC_CHECK_LIB(resolv, res_query, [], [AC_CHECK_LIB(resolv, __res_query)])])
1296fi
1297AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1298AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1299AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1300
1301if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1302 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1303fi
1304
1305if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1306 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1307 LIBS="-lnsl -lsocket $LIBS"
1308 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1309 if test "$my_ac_link_result" = "no" ; then
1310 AC_MSG_RESULT([failure])
1311 AC_MSG_ERROR([unable to use gethostbyname()])
1312 else
1313 AC_MSG_RESULT([success])
1314 fi
1315fi
1316
1317
ef0c727b
VK
1318#--------------------------------------------------------------------
1319# Check for threads library - either POSIX or GNU
1320#--------------------------------------------------------------------
1321
1322if test "x$USE_PTH" = "xyes"; then
1323 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
ef8a3c32
VK
1324 CPPFLAGS="$CPPFLAGS -D_USE_GNU_PTH"
1325 LIBS="$LIBS -lpth"
ef0c727b
VK
1326else
1327 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
1328
1329 if test "x$CXX" = "xaCC"; then
1330 PTHREAD_LIBS=""
1331 else
1332 PTHREAD_LIBS="error"
1333 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
1334 AC_EGREP_CPP(yes,
1335 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
1336 yes
1337 #endif
1338 ], AC_MSG_RESULT(yes)
fecf6a2b 1339 PTHREAD_LIBS="-pthread",
ef0c727b
VK
1340 AC_MSG_RESULT(no))
1341 if test "x$PTHREAD_LIBS" = "xerror"; then
1342 AC_CHECK_LIB(pthread, pthread_attr_init,
1343 PTHREAD_LIBS="-lpthread")
1344 fi
f725c1b7 1345 # On HP-UX (at least 11.00) pthread library contains
b041c587 1346 # __pthread_attr_init_system instead of pthread_attr_init
f725c1b7 1347 if test "x$PTHREAD_LIBS" = "xerror"; then
b041c587 1348 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
f725c1b7
VK
1349 PTHREAD_LIBS="-lpthread")
1350 fi
ef0c727b
VK
1351 if test "x$PTHREAD_LIBS" = "xerror"; then
1352 AC_CHECK_LIB(pthreads, pthread_attr_init,
1353 PTHREAD_LIBS="-lpthreads")
1354 fi
1355 if test "x$PTHREAD_LIBS" = "xerror"; then
1356 AC_CHECK_FUNC(pthread_attr_init,
1357 PTHREAD_LIBS="")
1358 fi
1359 fi
1360
1361 if test "x$PTHREAD_LIBS" = "xerror"; then
1362 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
1363 fi
8d131dda 1364 LIBS="$LIBS $PTHREAD_LIBS"
ef0c727b
VK
1365
1366 # Extensions to posix threads
1367 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 1368#include <pthread.h>
ef0c727b
VK
1369 ])
1370 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
1371
1372 # Check for recursive mutexes
39086394
VK
1373 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
1374 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
1375#include <pthread.h>
1376#if HAVE_PTHREAD_NP_H
1377#include <pthread_np.h>
1378#endif
ef0c727b
VK
1379 ])
1380
1381 # Check for read/write locks
1382 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
1383 # additional defines
1384 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
1385 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
1386 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
afd0c386
VK
1387 [AC_COMPILE_IFELSE([
1388 AC_LANG_PROGRAM([
9c29f76e
VK
1389#include <sys/types.h>
1390#include <pthread.h>
afd0c386
VK
1391 ],
1392 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b 1393 ac_cv_struct_pthread_rw=yes, [
afd0c386
VK
1394 AC_COMPILE_IFELSE([
1395 AC_LANG_PROGRAM([
9c29f76e
VK
1396#define _XOPEN_SOURCE 500
1397#include <sys/types.h>
1398#include <pthread.h>
afd0c386
VK
1399 ],
1400 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b
VK
1401 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
1402 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1403 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
1404 fi
1405 ])])
1406 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1407 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
1408 fi
1409 fi
1410
1411fi
1412
1413
1414#--------------------------------------------------------------------
1415# Checks for OpenSSL
1416#--------------------------------------------------------------------
1417
1418if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
1419 AC_CHECK_LIB(crypto, RSA_new,
1420 [
2cfe4482 1421 AC_DEFINE(WITH_OPENSSL, 1, Define to 1 if you have OpenSSL library and headers)
ef0c727b 1422 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
e0a77f08 1423 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
ef0c727b 1424 AC_CHECK_LIB(crypto, EVP_bf_cbc,
e0a77f08 1425 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
ef0c727b 1426 AC_CHECK_LIB(crypto, EVP_idea_cbc,
e0a77f08 1427 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
ef0c727b 1428 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
e0a77f08 1429 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
d27e7413 1430 SERVER_LIBS="$SERVER_LIBS -lssl"
e0a77f08
VK
1431 if test "x$HAVE_LIBCRYPTO" = "xyes"; then
1432 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
1433# LIBS="$LIBS -Wl,-Bstatic -lcrypto -Wl,-Bdynamic"
1434 LIBS="$LIBS -lcrypto"
1435 else
1436 LIBS="$LIBS -lcrypto"
1437 fi
1438 else
058bf6fc 1439 AC_MSG_ERROR(libcrypto does not provide any suitable encryption algorithm)
e0a77f08 1440 fi
ef0c727b
VK
1441 ],
1442 [
058bf6fc 1443 AC_MSG_ERROR(libcrypto is required for encryption support)
ef0c727b
VK
1444 ])
1445fi
1446
1447
1448#--------------------------------------------------------------------
0322eed7
VK
1449# Checks for header files
1450#--------------------------------------------------------------------
1451
1452AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h alloca.h])
2e98cdb4 1453AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h sys/wait.h])
e9c8eb1d 1454AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h netinet/tcp.h net/nh.h sys/socket.h])
0322eed7
VK
1455AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
1456AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
c1099678 1457AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h locale.h])
df9812a9 1458AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
5962498b 1459AC_CHECK_HEADERS([grp.h pwd.h malloc.h])
f09c2d05 1460AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
1461[[#ifdef HAVE_SYS_TYPES_H
1462# include <sys/types.h>
1463#endif
1464#ifdef HAVE_SYS_TIME_H
1465# include <sys/time.h>
1466#endif
1467#ifdef HAVE_SYS_SOCKET_H
1468# include <sys/socket.h>
1469#endif
1470]])
1471
1472
1473#--------------------------------------------------------------------
b8adb0f2
VK
1474# Checks for IPv6 support
1475#--------------------------------------------------------------------
1476
1477if test "x$DISABLE_IPV6" != "xyes"; then
1478 AC_CHECK_DECL(AF_INET6,,,[
1479#if HAVE_NETINET_IN_H
1480#include <netinet/in.h>
1481#endif
1482 ])
1483 if test "x$ac_cv_have_decl_AF_INET6" = "xyes"; then
1484 AC_CHECK_TYPE(struct sockaddr_in6, [
1485 AC_DEFINE(WITH_IPV6, 1, Define to have IPv6 support)
1486 IPV6_SUPPORT="yes"
1487 ],,[
1488#if HAVE_NETINET_IN_H
1489#include <netinet/in.h>
1490#endif
1491 ])
1492 fi
1493fi
1494
1495#--------------------------------------------------------------------
ef0c727b
VK
1496# Checks for other libs.
1497#--------------------------------------------------------------------
d16cf8a5 1498
e0760102 1499if test "x$BUILD_SERVER" = "xyes" ; then
7c48e2aa 1500 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
1501 if test "x$DISABLE_READLINE" = "xno"; then
1502 AC_CHECK_LIB(readline, readline, [SERVER_LIBS="$SERVER_LIBS -lreadline"], [AC_CHECK_LIB(edit, readline, [SERVER_LIBS="$SERVER_LIBS -ledit"])])
1503 fi
1fd17e2d 1504 AC_CHECK_LIB(rt, timer_create, [SERVER_LIBS="$SERVER_LIBS -lrt"])
7c48e2aa
VK
1505 SAVED_LDFLAGS="$LDFLAGS"
1506 LDFLAGS="$LDFLAGS $SERVER_LIBS"
1507
1fd17e2d
VK
1508 AC_CHECK_FUNCS([readline timer_create])
1509 AC_CHECK_TYPES([timer_t])
0322eed7
VK
1510
1511 # Check if passing rl_insert to rl_bind_key needs cast
1512 if test "$ac_cv_func_readline" = "yes"; then
1513 AC_LANG_PUSH([C++])
1514
1515 AC_MSG_CHECKING(for rl_insert cast)
1516
afd0c386 1517 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1518 [
1519#include <stdio.h>
1520#include <readline/readline.h>
afd0c386 1521 ],[ rl_bind_key('\t', (Function *)rl_insert); ])],
0322eed7
VK
1522 [
1523 AC_MSG_RESULT((Function *))
1524 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
1525 ],[
afd0c386 1526 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1527 [
1528#include <stdio.h>
1529#include <readline/readline.h>
afd0c386 1530 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ])],
0322eed7
VK
1531 [
1532 AC_MSG_RESULT((rl_command_func_t *))
1533 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
1534 ],[
1535 AC_MSG_RESULT(not needed)
1536 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
1537 ]
1538 )
1539 ]
1540 )
1541
1542 AC_LANG_POP([C++])
1543 fi
7c48e2aa 1544 LDFLAGS="$SAVED_LDFLAGS"
e0760102
VK
1545fi
1546
ef0c727b 1547if test "x$NEED_ZLIB" = "xyes"; then
1fd41bcd
VK
1548 if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
1549 HAVE_ZLIB=no
1550 else
1551 HAVE_ZLIB=yes
1552 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
1553 if test "x$HAVE_ZLIB" = "xyes"; then
1554 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
1555 fi
1556 fi
1557 if test "x$HAVE_ZLIB" = "xno"; then
1558 MODULES="zlib $MODULES"
1559 fi
ef0c727b
VK
1560fi
1561
467c489f
VK
1562if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
1563 HAVE_LIBEXPAT=no
1564else
1565 HAVE_LIBEXPAT=yes
1566 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
1567 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
1568fi
80ce37ac
VK
1569if test "x$HAVE_LIBEXPAT" = "xno"; then
1570 MODULES="libexpat $MODULES"
1bb6b449 1571fi
ef0c727b 1572
17b35ccc
VK
1573if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
1574 HAVE_LIBTRE=no
1575else
1576 HAVE_LIBTRE=yes
1577 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
1578 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
1579fi
1580if test "x$HAVE_LIBTRE" = "xno"; then
1581 MODULES="libtre $MODULES"
1582 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
a67fa146 1583
720c23d0
VK
1584 tre_version_1='0'
1585 tre_version_2='8'
1586 tre_version_3='0'
a67fa146
VK
1587 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
1588 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
1589 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
1590 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
1591 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
1592 AC_SUBST(TRE_VERSION, $tre_version)
1593
1594 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])
1595 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
17b35ccc 1596fi
ef0c727b 1597
f5393033
VK
1598if test "x$FORCE_INTERNAL_JANSSON" = "xyes"; then
1599 HAVE_JANSSON=no
1600else
1601 HAVE_JANSSON=yes
1602 AC_CHECK_HEADER(jansson.h,,HAVE_JANSSON=no)
1603 AC_CHECK_LIB(jansson, json_object, [ HAVE_JANSSON=yes ], [ HAVE_JANSSON=no ])
1604fi
1605if test "x$HAVE_JANSSON" = "xno"; then
1606 MODULES="jansson $MODULES"
1607fi
1608
4050bafb
VK
1609if test "x$DISABLE_LMSENSORS" = "xno"; then
1610 HAVE_LMSENSORS=yes
1611 AC_CHECK_HEADER(sensors/sensors.h,,HAVE_LMSENSORS=no)
1612 if test "x$HAVE_LMSENSORS" = "xyes"; then
1613 AC_CHECK_LIB(sensors, sensors_init, [ DUMMY="" ], [ HAVE_LMSENSORS=no ])
1614 fi
1615 if test "x$HAVE_LMSENSORS" = "xyes"; then
1616 SUBAGENT_DIRS="$SUBAGENT_DIRS lmsensors"
1617 fi
38bfa5da
AK
1618fi
1619
0a4194c2
AK
1620AC_CHECK_HEADER(curl/curl.h,HAVE_LIBCURL=yes,HAVE_LIBCURL=no)
1621if test "x$HAVE_LIBCURL" = "xyes"; then
2368dc85
VK
1622 AC_CHECK_LIB(curl, curl_global_init, [ HAVE_LIBCURL=yes ], [ HAVE_LIBCURL=no ])
1623 AC_CHECK_DECLS([CURLOPT_NOSIGNAL, curl_version_info],,,[
1624#ifdef HAVE_CURL_CURL_H
1625#include <curl/curl.h>
1626#endif
1627])
0a4194c2 1628fi
d9177dd1 1629
0a4194c2 1630if test "x$HAVE_LIBCURL" = "xyes"; then
c80c69bd 1631 SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
50638b08 1632 SMSDRV_DIRS="$SMSDRV_DIRS kannel slack text2reach websms"
6fad8870 1633 HDLINK_DIRS="$HDLINK_DIRS jira"
3bc41d67 1634 AC_DEFINE(HAVE_LIBCURL, 1, Define to 1 if libcurl is available)
0a4194c2
AK
1635fi
1636
2cfe4482
VK
1637if test "x$LDAP_SUPPORT" = "xyes"; then
1638 AC_CHECK_HEADER(ldap.h,HAVE_LDAP=yes,HAVE_LDAP=no)
1639 if test "x$HAVE_LDAP" = "xyes"; then
1640 AC_CHECK_LIB(ldap, ldap_init, [ HAVE_LDAP=yes ], [ HAVE_LDAP=no ])
e8ef7fe1 1641 if test "x$HAVE_LDAP" = "xyes"; then
a0008bce 1642 AC_CHECK_LIB(lber, ber_init, [ SERVER_LIBS="-llber $SERVER_LIBS" ])
e8ef7fe1 1643 fi
2cfe4482 1644 fi
d9177dd1 1645 if test "x$HAVE_LDAP" = "xyes"; then
1646 SERVER_LIBS="-lldap $SERVER_LIBS"
2cfe4482 1647 AC_DEFINE(WITH_LDAP, 1, Define to 1 if you have LDAP libraries and headers)
d95c3dad
A
1648 AC_CHECK_HEADERS([ldap_ssl.h],,,
1649 [
1650#include <ldap.h>
a164b767 1651 ])
d95c3dad
A
1652 AC_CHECK_TYPES([ber_int_t],,,
1653 [
1654#include <ldap.h>
1655#if HAVE_LDAP_SSL_H
1656#include <ldap_ssl.h>
1657#endif
daa828ee 1658 ])
d95c3dad
A
1659
1660 OLD_LIBS="$LIBS"
1661 LIBS="$LIBS -lldap"
1662 AC_CHECK_FUNCS([ldap_initialize ldapssl_init])
1663 AC_CHECK_FUNCS([ldap_control_create ldap_create_control nsldapi_build_control])
1664 AC_CHECK_FUNCS([ldap_create_page_control ldap_parse_page_control])
1665 LIBS="$OLD_LIBS"
1666
1667 AC_CHECK_DECLS([nsldapi_build_control],,,
1668 [
1669#include <ldap.h>
1670#if HAVE_LDAP_SSL_H
1671#include <ldap_ssl.h>
1672#endif
b00236dd 1673 ])
d9177dd1 1674 fi
2cfe4482 1675 LDAP_SUPPORT="$HAVE_LDAP"
d9177dd1 1676fi
1677
ef0c727b
VK
1678#--------------------------------------------------------------------
1679# Checks for data types
1680#--------------------------------------------------------------------
1681
d16cf8a5
AK
1682AC_CHECK_SIZEOF(short)
1683AC_CHECK_SIZEOF(int)
1684AC_CHECK_SIZEOF(long)
1685AC_CHECK_SIZEOF(long long)
1686
1687AC_TYPE_PID_T
d16cf8a5
AK
1688AC_TYPE_SIZE_T
1689AC_STRUCT_TIMEZONE
1690
3071f10a 1691AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
51128b42 1692AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
1693#if HAVE_SYS_TYPES_H
1694#include <sys/types.h>
1695#endif
1696#if HAVE_SYS_SOCKET_H
1697#include <sys/socket.h>
1698#endif
1699])
e0293f7f
VK
1700AC_CHECK_TYPES([struct stat64],,,[
1701#if HAVE_SYS_STAT_H
1702#include <sys/stat.h>
1703#endif
1704])
521d90e7 1705
e25cadc9 1706
ef0c727b
VK
1707#--------------------------------------------------------------------
1708# Checks for functions
1709#--------------------------------------------------------------------
d16cf8a5
AK
1710
1711AC_FUNC_ERROR_AT_LINE
d16cf8a5 1712AC_FUNC_MEMCMP
d16cf8a5
AK
1713AC_FUNC_SELECT_ARGTYPES
1714AC_FUNC_STRFTIME
1715AC_FUNC_STRTOD
1716AC_FUNC_VPRINTF
1717
80ce37ac 1718AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
c1099678 1719AC_CHECK_FUNCS([strrchr strlwr strtol strtoul strtoll strtoull setlocale])
467e30e1 1720AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
c601fc15 1721AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
ecdf8898 1722AC_CHECK_FUNCS([fopen64 strptime timegm gethostbyname2_r getaddrinfo])
5962498b 1723AC_CHECK_FUNCS([itoa _itoa isatty getgrnam getpwnam malloc_info malloc_trim])
aa24418a 1724
9757ca46 1725AC_CHECK_DECLS([nanosleep, daemon, strerror])
be6467e9 1726
6f95ef89
VK
1727# Do not use inet_pton on Solaris as it has binary compatibility problems
1728if test "$PLATFORM" != "SunOS"; then
1729 AC_CHECK_FUNCS([inet_pton])
1730fi
1731
b0823d06
VK
1732# Check if strerror_r is POSIX-compliant
1733if test "$ac_cv_func_strerror_r" = "yes"; then
1734 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1735 AC_LANG_PUSH([C++])
1736 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
1737#if HAVE_STRING_H
1738#include <string.h>
1739#endif
1740#if HAVE_ERRNO_H
1741#include <errno.h>
1742#endif
b0823d06 1743 ]],[[
7f9423af
VK
1744 int e;
1745 char buffer[256];
1746 e = strerror_r(1, buffer, 256);
1747 return e;
b0823d06
VK
1748 ]])
1749 ],[
1750 AC_MSG_RESULT(yes)
1751 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1752 ],[
1753 AC_MSG_RESULT(no)
1754 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1755 ])
1756 AC_LANG_POP([C++])
1757fi
1758
be6467e9
VK
1759# Check if struct tm has tm_gmtoff member
1760AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1761AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1762#if HAVE_TIME_H
1763#include <time.h>
1764#endif
1765#if HAVE_SYS_TIME_H
1766#include <sys/time.h>
1767#endif
1768]],[[
be6467e9
VK
1769 struct tm t;
1770 return t.tm_gmtoff;
be6467e9
VK
1771]])
1772],[
1773AC_MSG_RESULT(yes)
1774AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1775],[
1776AC_MSG_RESULT(no)
1777])
d16cf8a5 1778
f91feddc 1779AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
1780AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1781
c6491611
VK
1782# asprintf, scprintf, etc.
1783AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1784AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
342a701d 1785AC_CHECK_FUNCS([snprintf vsnprintf])
c6491611
VK
1786
1787AC_MSG_CHECKING(whether snprintf returns required buffer size)
1788AC_RUN_IFELSE(
1789 [AC_LANG_PROGRAM([
1790#include <stdio.h>
1791#include <string.h>
1792 ], [
1793 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1794 ])
1795 ],
1796 [ AC_MSG_RESULT(yes)
1797 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1798 ],
1799 [ AC_MSG_RESULT(no) ],
1800 [ AC_MSG_RESULT(no) ]
1801)
1802
1803
ef0c727b
VK
1804#--------------------------------------------------------------------
1805# Checks for macros and definitions
1806#--------------------------------------------------------------------
dff54fed 1807
ef0c727b
VK
1808AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1809#ifdef HAVE_SYS_TYPES_H
99e50bb7 1810#include <sys/types.h>
ef0c727b
VK
1811#endif
1812#if HAVE_BYTESWAP_H
1813#include <byteswap.h>
1814#endif
1815#if HAVE_NETINET_IN_H
1816#include <netinet/in.h>
1817#endif
1818#if HAVE_NET_NH_H
1819#include <net/nh.h>
1820#endif
1821])
aa24418a
VK
1822AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1823#ifdef HAVE_UNISTD_H
1824#include <unistd.h>
1825#endif
1826#ifdef HAVE_DLFCN_H
1827#include <dlfcn.h>
1828#endif
1829])
ce7565e7
VK
1830AC_CHECK_DECLS([va_copy, __va_copy],,,[
1831#ifdef HAVE_UNISTD_H
1832#include <unistd.h>
1833#endif
1834#ifdef HAVE_STDARG_H
1835#include <stdarg.h>
1836#endif
1837#ifdef HAVE_STDLIB_H
1838#include <stdlib.h>
1839#endif
1840])
dff54fed 1841
dff54fed 1842
ef0c727b 1843#--------------------------------------------------------------------
df9812a9
VK
1844# getopt
1845#--------------------------------------------------------------------
1846
1847if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
1848 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
1849else
1850 AC_CHECK_HEADERS([getopt.h])
1851 AC_CHECK_LIB(gnugetopt, getopt_long)
1852 AC_CHECK_DECLS([getopt_long],,,[
1853#if HAVE_GETOPT_H
1854#include <getopt.h>
1855#endif
1856 ])
1857fi
1858
1859
1860#--------------------------------------------------------------------
671651a1
VK
1861# Linux specific checks
1862#--------------------------------------------------------------------
1863
1864if test "x$PLATFORM" = "xLinux"; then
1865 AC_CHECK_HEADERS([sys/reboot.h],,,[[ ]])
1866 AC_CHECK_DECLS([reboot, RB_AUTOBOOT, RB_POWER_OFF, RB_HALT_SYSTEM],,,[
1867#if HAVE_SYS_REBOOT_H
1868#include <sys/reboot.h>
1869#endif
1870 ])
1871 AC_CHECK_FUNCS([reboot],,,[
1872#if HAVE_SYS_REBOOT_H
1873#include <sys/reboot.h>
1874#endif
1875 ])
f92a016a
VK
1876
1877 AC_CHECK_HEADERS([jemalloc/jemalloc.h],
1878 [
1879 AC_CHECK_LIB(jemalloc, malloc,
1880 [
1881 WITH_JEMALLOC="yes"
1882 AC_DEFINE(WITH_JEMALLOC,1,Define to 1 if libjemalloc is used)
1883 ])
1884 ])
671651a1
VK
1885fi
1886
1887
1888#--------------------------------------------------------------------
ef0c727b
VK
1889# AIX specific checks
1890#--------------------------------------------------------------------
d16cf8a5 1891
ef0c727b
VK
1892if test "x$PLATFORM" = "xAIX"; then
1893 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
efdaffe4 1894 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
df9812a9
VK
1895#if HAVE_PROCINFO_H
1896#include <procinfo.h>
1897#endif
1898 ])
ef0c727b
VK
1899 AC_CHECK_FUNCS([getprocs64],,,[
1900#if HAVE_PROCINFO_H
1901#include <procinfo.h>
6cd41ceb 1902#endif
ef0c727b 1903 ])
7e56bf2e
VK
1904fi
1905
cd4c8ca3 1906
ef0c727b 1907#--------------------------------------------------------------------
f47bd4ca
VK
1908# Solaris specific checks
1909#--------------------------------------------------------------------
1910
1911if test "x$PLATFORM" = "xSunOS"; then
1912 AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
1913#include <sys/atomic.h>
1914 ])
1915fi
1916
1917
1918#--------------------------------------------------------------------
ba8db57b
VK
1919# HP-UX specific checks
1920#--------------------------------------------------------------------
1921
1922if test "x$PLATFORM" = "xHP-UX"; then
3268bb77 1923 AC_CHECK_HEADERS([atomic.h sys/mib.h],,,[[ ]])
f09c2d05
VK
1924 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1925#if HAVE_NET_IF_H
1926#include <net/if.h>
1927#endif
1928 ])
1929 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1930#if HAVE_SYS_MIB_H
1931#include <sys/mib.h>
1932#endif
1933 ])
cfd95c74
VK
1934
1935 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
1936 AC_LANG_PUSH([C++])
1937 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1938#include <sys/pstat.h>
1939 ]], [[
1940pst_diskinfo d;
1941int x;
1942x = (int)d.psd_dkread;
1943x = (int)d.psd_dkwrite;
1944 ]])],
1945 [
1946 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
1947 AC_MSG_RESULT(yes)
1948 ],
1949 [
1950 AC_MSG_RESULT(no)
1951 ])
1952 AC_LANG_POP([C++])
ba8db57b
VK
1953fi
1954
1955
1956#--------------------------------------------------------------------
aa24418a
VK
1957# *BSD specific checks
1958#--------------------------------------------------------------------
1959
1960AC_CHECK_LIB(kvm, kvm_open)
1961AC_CHECK_FUNCS([kvm_getswapinfo])
1962AC_CHECK_TYPES([struct kinfo_proc2],,,[
1963#if HAVE_SYS_SYSCTL_H
1964#include <sys/sysctl.h>
1965#endif
1966])
1967
1968
28ba6824
VK
1969#--------------------------------------------------------------------
1970# FreeBSD specific checks
1971#--------------------------------------------------------------------
1972
1973if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
1974 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1975#if HAVE_SYS_TYPES_H
1976#include <sys/types.h>
1977#endif
1978#if HAVE_SYS_SOCKET_H
1979#include <sys/socket.h>
1980#endif
1981#include <net/route.h>
1982 ])
28ba6824
VK
1983fi
1984
1985
aa24418a 1986#--------------------------------------------------------------------
ea6615cf
VK
1987# OpenBSD specific checks
1988#--------------------------------------------------------------------
1989
1990if test "x$PLATFORM" = "xOpenBSD"; then
1991 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
1992 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1993#include <sys/param.h>
1994#include <sys/proc.h>
1995#include <kvm.h>
1996#include <sys/user.h>
1997 ]],[[
1998 int count;
1999 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
2000 return 0;
2001 ]])
2002 ],[
2003 AC_MSG_RESULT(yes)
2004 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
2005 ],[
2006 AC_MSG_RESULT(no)
2007 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
2008 ])
2009
2010 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
2011 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2012#include <sys/param.h>
2013#include <sys/proc.h>
2014#include <kvm.h>
2015#include <sys/user.h>
2016 ]],[[
2017 struct kinfo_proc p;
2018 return p.kp_proc.p_pid;
2019 ]])
2020 ],[
2021 AC_MSG_RESULT(yes)
2022 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
2023 ],[
2024 AC_MSG_RESULT(no)
2025 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
2026 ])
2027fi
2028
2029
2030#--------------------------------------------------------------------
ef8a3c32
VK
2031# Minix specific checks
2032#--------------------------------------------------------------------
2033
2034if test "x$PLATFORM" = "xMinix"; then
2035 AC_CHECK_HEADERS([minix/minlib.h])
2036fi
2037
2038
2039#--------------------------------------------------------------------
ef0c727b
VK
2040# Check for UNICODE stuff
2041#--------------------------------------------------------------------
3e39fcde 2042
5a82ecc7 2043AC_CHECK_HEADERS([wchar.h wctype.h iconv.h widec.h])
aa24418a 2044AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
2045#if HAVE_WCHAR_H
2046#include <wchar.h>
2047#endif
2048])
f172d7b7
VK
2049AC_CHECK_SIZEOF(wchar_t,,[
2050#if HAVE_WCHAR_H
2051#include <wchar.h>
2052#endif
2053])
fdf1ed50
VK
2054AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper towlower])
2055AC_CHECK_FUNCS([wcslwr wcserror wcserror_r wfopen wfopen64 fputws putws])
2056AC_CHECK_FUNCS([wopen wstat waccess wgetenv wrename wunlink wremove wchdir])
2057AC_CHECK_FUNCS([wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod vwscanf])
2058AC_CHECK_FUNCS([vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
9138dfe2 2059AC_CHECK_FUNCS([itow _itow])
dff54fed 2060
3265ba38 2061if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 2062 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 2063 [ ac_found_iconv=yes
8d131dda 2064 LIBS="$LIBS -liconv"
75c30ed4
VK
2065 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
2066 ],
2067 [
2068 AC_CHECK_LIB(iconv, iconv,
2069 [ ac_found_iconv=yes
8d131dda 2070 LIBS="$LIBS -liconv"
75c30ed4
VK
2071 ])
2072 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
2073 ])
dff54fed
VK
2074else
2075 ac_found_iconv=no
ef0c727b 2076 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 2077fi
93571e7f 2078
3bf0df9f
VK
2079AC_MSG_CHECKING(whether fgetws can be used with popen)
2080AC_RUN_IFELSE(
2081 [AC_LANG_PROGRAM([
2082#include <stdio.h>
2083#ifdef HAVE_UNISTD_H
2084#include <unistd.h>
2085#endif
2086#if HAVE_WCHAR_H
2087#include <wchar.h>
2088#endif
2089 ], [[
2090 int rc = 1;
2091 wchar_t line[4096];
2092 FILE *f = popen("echo test", "r");
2093 if(f!=NULL)
2094 {
2095 fgetws(line, 4096, f);
2096 pclose(f);
2097 rc = 0;
2098 }
2099 return rc;
2100 ]])
2101 ],
2102 [ AC_MSG_RESULT(yes)
2103 AC_DEFINE(SAFE_FGETWS_WITH_POPEN, 1, Define to 1 if fgetws can be used with popen)
2104 ],
2105 [ AC_MSG_RESULT(no) ],
2106 [ AC_MSG_RESULT(no) ]
2107)
2108
93571e7f
VK
2109AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
2110AC_RUN_IFELSE(
2111 [AC_LANG_PROGRAM([
2112#if HAVE_ICONV_H
2113#include <iconv.h>
2114#endif
2115 ], [
2116 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
2117 ])
2118 ],
2119 [ AC_MSG_RESULT(yes)
2120 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
2121 valid_ucs2_code="UCS-2-INTERNAL"
2122 ],
2123 [ AC_MSG_RESULT(no) ],
2124 [ AC_MSG_RESULT(no) ]
2125)
2126
2127AC_MSG_CHECKING(whether iconv supports UCS-2)
2128AC_RUN_IFELSE(
2129 [AC_LANG_PROGRAM([
2130#if HAVE_ICONV_H
2131#include <iconv.h>
2132#endif
2133 ], [
2134 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
2135 ])
2136 ],
2137 [ AC_MSG_RESULT(yes)
2138 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
2139 valid_ucs2_code="UCS-2"
2140 ],
2141 [ AC_MSG_RESULT(no) ],
8b86c5dc 2142 [ AC_MSG_RESULT(no) ]
93571e7f
VK
2143)
2144
2145AC_MSG_CHECKING(whether iconv supports UCS2)
2146AC_RUN_IFELSE(
2147 [AC_LANG_PROGRAM([
2148#if HAVE_ICONV_H
2149#include <iconv.h>
2150#endif
2151 ], [
2152 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
2153 ])
2154 ],
2155 [ AC_MSG_RESULT(yes)
2156 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
2157 valid_ucs2_code="UCS2"
2158 ],
2159 [ AC_MSG_RESULT(no) ],
2160 [ AC_MSG_RESULT(no) ]
2161)
2162
44bccbbc
VK
2163AC_MSG_CHECKING(whether iconv supports UCS-2BE)
2164AC_RUN_IFELSE(
2165 [AC_LANG_PROGRAM([
2166#if HAVE_ICONV_H
2167#include <iconv.h>
2168#endif
2169 ], [
2170 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
2171 ])
2172 ],
2173 [ AC_MSG_RESULT(yes)
2174 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
2175 valid_ucs2_code="UCS-2BE"
2176 ],
2177 [ AC_MSG_RESULT(no) ],
2178 [ AC_MSG_RESULT(no) ]
2179)
2180
6e17f325
VK
2181AC_MSG_CHECKING(whether iconv supports UCS-2LE)
2182AC_RUN_IFELSE(
2183 [AC_LANG_PROGRAM([
2184#if HAVE_ICONV_H
2185#include <iconv.h>
2186#endif
2187 ], [
2188 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
2189 ])
2190 ],
2191 [ AC_MSG_RESULT(yes)
2192 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
2193 valid_ucs2_code="UCS-2LE"
2194 ],
2195 [ AC_MSG_RESULT(no) ],
2196 [ AC_MSG_RESULT(no) ]
2197)
2198
4a4e1feb
VK
2199AC_MSG_CHECKING(whether iconv supports UTF-16)
2200AC_RUN_IFELSE(
2201 [AC_LANG_PROGRAM([
2202#if HAVE_ICONV_H
2203#include <iconv.h>
2204#endif
2205 ], [
2206 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
2207 ])
2208 ],
2209 [ AC_MSG_RESULT(yes)
2210 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
2211 valid_ucs2_code="UTF-16"
2212 ],
2213 [ AC_MSG_RESULT(no) ],
2214 [ AC_MSG_RESULT(no) ]
2215)
2216
8b86c5dc
VK
2217AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
2218AC_RUN_IFELSE(
2219 [AC_LANG_PROGRAM([
2220#if HAVE_ICONV_H
2221#include <iconv.h>
2222#endif
2223 ], [
2224 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
2225 ])
2226 ],
2227 [ AC_MSG_RESULT(yes)
2228 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
2229 valid_ucs4_code="UCS-4-INTERNAL"
2230 ],
2231 [ AC_MSG_RESULT(no) ],
2232 [ AC_MSG_RESULT(no) ]
2233)
2234
2235AC_MSG_CHECKING(whether iconv supports UCS-4)
2236AC_RUN_IFELSE(
2237 [AC_LANG_PROGRAM([
2238#if HAVE_ICONV_H
2239#include <iconv.h>
2240#endif
2241 ], [
2242 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
2243 ])
2244 ],
2245 [ AC_MSG_RESULT(yes)
2246 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
2247 valid_ucs4_code="UCS-4"
2248 ],
2249 [ AC_MSG_RESULT(no) ],
2250 [ AC_MSG_RESULT(no) ]
2251)
2252
2253AC_MSG_CHECKING(whether iconv supports UCS4)
2254AC_RUN_IFELSE(
2255 [AC_LANG_PROGRAM([
2256#if HAVE_ICONV_H
2257#include <iconv.h>
2258#endif
2259 ], [
2260 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
2261 ])
2262 ],
2263 [ AC_MSG_RESULT(yes)
2264 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
2265 valid_ucs4_code="UCS4"
2266 ],
2267 [ AC_MSG_RESULT(no) ],
2268 [ AC_MSG_RESULT(no) ]
2269)
2270
2271AC_MSG_CHECKING(whether iconv supports UCS-4BE)
2272AC_RUN_IFELSE(
2273 [AC_LANG_PROGRAM([
2274#if HAVE_ICONV_H
2275#include <iconv.h>
2276#endif
2277 ], [
2278 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
2279 ])
2280 ],
2281 [ AC_MSG_RESULT(yes)
2282 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
2283 valid_ucs4_code="UCS-4BE"
2284 ],
2285 [ AC_MSG_RESULT(no) ],
2286 [ AC_MSG_RESULT(no) ]
2287)
2288
6e17f325
VK
2289AC_MSG_CHECKING(whether iconv supports UCS-4LE)
2290AC_RUN_IFELSE(
2291 [AC_LANG_PROGRAM([
2292#if HAVE_ICONV_H
2293#include <iconv.h>
2294#endif
2295 ], [
2296 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
2297 ])
2298 ],
2299 [ AC_MSG_RESULT(yes)
2300 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
2301 valid_ucs4_code="UCS-4LE"
2302 ],
2303 [ AC_MSG_RESULT(no) ],
2304 [ AC_MSG_RESULT(no) ]
2305)
2306
4a4e1feb
VK
2307AC_MSG_CHECKING(whether iconv supports UTF-32)
2308AC_RUN_IFELSE(
2309 [AC_LANG_PROGRAM([
2310#if HAVE_ICONV_H
2311#include <iconv.h>
2312#endif
2313 ], [
2314 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
2315 ])
2316 ],
2317 [ AC_MSG_RESULT(yes)
2318 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
2319 valid_ucs4_code="UTF-32"
2320 ],
2321 [ AC_MSG_RESULT(no) ],
2322 [ AC_MSG_RESULT(no) ]
2323)
2324
93571e7f
VK
2325AC_MSG_CHECKING(whether iconv supports //IGNORE)
2326AC_RUN_IFELSE(
2327 [AC_LANG_PROGRAM([
2328#if HAVE_ICONV_H
2329#include <iconv.h>
2330#endif
2331 ], [
2332 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
2333 ])
2334 ],
2335 [ AC_MSG_RESULT(yes)
2336 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
2337 ],
2338 [ AC_MSG_RESULT(no) ],
2339 [ AC_MSG_RESULT(no) ]
2340)
3e39fcde 2341
bd96aa53
VK
2342AC_MSG_CHECKING(whether iconv supports state reset)
2343AC_RUN_IFELSE(
2344 [AC_LANG_PROGRAM([
2345#include <stdio.h>
2346#if HAVE_ICONV_H
2347#include <iconv.h>
2348#endif
2349 ], [
2350 iconv_t cd = iconv_open("UTF-8","$valid_ucs2_code");
2351 if (cd == (iconv_t)(-1)) return 1;
2352 return iconv(cd, NULL, NULL, NULL, NULL) != 0;
2353 ])
2354 ],
2355 [ AC_MSG_RESULT(yes)
2356 AC_DEFINE(HAVE_ICONV_STATE_RESET, 1, Define to 1 if iconv supports state reset)
2357 ],
2358 [ AC_MSG_RESULT(no) ],
2359 [ AC_MSG_RESULT(no) ]
2360)
2361
2362AC_MSG_CHECKING(whether iconv descriptor cache is needed)
2363case $enable_iconv_cache in
2364 auto)
2365 case $PLATFORM in
2366 SunOS|HP-UX|AIX)
2367 enable_iconv_cache=yes
2368 ;;
2369 *)
2370 enable_iconv_cache=no
2371 ;;
2372 esac
2373 ;;
2374 yes|no)
2375 ;;
2376 *)
2377 AC_MSG_ERROR([Value given to --enable-iconv-cache must be one of yes, no or auto])
2378 ;;
2379esac
2380if test "x$enable_iconv_cache" = "xyes"; then
2381 AC_DEFINE(WITH_ICONV_CACHE, 1, Define to 1 to enable iconv descriptor cache)
2382fi
2383AC_MSG_RESULT($enable_iconv_cache)
2384
19619a35
AK
2385# taken from ZSH's configure
2386# Check if iconv uses const in prototype declaration
24b1570c 2387if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 2388 AC_LANG_PUSH([C++])
19619a35 2389 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
2390 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2391#include <stdlib.h>
f6a2136d 2392#if HAVE_ICONV_H
7f9423af 2393#include <iconv.h>
f6a2136d 2394#endif
f6a2136d
VK
2395 ]],
2396 [[
3e51d371
VK
2397 char **p = NULL;
2398 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 2399 ]])],
3e51d371
VK
2400 [ac_cv_iconv_const=const],
2401 [ac_cv_iconv_const=])])
53c96e2d 2402 AC_LANG_POP([C++])
19619a35
AK
2403 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2404 [Define as const if the declaration of iconv() needs const.])
2405fi
2406
a67fa146
VK
2407if test "x$ac_cv_type_wchar_t" = "xyes"; then
2408 if test $ac_cv_sizeof_wchar_t -eq 2; then
2409 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2410 fi
8b86c5dc 2411
a67fa146
VK
2412 if test $ac_cv_sizeof_wchar_t -eq 4; then
2413 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2414 fi
2415
2416 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2417 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2418 fi
2419else
2420 if test "x$BUILD_UNICODE" = "xyes"; then
2421 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2422 fi
8b86c5dc
VK
2423fi
2424
c29360a9 2425
ef0c727b 2426#--------------------------------------------------------------------
ca0f4ea3
VK
2427# MySQL
2428#--------------------------------------------------------------------
2429
2430check_substr "$COMPONENTS" "mysql"
2431if test $? = 0; then
9f1ea006
VK
2432 OLD_CPPFLAGS="$CPPFLAGS"
2433 OLD_LDFLAGS="$LDFLAGS"
2434 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2435
2436 CPPFLAGS="$CPPFLAGS $MYSQL_CPPFLAGS"
2437 LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
2438 if test "x$MYSQL_LD_RUN_PATH" != "x"; then
2439 LD_RUN_PATH="${MYSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2440 fi
2441
b93fd1c1 2442 AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MySQL client installation]))
9f1ea006 2443
6fce76d8 2444 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 2445 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 2446
8d131dda
VK
2447 OLD_LIBS="$LIBS"
2448 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 2449
ca0f4ea3 2450 AC_CHECK_FUNCS(mysql_real_escape_string)
9f1ea006
VK
2451
2452 CPPFLAGS="$OLD_CPPFLAGS"
2453 LDFLAGS="$OLD_LDFLAGS"
2454 LD_RUN_PATH="$OLD_LD_RUN_PATH"
8d131dda 2455 LIBS="$OLD_LIBS"
ca0f4ea3
VK
2456fi
2457
2458
2459#--------------------------------------------------------------------
58ed4897
VK
2460# PostgreSQL
2461#--------------------------------------------------------------------
2462
203458b7 2463check_substr "$COMPONENTS" "pgsql"
58ed4897 2464if test $? = 0; then
b535eed6
VK
2465 OLD_CPPFLAGS="$CPPFLAGS"
2466 OLD_LDFLAGS="$LDFLAGS"
2467 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2468
2469 CPPFLAGS="$CPPFLAGS $PGSQL_CPPFLAGS"
2470 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
2471 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2472 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2473 fi
2474
9f1ea006
VK
2475 AC_CHECK_HEADER(libpq-fe.h,,AC_MSG_ERROR([Cannot find libpq-fe.h - check your PostgreSQL client installation]))
2476
58ed4897 2477 AC_CHECK_LIB(m, floor)
b535eed6
VK
2478 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2479 if test "x$PLATFORM" = "xSunOS"; then
2480 PGSQL_LDFLAGS="$PGSQL_LDFLAGS/sparcv9"
2481 LDFLAGS="$OLD_LDFLAGS $PGSQL_LDFLAGS"
2482 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2483 PGSQL_LD_RUN_PATH="$PGSQL_LD_RUN_PATH/sparcv9"
2484 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${OLD_LD_RUN_PATH:+:}${OLD_LD_RUN_PATH}"
2485 fi
2486 unset ac_cv_lib_pq_PQconnectdb
2487 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2488 AC_MSG_ERROR(libpq is required for PostgreSQL support)])
2489 else
2490 AC_MSG_ERROR(libpq is required for PostgreSQL support)
2491 fi
2492 ])
6fce76d8 2493
b535eed6
VK
2494 CPPFLAGS="$OLD_CPPFLAGS"
2495 LDFLAGS="$OLD_LDFLAGS"
2496 LD_RUN_PATH="$OLD_LD_RUN_PATH"
58ed4897
VK
2497fi
2498
2499
2500#--------------------------------------------------------------------
9c29f76e
VK
2501# ODBC
2502#--------------------------------------------------------------------
2503
2504check_substr "$COMPONENTS" "odbc"
2505if test $? = 0; then
2cfe4482
VK
2506 OLD_CPPFLAGS="$CPPFLAGS"
2507 OLD_LDFLAGS="$LDFLAGS"
2508 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2509
2510 CPPFLAGS="$CPPFLAGS $ODBC_CPPFLAGS"
b535eed6 2511 LDFLAGS="$LDFLAGS $ODBC_LDFLAGS"
2cfe4482
VK
2512 if test "x$ODBC_LD_RUN_PATH" != "x"; then
2513 LD_RUN_PATH="${ODBC_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2514 fi
2515
6fce76d8 2516 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 2517 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
2518 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2519 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
2520 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
2521 fi
2cfe4482
VK
2522
2523 CPPFLAGS="$OLD_CPPFLAGS"
2524 LDFLAGS="$OLD_LDFLAGS"
2525 LD_RUN_PATH="$OLD_LD_RUN_PATH"
9c29f76e
VK
2526fi
2527
2528
2529#--------------------------------------------------------------------
41b4790d
VK
2530# Oracle
2531#--------------------------------------------------------------------
2532
2533check_substr "$COMPONENTS" "oracle"
2534if test $? = 0; then
2cfe4482
VK
2535 OLD_CPPFLAGS="$CPPFLAGS"
2536 OLD_LDFLAGS="$LDFLAGS"
2537 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2538
2539 CPPFLAGS="$CPPFLAGS $ORACLE_CPPFLAGS"
b535eed6 2540 LDFLAGS="$LDFLAGS $ORACLE_LDFLAGS"
2cfe4482
VK
2541 if test "x$ORACLE_LD_RUN_PATH" != "x"; then
2542 LD_RUN_PATH="${ORACLE_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2543 fi
2544
41b4790d 2545 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
e5cceced 2546 AC_CHECK_LIB(nnz12, nzstrcpy, [NNZ_LIB=-lnnz12],
7d8c91ef 2547 [
e5cceced
VK
2548 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
2549 [
2550 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
2551 ], [-lclntsh])
7d8c91ef
VK
2552 ], [-lclntsh])
2553 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
2554 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 2555 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
2556 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2557 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
2558 fi
2cfe4482
VK
2559
2560 CPPFLAGS="$OLD_CPPFLAGS"
2561 LDFLAGS="$OLD_LDFLAGS"
2562 LD_RUN_PATH="$OLD_LD_RUN_PATH"
41b4790d
VK
2563fi
2564
84277a0f
AK
2565#--------------------------------------------------------------------
2566# DB2
2567#--------------------------------------------------------------------
2568
2569check_substr "$COMPONENTS" "db2"
2570if test $? = 0; then
2571 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
2572 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
2573 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
6afe141e 2574 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2575 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
2576 fi
84277a0f 2577fi
41b4790d
VK
2578
2579#--------------------------------------------------------------------
37861c72
VK
2580# Informix
2581#--------------------------------------------------------------------
2582
2583check_substr "$COMPONENTS" "informix"
2584if test $? = 0; then
2585 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
2586 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
2587 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
2588 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2589 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
2590 fi
37861c72
VK
2591fi
2592
c3cfc039
VK
2593
2594#--------------------------------------------------------------------
50e4bc8c
VK
2595# Java
2596#--------------------------------------------------------------------
2597
2598check_substr "$COMPONENTS" "java"
2599if test $? = 0; then
2600 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
50e4bc8c
VK
2601fi
2602
2603
2604#--------------------------------------------------------------------
b14c3f22
VK
2605# Tuxedo
2606#--------------------------------------------------------------------
2607
2608check_substr "$COMPONENTS" "tuxedo"
2609if test $? = 0; then
2610 OLD_CPPFLAGS="$CPPFLAGS"
2611 OLD_LDFLAGS="$LDFLAGS"
2612 OLD_LIBS="$LIBS"
2613
2614 if test "x$TUXEDO_BASE" != "x"; then
2615 TUXEDO_CPPFLAGS="-I$TUXEDO_BASE/include"
2616 TUXEDO_LDFLAGS="-L$TUXEDO_BASE/lib"
2617 CPPFLAGS="$CPPFLAGS $TUXEDO_CPPFLAGS"
2618 LDFLAGS="$LDFLAGS $TUXEDO_LDFLAGS"
2619 fi
2620
2621 AC_CHECK_HEADER(atmi.h,,AC_MSG_ERROR([*** Cannot find atmi.h - check your Tuxedo installation ***]))
2622
2623 # https://community.oracle.com/thread/2346582
2624 if test "x$PLATFORM" = "xLinux"; then
2625 TUXEDO_LDFLAGS="$TUXEDO_LDFLAGS -Xlinker --no-as-needed"
2626 LDFLAGS="$LDFLAGS -Xlinker --no-as-needed"
2627 fi
6d14d0b0
VK
2628
2629 if test "$PLATFORM" = "SunOS"; then
2630 AC_CHECK_LIB(rt, nanosleep, [ TUXEDO_LIBS="$TUXEDO_LIBS -lrt" ])
2631 fi
2632
73517e51
VK
2633 if test "$PLATFORM" = "AIX"; then
2634 AC_MSG_CHECKING(for xa_switchp in libengine)
2635 OLD_LIBS_LIBENGINE="$LIBS"
2636 LIBS="$LIBS -lengine"
2637 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ extern char *xa_switchp; ]], [[ *xa_switchp = 0; ]])],
2638 [
2639 AC_MSG_RESULT(yes)
2640 TUXEDO_LIBS="$TUXEDO_LIBS -lengine"
2641 ],
2642 [ AC_MSG_RESULT(no) ])
2643 LIBS="$OLD_LIBS_LIBENGINE"
2644 fi
2645
6d14d0b0 2646 LIBS="$LIBS $TUXEDO_LIBS"
73517e51 2647 AC_CHECK_LIB(tux, tpcall, [], [AC_MSG_ERROR(libtux is required for Tuxedo support)])
b14c3f22
VK
2648
2649 CPPFLAGS="$OLD_CPPFLAGS"
2650 LDFLAGS="$OLD_LDFLAGS"
2651 LIBS="$OLD_LIBS"
73517e51
VK
2652
2653 if test "x$PLATFORM" = "xAIX"; then
2654 if test -e $TUXEDO_BASE/lib/tpinit.o; then
2655 TUXEDO_LIBS="$TUXEDO_BASE/lib/tpinit.o $TUXEDO_LIBS"
2656 fi
2657 fi
b14c3f22
VK
2658fi
2659
d6235717 2660#--------------------------------------------------------------------
2661# MongoDB
2662#--------------------------------------------------------------------
2663
2664check_substr "$COMPONENTS" "mongodb"
2665if test $? = 0; then
2666 OLD_CPPFLAGS="$CPPFLAGS"
2667 OLD_LDFLAGS="$LDFLAGS"
2668 OLD_LIBS="$LIBS"
2669
2670 if test "x$MONGODB_BASE" != "x"; then
2671 MONGODB_CPPFLAGS="-I$MONGODB_BASE/include/libmongoc-1.0/ -I$MONGODB_BASE/include/libbson-1.0/"
2672 MONGODB_LDFLAGS="-L$MONGODB_BASE/lib"
2673 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
2674 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
2675 else
2676 MONGODB_CPPFLAGS="-I/usr/local/include/libmongoc-1.0/ -I/usr/local/include/libbson-1.0/"
2677 MONGODB_LDFLAGS="-L/usr/local/lib"
2678 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
2679 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
2680 fi
2681
2682 AC_CHECK_HEADER(mongoc.h,,AC_MSG_ERROR([*** Cannot find mongoc.h - check your MongoDB installation ***]))
2683 AC_CHECK_LIB(mongoc-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lmongoc-1.0" ])
2684 AC_CHECK_LIB(bson-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lbson-1.0" ])
2685
2686 LIBS="$LIBS $MONGODB_LIBS"
2687
2688 CPPFLAGS="$OLD_CPPFLAGS"
2689 LDFLAGS="$OLD_LDFLAGS"
2690 LIBS="$OLD_LIBS"
2691fi
b14c3f22
VK
2692
2693#--------------------------------------------------------------------
ca0f4ea3
VK
2694# Other settings
2695#--------------------------------------------------------------------
2696
a5a95ac8
VK
2697if test "x$RUNTIME_PREFIX" = "x"; then
2698 if test "x${BUILD_UNICODE}" = "xyes"; then
f434ab60 2699 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\" -DSTATEDIR=L\\\"\${localstatedir}/lib/netxms\\\""
a5a95ac8 2700 else
f434ab60 2701 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\" -DSTATEDIR=\\\"\${localstatedir}/lib/netxms\\\""
a5a95ac8 2702 fi
b07c50cc 2703else
a5a95ac8 2704 if test "x${BUILD_UNICODE}" = "xyes"; then
f434ab60 2705 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 2706 else
f434ab60 2707 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 2708 fi
b07c50cc 2709fi
545bda2d 2710LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 2711
25ae8377
VK
2712if test "x${ENABLE_WERROR}" = "xyes"; then
2713 CPPFLAGS="$CPPFLAGS -Werror"
2714fi
2715
cbc4d191
VK
2716if test "x$PLATFORM" = "xDarwin"; then
2717 SHLIB_SUFFIX=".so"
2718else
2719 if test "x$shrext_cmds" != "x"; then
2720 SHLIB_SUFFIX="$shrext_cmds"
2721 else
2722 SHLIB_SUFFIX=".so"
2723 fi
2b479c92 2724fi
cbc4d191 2725AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$SHLIB_SUFFIX"), [Define to platform's shared library suffix])
2b479c92 2726
8c9993b4
VK
2727if test "x$ENABLE_DEBUG" = "xno"; then
2728 CPPFLAGS="$CPPFLAGS -DNDEBUG"
2729fi
2730
f92a016a
VK
2731if test "x$WITH_JEMALLOC" = "xyes"; then
2732 LIBS="$LIBS -ljemalloc"
2733fi
2734
551ec9ca 2735AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 2736AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
f5393033 2737AM_CONDITIONAL([USE_INTERNAL_JANSSON], [test "x$HAVE_JANSSON" = "xno"])
1fd41bcd 2738AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
c1165d33
VK
2739AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
2740AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
eca43970 2741AM_CONDITIONAL([USE_ENCRYPTION], [test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"])
6dde8627 2742AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
058bf6fc 2743AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
8b86c5dc 2744
ca0f4ea3
VK
2745
2746#--------------------------------------------------------------------
8a96930f
AK
2747# Cleanup variables
2748#--------------------------------------------------------------------
2749
2750AS_IF([test "x$with_dist" = "xyes"],
2751[
2752 SUBAGENT_DIRS=`echo $SUBAGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2753 MODULES=`echo $MODULES|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2754 SMSDRV_DIRS=`echo $SMSDRV_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2755 HDLINK_DIRS=`echo $HDLINK_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2756])
2757
2758#--------------------------------------------------------------------
ef0c727b
VK
2759# Substitute variables
2760#--------------------------------------------------------------------
82fa7c5d 2761
ef0c727b
VK
2762AC_SUBST(DB_DRIVERS)
2763AC_SUBST(MODULES)
2764AC_SUBST(SUBAGENT_DIRS)
7dda4453 2765AC_SUBST(SERVER_INCLUDE)
7c48e2aa 2766AC_SUBST(SERVER_LIBS)
ef0c727b 2767AC_SUBST(SERVER_TOOLS)
c20f8eb7 2768AC_SUBST(SMSDRV_DIRS)
6fad8870 2769AC_SUBST(HDLINK_DIRS)
52a2232c 2770AC_SUBST(PDSDRV_DIRS)
ef0c727b
VK
2771AC_SUBST(TOP_LEVEL_MODULES)
2772AC_SUBST(CONTRIB_MODULES)
c2612d83 2773AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
2774AC_SUBST(STATIC_SUBAGENT_LIST)
2775AC_SUBST(SUBAGENT_LIBS)
2776AC_SUBST(BUILD_SERVER)
447350a9 2777AC_SUBST(BUILD_SDK)
2cfe4482
VK
2778AC_SUBST(MYSQL_CPPFLAGS)
2779AC_SUBST(MYSQL_LDFLAGS)
6fce76d8 2780AC_SUBST(MYSQL_LIBS)
2cfe4482
VK
2781AC_SUBST(PGSQL_CPPFLAGS)
2782AC_SUBST(PGSQL_LDFLAGS)
6fce76d8 2783AC_SUBST(PGSQL_LIBS)
2cfe4482
VK
2784AC_SUBST(ORACLE_CPPFLAGS)
2785AC_SUBST(ORACLE_LDFLAGS)
7d8c91ef 2786AC_SUBST(ORACLE_LIBS)
2cfe4482
VK
2787AC_SUBST(ODBC_CPPFLAGS)
2788AC_SUBST(ODBC_LDFLAGS)
6fce76d8 2789AC_SUBST(ODBC_LIBS)
2cfe4482
VK
2790AC_SUBST(DB2_CPPFLAGS)
2791AC_SUBST(DB2_LDFLAGS)
84277a0f 2792AC_SUBST(DB2_LIBS)
2cfe4482
VK
2793AC_SUBST(INFORMIX_CPPFLAGS)
2794AC_SUBST(INFORMIX_LDFLAGS)
87f1fff0 2795AC_SUBST(INFORMIX_LIBS)
11ce9a66 2796AC_SUBST(OBJECT_MODE)
9113e749 2797AC_SUBST(SQLFLAGS)
cbc4d191 2798AC_SUBST(SHLIB_SUFFIX)
b14c3f22
VK
2799AC_SUBST(TUXEDO_CPPFLAGS)
2800AC_SUBST(TUXEDO_LDFLAGS)
6d14d0b0 2801AC_SUBST(TUXEDO_LIBS)
d6235717 2802AC_SUBST(MONGODB_CPPFLAGS)
2803AC_SUBST(MONGODB_LDFLAGS)
2804AC_SUBST(MONGODB_LIBS)
b5e5849b 2805AC_SUBST(INSTALL_LIBPATH)
d16cf8a5 2806
ef0c727b
VK
2807#--------------------------------------------------------------------
2808# Shared libs versions
d16cf8a5
AK
2809#
2810# versioning scheme: current:revision:age
2811#
2812# current
2813# The number of the current interface exported by the library. A current
2814# value of `0', means that you are calling the interface exported by this
2815# library interface 0.
2816#
2817# revision
2818# The implementation number of the most recent interface exported by this
2819# library. In this case, a revision value of `0' means that this is the
2820# first implementation of the interface.
2821# If the next release of this library exports the same interface, but has a
2822# different implementation (perhaps some bugs have been fixed), the revision
2823# number will be higher, but current number will be the same. In that case,
2824# when given a choice, the library with the highest revision will always
2825# be used by the runtime loader.
2826#
2827# age
2828# The number of previous additional interfaces supported by this library.
2829# If age were `2', then this library can be linked into executables which
2830# were built with a release of this library that exported the current
2831# interface number, current, or any of the previous two interfaces.
2832# By definition age must be less than or equal to current. At the outset,
2833# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 2834#--------------------------------------------------------------------
d16cf8a5 2835
359784de 2836NETXMS_LIBRARY_VERSION=2:0:0
c7d14846 2837AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 2838
ef0c727b
VK
2839#--------------------------------------------------------------------
2840# Generate output files
2841#--------------------------------------------------------------------
d16cf8a5
AK
2842
2843AC_CONFIG_FILES([
0c3c0c39
AK
2844 Makefile
2845 contrib/Makefile
36874eca
VK
2846 contrib/backgrounds/Makefile
2847 contrib/integration/Makefile
2848 contrib/integration/HP_EVA/Makefile
bad6cc0c 2849 contrib/integration/HP_P2000/Makefile
36874eca 2850 contrib/mibs/Makefile
19e3290a 2851 contrib/music/Makefile
0c3c0c39 2852 contrib/startup/Makefile
fa66d60c 2853 contrib/startup/debian/Makefile
daaefaaf 2854 contrib/startup/gentoo/Makefile
7483d0bf 2855 contrib/startup/hp-ux/Makefile
0c3c0c39 2856 contrib/startup/redhat/Makefile
5de3893d 2857 contrib/startup/suse/Makefile
9993edf4 2858 contrib/startup/ubuntu/Makefile
6adf3219 2859 contrib/startup/solaris/Makefile
27fc5ee9
AK
2860 debian/Makefile
2861 debian/patches/Makefile
2862 debian/source/Makefile
0c3c0c39 2863 doc/Makefile
a48203d2
VK
2864 doc/internal/Makefile
2865 doc/manuals/Makefile
2866 doc/misc/Makefile
0c3c0c39
AK
2867 images/Makefile
2868 include/Makefile
2869 m4/Makefile
0c3c0c39 2870 src/Makefile
9191f6ad
VK
2871 src/agent/Makefile
2872 src/agent/core/Makefile
2873 src/agent/install/Makefile
359784de 2874 src/agent/libnxagent/Makefile
52275230 2875 src/agent/libnxappc/Makefile
a2a24e9d 2876 src/agent/libnxsd/Makefile
9191f6ad 2877 src/agent/subagents/Makefile
9191f6ad 2878 src/agent/subagents/aix/Makefile
df8b3df7 2879 src/agent/subagents/darwin/Makefile
52f5ee00
VK
2880 src/agent/subagents/db2/Makefile
2881 src/agent/subagents/dbquery/Makefile
ab1e80fd 2882 src/agent/subagents/devemu/Makefile
e58b0f75 2883 src/agent/subagents/ds18x20/Makefile
80e96a82 2884 src/agent/subagents/ecs/Makefile
ab1e80fd 2885 src/agent/subagents/filemgr/Makefile
9191f6ad 2886 src/agent/subagents/freebsd/Makefile
80e96a82
VK
2887 src/agent/subagents/hpux/Makefile
2888 src/agent/subagents/informix/Makefile
9191f6ad 2889 src/agent/subagents/ipso/Makefile
50e4bc8c
VK
2890 src/agent/subagents/java/Makefile
2891 src/agent/subagents/java/java/Makefile
2892 src/agent/subagents/java/java/src/Makefile
2893 src/agent/subagents/java/java/src/main/Makefile
2894 src/agent/subagents/java/java/src/main/java/Makefile
2895 src/agent/subagents/java/java/src/main/java/org/Makefile
2896 src/agent/subagents/java/java/src/main/java/org/netxms/Makefile
2897 src/agent/subagents/java/java/src/main/java/org/netxms/agent/Makefile
3118008e 2898 src/agent/subagents/java/java/src/main/java/org/netxms/agent/adapters/Makefile
d2f78ba0 2899 src/agent/subagents/java/sample/Makefile
688dad5a
VK
2900 src/agent/subagents/java/sample/src/Makefile
2901 src/agent/subagents/java/sample/src/main/Makefile
2902 src/agent/subagents/java/sample/src/main/java/Makefile
2903 src/agent/subagents/java/sample/src/main/java/org/Makefile
2904 src/agent/subagents/java/sample/src/main/java/org/netxms/Makefile
2905 src/agent/subagents/java/sample/src/main/java/org/netxms/agent/Makefile
2906 src/agent/subagents/java/sample/src/main/java/org/netxms/agent/demo/Makefile
80e96a82 2907 src/agent/subagents/linux/Makefile
df8b3df7 2908 src/agent/subagents/lmsensors/Makefile
80e96a82
VK
2909 src/agent/subagents/logwatch/Makefile
2910 src/agent/subagents/netbsd/Makefile
df8b3df7 2911 src/agent/subagents/netsvc/Makefile
80e96a82
VK
2912 src/agent/subagents/odbcquery/Makefile
2913 src/agent/subagents/openbsd/Makefile
4d1753cd 2914 src/agent/subagents/oracle/Makefile
9191f6ad 2915 src/agent/subagents/ping/Makefile
80e96a82 2916 src/agent/subagents/portCheck/Makefile
df8b3df7 2917 src/agent/subagents/rpi/Makefile
9191f6ad 2918 src/agent/subagents/sms/Makefile
80e96a82 2919 src/agent/subagents/sunos/Makefile
b14c3f22 2920 src/agent/subagents/tuxedo/Makefile
d6235717 2921 src/agent/subagents/mongodb/Makefile
de1205d5 2922 src/agent/subagents/ubntlw/Makefile
9191f6ad 2923 src/agent/subagents/ups/Makefile
80e96a82
VK
2924 src/agent/subagents/winnt/Makefile
2925 src/agent/subagents/winperf/Makefile
52f5ee00 2926 src/agent/subagents/wmi/Makefile
0bd64860 2927 src/agent/tools/Makefile
6ac698ed 2928 src/agent/tools/nxappget/Makefile
0bd64860 2929 src/agent/tools/nxapush/Makefile
d8637bab 2930 src/appagent/Makefile
c2612d83 2931 src/client/Makefile
551592f4 2932 src/client/install/Makefile
be03fec6 2933 src/client/libnxclient/Makefile
c94fa5c2 2934 src/client/nxalarm/Makefile
e84701c5
VK
2935 src/client/nxevent/Makefile
2936 src/client/nxpush/Makefile
59ffa5b7 2937 src/client/nxsms/Makefile
d1834406
VK
2938 src/db/Makefile
2939 src/db/dbdrv/Makefile
87f1fff0
VK
2940 src/db/dbdrv/db2/Makefile
2941 src/db/dbdrv/informix/Makefile
d1834406
VK
2942 src/db/dbdrv/odbc/Makefile
2943 src/db/dbdrv/mssql/Makefile
2944 src/db/dbdrv/mysql/Makefile
87f1fff0 2945 src/db/dbdrv/oracle/Makefile
d1834406
VK
2946 src/db/dbdrv/pgsql/Makefile
2947 src/db/dbdrv/sqlite/Makefile
d1834406 2948 src/db/libnxdb/Makefile
9191f6ad
VK
2949 src/install/Makefile
2950 src/install/windows/Makefile
f5393033 2951 src/jansson/Makefile
9191f6ad
VK
2952 src/libexpat/Makefile
2953 src/libexpat/libexpat/Makefile
2954 src/libnetxms/Makefile
a7a4c1e9 2955 src/libnxcc/Makefile
9191f6ad
VK
2956 src/libnxlp/Makefile
2957 src/libnxmap/Makefile
0d956dd9 2958 src/libnxmb/Makefile
10d5b2b2 2959 src/libnxsl/Makefile
058bf6fc 2960 src/libstrophe/Makefile
a67fa146
VK
2961 src/libtre/Makefile
2962 src/libtre/win32/Makefile
a7a03ffd 2963 src/nxcproxy/Makefile
8dca469f 2964 src/nxlptest/Makefile
9191f6ad 2965 src/nxscript/Makefile
0c3c0c39
AK
2966 src/server/Makefile
2967 src/server/core/Makefile
644f97f5 2968 src/server/drivers/Makefile
386f88e3 2969 src/server/drivers/airespace/Makefile
0239cfea 2970 src/server/drivers/at/Makefile
644f97f5 2971 src/server/drivers/baystack/Makefile
b1bd1fb2 2972 src/server/drivers/cat2900xl/Makefile
910846cc 2973 src/server/drivers/catalyst/Makefile
fce03ab9 2974 src/server/drivers/cisco-esw/Makefile
ae8ea5a6 2975 src/server/drivers/cisco-sb/Makefile
8bdfaed8 2976 src/server/drivers/dell-pwc/Makefile
a548def4 2977 src/server/drivers/dlink/Makefile
644f97f5 2978 src/server/drivers/ers8000/Makefile
d7e23292 2979 src/server/drivers/h3c/Makefile
d594d378 2980 src/server/drivers/hpsw/Makefile
4e592faf
VK
2981 src/server/drivers/lib/Makefile
2982 src/server/drivers/lib/avaya-ers/Makefile
b1bd1fb2 2983 src/server/drivers/lib/cisco/Makefile
a73592db 2984 src/server/drivers/mikrotik/Makefile
81ecaf38 2985 src/server/drivers/netscreen/Makefile
e10e890e 2986 src/server/drivers/ntws/Makefile
c183a9f9 2987 src/server/drivers/ping3/Makefile
9b13553b 2988 src/server/drivers/procurve/Makefile
ac7e4032 2989 src/server/drivers/qtech-olt/Makefile
217e4d6a 2990 src/server/drivers/symbol-ws/Makefile
e5f4e3ac 2991 src/server/drivers/tb/Makefile
8cf94ffe 2992 src/server/drivers/ubnt/Makefile
6fad8870
VK
2993 src/server/hdlink/Makefile
2994 src/server/hdlink/jira/Makefile
d770a97c
VK
2995 src/server/include/Makefile
2996 src/server/libnxsrv/Makefile
2997 src/server/netxmsd/Makefile
52a2232c
VK
2998 src/server/pdsdrv/Makefile
2999 src/server/pdsdrv/rrdtool/Makefile
d8f2e39b 3000 src/server/smsdrv/Makefile
8d7f1bea 3001 src/server/smsdrv/dummy/Makefile
d8f2e39b 3002 src/server/smsdrv/generic/Makefile
e47404b3 3003 src/server/smsdrv/kannel/Makefile
91369aca 3004 src/server/smsdrv/nxagent/Makefile
aab8a8b6 3005 src/server/smsdrv/portech/Makefile
681c0b39 3006 src/server/smsdrv/slack/Makefile
9b571a7e 3007 src/server/smsdrv/text2reach/Makefile
8d7f1bea 3008 src/server/smsdrv/websms/Makefile
0c3c0c39 3009 src/server/tools/Makefile
0c3c0c39
AK
3010 src/server/tools/nxaction/Makefile
3011 src/server/tools/nxadm/Makefile
9191f6ad 3012 src/server/tools/nxap/Makefile
5b0c7d0d
VK
3013 src/server/tools/nxconfig/Makefile
3014 src/server/tools/nxconfig/res/Makefile
f90d7fc5 3015 src/server/tools/nxdbmgr/Makefile
9191f6ad 3016 src/server/tools/nxget/Makefile
d24fdaf4 3017 src/server/tools/nxupload/Makefile
c5c0f362
VK
3018 src/snmp/Makefile
3019 src/snmp/libnxsnmp/Makefile
3020 src/snmp/nxmibc/Makefile
3021 src/snmp/nxsnmpget/Makefile
3022 src/snmp/nxsnmpset/Makefile
3023 src/snmp/nxsnmpwalk/Makefile
9191f6ad 3024 src/sqlite/Makefile
f65df2b1 3025 src/tools/Makefile
f65df2b1 3026 src/tools/nxdevcfg/Makefile
56e13b13 3027 src/tools/nxencpasswd/Makefile
271e3971 3028 src/tools/nxgenguid/Makefile
1fd41bcd 3029 src/zlib/Makefile
9191f6ad 3030 sql/Makefile
33a10d92
VK
3031 tests/Makefile
3032 tests/include/Makefile
3033 tests/test-libnetxms/Makefile
a7a4c1e9 3034 tests/test-libnxcc/Makefile
66c11d49 3035 tests/test-libnxdb/Makefile
0c3c0c39 3036 tools/Makefile
d16cf8a5
AK
3037])
3038
12249937
VK
3039AC_OUTPUT
3040
ef0c727b 3041echo "Updating libtool"
5cecf50e
AK
3042sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
3043
779ce551 3044# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
5482ef16 3045if test "x$ac_compiler_gnu" = "xyes" && test "x$PLATFORM" = "xHP-UX"; then
779ce551
VK
3046 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
3047fi
3048
b677ef59
VK
3049# On AIX, correct OBJECT_MODE must be set before linking
3050# To avoid manual setting by user, we add this to libtool script
3051if test "x$PLATFORM" = "xAIX"; then
3052 head -n 1 ./libtool > ./libtool.new
3053 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
3054 tail -n +2 ./libtool >> ./libtool.new
3055 mv libtool.new libtool
3056 chmod +x ./libtool
3057fi
3058
ef0c727b
VK
3059#--------------------------------------------------------------------
3060# Print summary
3061#--------------------------------------------------------------------
a7442678 3062
a7442678
AK
3063echo
3064echo
3065echo
3066echo '---------------------------------------------------------------------'
3067echo ' Configure results'
3068echo '---------------------------------------------------------------------'
3069echo
8b86c5dc 3070 echo "Prefix : ${prefix}"
cbc4d191
VK
3071 echo "Platform : ${PLATFORM}"
3072 echo "Shared library suffix : ${SHLIB_SUFFIX}"
b8adb0f2
VK
3073if test "x$IPV6_SUPPORT" = "xyes"; then
3074 echo "IPv6 support : YES"
3075else
3076 echo "IPv6 support : NO"
3077fi
a7442678 3078if test "x${BUILD_SERVER}" = "xyes"; then
8b86c5dc 3079 echo "Build Server : YES"
7c48e2aa 3080 echo "Server libs : ${SERVER_LIBS}"
2cfe4482
VK
3081 if test "x${LDAP_SUPPORT}" = "xyes"; then
3082 echo "LDAP support : YES"
3083 else
3084 echo "LDAP support : NO"
3085 fi
058bf6fc
VK
3086 if test "x${XMPP_SUPPORT}" = "xyes"; then
3087 echo "XMPP support : YES"
3088 else
3089 echo "XMPP support : NO"
3090 fi
a7442678 3091else
8b86c5dc 3092 echo "Build Server : NO"
a7442678
AK
3093fi
3094if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
8b86c5dc 3095 echo "Encryption enabled : YES"
a7442678 3096else
8b86c5dc 3097 echo "Encryption enabled : NO"
a7442678
AK
3098fi
3099if test "x${DB_DRIVERS}" != "x"; then
8b86c5dc 3100 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678 3101else
8b86c5dc 3102 echo "Build DB-Drivers : NO"
a7442678
AK
3103fi
3104if test "x${BUILD_CLIENT}" = "xyes"; then
8b86c5dc 3105 echo "Build Clients : YES"
a7442678 3106else
8b86c5dc 3107 echo "Build Clients : NO"
a7442678
AK
3108fi
3109if test "x${BUILD_AGENT}" = "xyes"; then
8b86c5dc
VK
3110 echo "Build Agent : YES"
3111 echo "Subagents list : ${SUBAGENT_DIRS}"
a7442678 3112else
8b86c5dc 3113 echo "Build Agent : NO"
a7442678 3114fi
e8636669 3115if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
8b86c5dc
VK
3116 echo "Build Static Agent : YES"
3117 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
e8636669 3118else
8b86c5dc 3119 echo "Build Static Agent : NO"
e8636669 3120fi
8b86c5dc 3121if test "x${BUILD_UNICODE}" = "xyes"; then
a67fa146 3122 echo "UNICODE build : YES"
8b86c5dc 3123else
a67fa146 3124 echo "UNICODE build : NO"
8b86c5dc 3125fi
551ec9ca
VK
3126if test "x${HAVE_LIBEXPAT}" = "xno"; then
3127 echo "Use internal libexpat : YES"
1bb6b449 3128else
551ec9ca 3129 echo "Use internal libexpat : NO"
1bb6b449 3130fi
17b35ccc
VK
3131if test "x${HAVE_LIBTRE}" = "xno"; then
3132 echo "Use internal libtre : YES"
3133else
3134 echo "Use internal libtre : NO"
3135fi
f5393033
VK
3136if test "x${HAVE_JANSSON}" = "xno"; then
3137 echo "Use internal libjansson : YES"
3138else
3139 echo "Use internal libjansson : NO"
3140fi
1fd41bcd
VK
3141if test "x${NEED_ZLIB}" = "xyes"; then
3142 if test "x${HAVE_ZLIB}" = "xno"; then
3143 echo "Use internal zlib : YES"
3144 else
3145 echo "Use internal zlib : NO"
3146 fi
3147fi
cc297a70
VK
3148if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
3149 echo "Force 32bit build : YES"
3150else
3151 echo "Force 32bit build : NO"
3152fi
7d8c91ef 3153
9113e749
VK
3154echo "C compiler : ${CC}"
3155echo "C++ compiler : ${CXX}"
7d8c91ef
VK
3156echo "CPPFLAGS : ${CPPFLAGS}"
3157echo "CXXFLAGS : ${CXXFLAGS}"
3158echo "CFLAGS : ${CFLAGS}"
3159echo "LDFLAGS : ${LDFLAGS}"
8d131dda 3160echo "LIBS : ${LIBS}"
7d8c91ef 3161
2cfe4482
VK
3162if test "x${MYSQL_CPPFLAGS}" != "x"; then
3163 echo "MySQL CPPFLAGS : ${MYSQL_CPPFLAGS}"
3164fi
3165if test "x${MYSQL_LDFLAGS}" != "x"; then
3166 echo "MySQL LDFLAGS : ${MYSQL_LDFLAGS}"
3167fi
6fce76d8 3168if test "x${MYSQL_LIBS}" != "x"; then
2cfe4482
VK
3169 echo "MySQL LIBS : ${MYSQL_LIBS}"
3170fi
3171
3172if test "x${PGSQL_CPPFLAGS}" != "x"; then
3173 echo "PostgreSQL CPPFLAGS : ${PGSQL_CPPFLAGS}"
3174fi
3175if test "x${PGSQL_LDFLAGS}" != "x"; then
3176 echo "PostgreSQL LDFLAGS : ${PGSQL_LDFLAGS}"
6fce76d8
VK
3177fi
3178if test "x${PGSQL_LIBS}" != "x"; then
2cfe4482
VK
3179 echo "PostgreSQL LIBS : ${PGSQL_LIBS}"
3180fi
3181
3182if test "x${ORACLE_CPPFLAGS}" != "x"; then
3183 echo "Oracle CPPFLAGS : ${ORACLE_CPPFLAGS}"
3184fi
3185if test "x${ORACLE_LDFLAGS}" != "x"; then
3186 echo "Oracle LDFLAGS : ${ORACLE_LDFLAGS}"
6fce76d8 3187fi
7d8c91ef 3188if test "x${ORACLE_LIBS}" != "x"; then
2cfe4482
VK
3189 echo "Oracle LIBS : ${ORACLE_LIBS}"
3190fi
3191
3192if test "x${ODBC_CPPFLAGS}" != "x"; then
3193 echo "ODBC CPPFLAGS : ${ODBC_CPPFLAGS}"
3194fi
3195if test "x${ODBC_LDFLAGS}" != "x"; then
3196 echo "ODBC LDFLAGS : ${ODBC_LDFLAGS}"
7d8c91ef 3197fi
6fce76d8 3198if test "x${ODBC_LIBS}" != "x"; then
2cfe4482
VK
3199 echo "ODBC LIBS : ${ODBC_LIBS}"
3200fi
3201
3202if test "x${DB2_CPPFLAGS}" != "x"; then
3203 echo "DB2 CPPFLAGS : ${DB2_CPPFLAGS}"
3204fi
3205if test "x${DB2_LDFLAGS}" != "x"; then
3206 echo "DB2 LDFLAGS : ${DB2_LDFLAGS}"
6fce76d8 3207fi
84277a0f 3208if test "x${DB2_LIBS}" != "x"; then
2cfe4482
VK
3209 echo "DB2 LIBS : ${DB2_LIBS}"
3210fi
3211
3212if test "x${INFORMIX_CPPFLAGS}" != "x"; then
3213 echo "Informix CPPFLAGS : ${INFORMIX_CPPFLAGS}"
3214fi
3215if test "x${INFORMIX_LDFLAGS}" != "x"; then
3216 echo "Informix LDFLAGS : ${INFORMIX_LDFLAGS}"
84277a0f 3217fi
37861c72 3218if test "x${INFORMIX_LIBS}" != "x"; then
2cfe4482 3219 echo "Informix LIBS : ${INFORMIX_LIBS}"
37861c72 3220fi
ecbed20c 3221
b14c3f22
VK
3222if test "x${TUXEDO_CPPFLAGS}" != "x"; then
3223 echo "Tuxedo CPPFLAGS : ${TUXEDO_CPPFLAGS}"
3224fi
3225if test "x${TUXEDO_LDFLAGS}" != "x"; then
3226 echo "Tuxedo LDFLAGS : ${TUXEDO_LDFLAGS}"
3227fi
73517e51
VK
3228if test "x${TUXEDO_LIBS}" != "x"; then
3229 echo "Tuxedo LIBS : ${TUXEDO_LIBS}"
3230fi
b14c3f22 3231
d6235717 3232if test "x${MONGODB_CPPFLAGS}" != "x"; then
3233 echo "MongoDB CPPFLAGS : ${MONGODB_CPPFLAGS}"
3234fi
3235if test "x${MONGODB_LDFLAGS}" != "x"; then
3236 echo "MongoDB LDFLAGS : ${MONGODB_LDFLAGS}"
3237fi
3238
ecbed20c
VK
3239FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
3240echo "/* Automatically generated by configure */" > $FLAGS_CPP
d541b129
VK
3241echo "#include <nms_common.h>" >> $FLAGS_CPP
3242echo "const TCHAR *g_cppFlags = _T(\"${CPPFLAGS}\");" >> $FLAGS_CPP
3243echo "const TCHAR *g_cFlags = _T(\"${CFLAGS}\");" >> $FLAGS_CPP
3244echo "const TCHAR *g_cxxFlags = _T(\"${CXXFLAGS}\");" >> $FLAGS_CPP
3245echo "const TCHAR *g_ldFlags = _T(\"${LDFLAGS}\");" >> $FLAGS_CPP
3246echo "const TCHAR *g_libs = _T(\"${LIBS}\");" >> $FLAGS_CPP
7dda4453
VK
3247echo "const TCHAR *g_cc = _T(\"${CC}\");" >> $FLAGS_CPP
3248echo "const TCHAR *g_cxx = _T(\"${CXX}\");" >> $FLAGS_CPP
3249echo "const TCHAR *g_ld = _T(\"${LD}\");" >> $FLAGS_CPP
3250echo "const TCHAR *g_perl = _T(\"${PERL}\");" >> $FLAGS_CPP
71eb7113 3251echo "const TCHAR *g_serverLibs = _T(\"${SERVER_LIBS}\");" >> $FLAGS_CPP