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