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