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