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