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