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