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