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