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