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