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