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