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