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