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