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