version number updated
[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="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="freebsd"
801 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/freebsd/freebsd.la"
802 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
803 ;;
804 OpenBSD)
805 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="netbsd"
811 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/netbsd/netbsd.la"
812 STATIC_SUBAGENT_LIST="netbsd $STATIC_SUBAGENT_LIST"
813 ;;
814 SunOS)
815 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="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="hpux"
826 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/hpux/hpux.la"
827 STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
828 ;;
829 Darwin)
830 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="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="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="linux ds18x20"
870 ;;
871 FreeBSD)
872 SUBAGENT_DIRS="freebsd"
873 ;;
874 OpenBSD)
875 SUBAGENT_DIRS="openbsd"
876 ;;
877 NetBSD)
878 SUBAGENT_DIRS="netbsd"
879 ;;
880 SunOS)
881 SUBAGENT_DIRS="sunos"
882 ;;
883 AIX)
884 SUBAGENT_DIRS="aix"
885 ;;
886 HP-UX)
887 SUBAGENT_DIRS="hpux"
888 ;;
889 Darwin)
890 SUBAGENT_DIRS="darwin"
891 ;;
892 Minix)
893 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 getgrnam getpwnam malloc_info malloc_trim utime])
2133
2134 AC_CHECK_DECLS([nanosleep, daemon, strerror])
2135
2136 # Do not use inet_pton on Solaris as it has binary compatibility problems
2137 if test "$PLATFORM" != "SunOS"; then
2138 AC_CHECK_FUNCS([inet_pton])
2139 fi
2140
2141 # Check if strerror_r is POSIX-compliant
2142 if test "$ac_cv_func_strerror_r" = "yes"; then
2143 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
2144 AC_LANG_PUSH([C++])
2145 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2146 #if HAVE_STRING_H
2147 #include <string.h>
2148 #endif
2149 #if HAVE_ERRNO_H
2150 #include <errno.h>
2151 #endif
2152 ]],[[
2153 int e;
2154 char buffer[256];
2155 e = strerror_r(1, buffer, 256);
2156 return e;
2157 ]])
2158 ],[
2159 AC_MSG_RESULT(yes)
2160 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
2161 ],[
2162 AC_MSG_RESULT(no)
2163 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
2164 ])
2165 AC_LANG_POP([C++])
2166 fi
2167
2168 # Check if struct tm has tm_gmtoff member
2169 AC_MSG_CHECKING(for struct tm.tm_gmtoff)
2170 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2171 #if HAVE_TIME_H
2172 #include <time.h>
2173 #endif
2174 #if HAVE_SYS_TIME_H
2175 #include <sys/time.h>
2176 #endif
2177 ]],[[
2178 struct tm t;
2179 return t.tm_gmtoff;
2180 ]])
2181 ],[
2182 AC_MSG_RESULT(yes)
2183 AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
2184 ],[
2185 AC_MSG_RESULT(no)
2186 ])
2187
2188 AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
2189 AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
2190
2191 # asprintf, scprintf, etc.
2192 AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
2193 AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
2194 AC_CHECK_FUNCS([snprintf vsnprintf])
2195
2196 AC_MSG_CHECKING(whether snprintf returns required buffer size)
2197 AC_RUN_IFELSE(
2198 [AC_LANG_PROGRAM([
2199 #include <stdio.h>
2200 #include <string.h>
2201 ], [
2202 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
2203 ])
2204 ],
2205 [ AC_MSG_RESULT(yes)
2206 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
2207 ],
2208 [ AC_MSG_RESULT(no) ],
2209 [ AC_MSG_RESULT(no) ]
2210 )
2211
2212 AC_MSG_CHECKING(whether free correctly handles NULL pointer)
2213 AC_RUN_IFELSE(
2214 [AC_LANG_PROGRAM([
2215 #include <stdlib.h>
2216 ], [
2217 free(NULL);
2218 return 0;
2219 ])
2220 ],
2221 [ AC_MSG_RESULT(yes)
2222 AC_DEFINE(FREE_IS_NULL_SAFE, 1, Define to 1 if free corectly handles NULL pointer)
2223 ],
2224 [ AC_MSG_RESULT(no) ],
2225 [ AC_MSG_RESULT(no) ]
2226 )
2227
2228
2229 #--------------------------------------------------------------------
2230 # Checks for macros and definitions
2231 #--------------------------------------------------------------------
2232
2233 AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64, htonll, ntohll],,,[
2234 #ifdef HAVE_SYS_TYPES_H
2235 #include <sys/types.h>
2236 #endif
2237 #if HAVE_BYTESWAP_H
2238 #include <byteswap.h>
2239 #endif
2240 #if HAVE_NETINET_IN_H
2241 #include <netinet/in.h>
2242 #endif
2243 #if HAVE_NET_NH_H
2244 #include <net/nh.h>
2245 #endif
2246 ])
2247 AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
2248 #ifdef HAVE_UNISTD_H
2249 #include <unistd.h>
2250 #endif
2251 #ifdef HAVE_DLFCN_H
2252 #include <dlfcn.h>
2253 #endif
2254 ])
2255 AC_CHECK_DECLS([va_copy, __va_copy],,,[
2256 #ifdef HAVE_UNISTD_H
2257 #include <unistd.h>
2258 #endif
2259 #ifdef HAVE_STDARG_H
2260 #include <stdarg.h>
2261 #endif
2262 #ifdef HAVE_STDLIB_H
2263 #include <stdlib.h>
2264 #endif
2265 ])
2266
2267
2268 #--------------------------------------------------------------------
2269 # getopt
2270 #--------------------------------------------------------------------
2271
2272 if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
2273 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
2274 else
2275 AC_CHECK_HEADERS([getopt.h])
2276 AC_CHECK_LIB(gnugetopt, getopt_long)
2277 AC_CHECK_DECLS([getopt_long],,,[
2278 #if HAVE_GETOPT_H
2279 #include <getopt.h>
2280 #endif
2281 ])
2282 fi
2283
2284
2285 #--------------------------------------------------------------------
2286 # Linux specific checks
2287 #--------------------------------------------------------------------
2288
2289 if test "x$PLATFORM" = "xLinux"; then
2290 AC_CHECK_HEADERS([sys/reboot.h],,,[[ ]])
2291 AC_CHECK_DECLS([reboot, RB_AUTOBOOT, RB_POWER_OFF, RB_HALT_SYSTEM],,,[
2292 #if HAVE_SYS_REBOOT_H
2293 #include <sys/reboot.h>
2294 #endif
2295 ])
2296 AC_CHECK_FUNCS([reboot],,,[
2297 #if HAVE_SYS_REBOOT_H
2298 #include <sys/reboot.h>
2299 #endif
2300 ])
2301
2302 AC_CHECK_HEADERS([jemalloc/jemalloc.h],
2303 [
2304 AC_CHECK_LIB(jemalloc, malloc,
2305 [
2306 WITH_JEMALLOC="yes"
2307 AC_DEFINE(WITH_JEMALLOC,1,Define to 1 if libjemalloc is used)
2308 ])
2309 ])
2310 fi
2311
2312
2313 #--------------------------------------------------------------------
2314 # AIX specific checks
2315 #--------------------------------------------------------------------
2316
2317 if test "x$PLATFORM" = "xAIX"; then
2318 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
2319 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
2320 #if HAVE_PROCINFO_H
2321 #include <procinfo.h>
2322 #endif
2323 ])
2324 AC_CHECK_FUNCS([getprocs64],,,[
2325 #if HAVE_PROCINFO_H
2326 #include <procinfo.h>
2327 #endif
2328 ])
2329 fi
2330
2331
2332 #--------------------------------------------------------------------
2333 # Solaris specific checks
2334 #--------------------------------------------------------------------
2335
2336 if test "x$PLATFORM" = "xSunOS"; then
2337 AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
2338 #include <sys/atomic.h>
2339 ])
2340 fi
2341
2342
2343 #--------------------------------------------------------------------
2344 # HP-UX specific checks
2345 #--------------------------------------------------------------------
2346
2347 if test "x$PLATFORM" = "xHP-UX"; then
2348 AC_CHECK_HEADERS([atomic.h sys/mib.h],,,[[ ]])
2349 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
2350 #if HAVE_NET_IF_H
2351 #include <net/if.h>
2352 #endif
2353 ])
2354 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
2355 #if HAVE_SYS_MIB_H
2356 #include <sys/mib.h>
2357 #endif
2358 ])
2359
2360 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
2361 AC_LANG_PUSH([C++])
2362 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2363 #include <sys/pstat.h>
2364 ]], [[
2365 pst_diskinfo d;
2366 int x;
2367 x = (int)d.psd_dkread;
2368 x = (int)d.psd_dkwrite;
2369 ]])],
2370 [
2371 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
2372 AC_MSG_RESULT(yes)
2373 ],
2374 [
2375 AC_MSG_RESULT(no)
2376 ])
2377 AC_LANG_POP([C++])
2378 fi
2379
2380
2381 #--------------------------------------------------------------------
2382 # *BSD specific checks
2383 #--------------------------------------------------------------------
2384
2385 AC_CHECK_HEADERS([sys/event.h])
2386 AC_CHECK_LIB(kvm, kvm_open)
2387 AC_CHECK_FUNCS([kvm_openfiles kvm_getswapinfo kqueue])
2388 AC_CHECK_TYPES([struct kinfo_proc2],,,[
2389 #if HAVE_SYS_SYSCTL_H
2390 #include <sys/sysctl.h>
2391 #endif
2392 ])
2393
2394
2395 #--------------------------------------------------------------------
2396 # FreeBSD specific checks
2397 #--------------------------------------------------------------------
2398
2399 if test "x$PLATFORM" = "xFreeBSD"; then
2400 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
2401 #if HAVE_SYS_TYPES_H
2402 #include <sys/types.h>
2403 #endif
2404 #if HAVE_SYS_SOCKET_H
2405 #include <sys/socket.h>
2406 #endif
2407 #include <net/route.h>
2408 ])
2409 fi
2410
2411
2412 #--------------------------------------------------------------------
2413 # OpenBSD specific checks
2414 #--------------------------------------------------------------------
2415
2416 if test "x$PLATFORM" = "xOpenBSD"; then
2417 AC_CHECK_DECLS([SIOCGIFDATA],,,[
2418 #if HAVE_SYS_SOCKIO_H
2419 #include <sys/sockio.h>
2420 #endif
2421 ])
2422 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
2423 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2424 #include <sys/param.h>
2425 #include <sys/proc.h>
2426 #include <sys/sysctl.h>
2427 #include <kvm.h>
2428 #include <sys/user.h>
2429 ]],[[
2430 int count;
2431 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
2432 return 0;
2433 ]])
2434 ],[
2435 AC_MSG_RESULT(yes)
2436 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
2437 ],[
2438 AC_MSG_RESULT(no)
2439 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
2440 ])
2441
2442 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
2443 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2444 #include <sys/param.h>
2445 #include <sys/proc.h>
2446 #include <sys/sysctl.h>
2447 #include <kvm.h>
2448 #include <sys/user.h>
2449 ]],[[
2450 struct kinfo_proc p;
2451 return p.kp_proc.p_pid;
2452 ]])
2453 ],[
2454 AC_MSG_RESULT(yes)
2455 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
2456 ],[
2457 AC_MSG_RESULT(no)
2458 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
2459 ])
2460 fi
2461
2462
2463 #--------------------------------------------------------------------
2464 # Minix specific checks
2465 #--------------------------------------------------------------------
2466
2467 if test "x$PLATFORM" = "xMinix"; then
2468 AC_CHECK_HEADERS([minix/minlib.h])
2469 fi
2470
2471
2472 #--------------------------------------------------------------------
2473 # Check for UNICODE stuff
2474 #--------------------------------------------------------------------
2475
2476 if test "x$BUILD_UNICODE" = "xyes"; then
2477 CPPFLAGS="$CPPFLAGS -DUNICODE"
2478 fi
2479
2480 AC_CHECK_HEADERS([wchar.h wctype.h iconv.h widec.h])
2481 AC_CHECK_TYPES([wchar_t, wint_t],,,[
2482 #if HAVE_WCHAR_H
2483 #include <wchar.h>
2484 #endif
2485 ])
2486 AC_CHECK_SIZEOF(wchar_t,,[
2487 #if HAVE_WCHAR_H
2488 #include <wchar.h>
2489 #endif
2490 ])
2491 AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper towlower])
2492 AC_CHECK_FUNCS([wcslwr wcserror wcserror_r wfopen wfopen64 fputws putws])
2493 AC_CHECK_FUNCS([wopen wstat waccess wgetenv wrename wunlink wremove wchdir])
2494 AC_CHECK_FUNCS([wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod vwscanf])
2495 AC_CHECK_FUNCS([vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
2496 AC_CHECK_FUNCS([mbstowcs mbsrtowcs itow _itow wcsftime wcstok wutime])
2497 AC_CHECK_FUNCS([wprintf vwprintf swprintf vswprintf fwprintf vfwprintf])
2498
2499 AC_CHECK_DECLS([putws],,,[
2500 #if HAVE_WCHAR_H
2501 #include <wchar.h>
2502 #endif
2503 ])
2504
2505 if test "x$ac_cv_func_wcsftime" = "xyes"; then
2506 AC_MSG_CHECKING(whether wcsftime is working correctly)
2507 AC_RUN_IFELSE(
2508 [AC_LANG_PROGRAM([
2509 #include <stdio.h>
2510 #ifdef HAVE_UNISTD_H
2511 #include <unistd.h>
2512 #endif
2513 #ifdef HAVE_TIME_H
2514 #include <time.h>
2515 #endif
2516 #ifdef HAVE_SYS_TIME_H
2517 #include <sys/time.h>
2518 #endif
2519 #if HAVE_WCHAR_H
2520 #include <wchar.h>
2521 #endif
2522 ], [[
2523 wchar_t buffer[64];
2524 struct tm *ltm;
2525 time_t t;
2526
2527 t = time(NULL);
2528 ltm = localtime(&t);
2529 wcsftime(buffer, 64, L"%Y", ltm);
2530 return wcstol(buffer, NULL, 10) == ltm->tm_year + 1900 ? 0 : 1;
2531 ]])
2532 ],
2533 [ AC_MSG_RESULT(yes)
2534 AC_DEFINE(WORKING_WCSFTIME, 1, Define to 1 if wcsftime is working correctly)
2535 ],
2536 [ AC_MSG_RESULT(no) ],
2537 [ AC_MSG_RESULT(no) ]
2538 )
2539 fi
2540
2541 if test "x$DISABLE_ICONV" != "xyes"; then
2542 AC_CHECK_LIB(iconv, libiconv_open,
2543 [ ac_found_iconv=yes
2544 LIBS="$LIBS -liconv"
2545 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
2546 ],
2547 [
2548 AC_CHECK_LIB(iconv, iconv,
2549 [ ac_found_iconv=yes
2550 LIBS="$LIBS -liconv"
2551 ])
2552 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
2553 ])
2554 else
2555 ac_found_iconv=no
2556 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
2557 fi
2558
2559 AC_MSG_CHECKING(whether fgetws can be used with popen)
2560 AC_RUN_IFELSE(
2561 [AC_LANG_PROGRAM([
2562 #include <stdio.h>
2563 #ifdef HAVE_UNISTD_H
2564 #include <unistd.h>
2565 #endif
2566 #if HAVE_WCHAR_H
2567 #include <wchar.h>
2568 #endif
2569 ], [[
2570 int rc = 1;
2571 wchar_t line[4096];
2572 FILE *f = popen("echo test", "r");
2573 if(f!=NULL)
2574 {
2575 fgetws(line, 4096, f);
2576 pclose(f);
2577 rc = 0;
2578 }
2579 return rc;
2580 ]])
2581 ],
2582 [ AC_MSG_RESULT(yes)
2583 AC_DEFINE(SAFE_FGETWS_WITH_POPEN, 1, Define to 1 if fgetws can be used with popen)
2584 ],
2585 [ AC_MSG_RESULT(no) ],
2586 [ AC_MSG_RESULT(no) ]
2587 )
2588
2589 AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
2590 AC_RUN_IFELSE(
2591 [AC_LANG_PROGRAM([
2592 #if HAVE_ICONV_H
2593 #include <iconv.h>
2594 #endif
2595 ], [
2596 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
2597 ])
2598 ],
2599 [ AC_MSG_RESULT(yes)
2600 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
2601 valid_ucs2_code="UCS-2-INTERNAL"
2602 ],
2603 [ AC_MSG_RESULT(no) ],
2604 [ AC_MSG_RESULT(no) ]
2605 )
2606
2607 AC_MSG_CHECKING(whether iconv supports UCS-2)
2608 AC_RUN_IFELSE(
2609 [AC_LANG_PROGRAM([
2610 #if HAVE_ICONV_H
2611 #include <iconv.h>
2612 #endif
2613 ], [
2614 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
2615 ])
2616 ],
2617 [ AC_MSG_RESULT(yes)
2618 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
2619 valid_ucs2_code="UCS-2"
2620 ],
2621 [ AC_MSG_RESULT(no) ],
2622 [ AC_MSG_RESULT(no) ]
2623 )
2624
2625 AC_MSG_CHECKING(whether iconv supports UCS2)
2626 AC_RUN_IFELSE(
2627 [AC_LANG_PROGRAM([
2628 #if HAVE_ICONV_H
2629 #include <iconv.h>
2630 #endif
2631 ], [
2632 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
2633 ])
2634 ],
2635 [ AC_MSG_RESULT(yes)
2636 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
2637 valid_ucs2_code="UCS2"
2638 ],
2639 [ AC_MSG_RESULT(no) ],
2640 [ AC_MSG_RESULT(no) ]
2641 )
2642
2643 AC_MSG_CHECKING(whether iconv supports UCS-2BE)
2644 AC_RUN_IFELSE(
2645 [AC_LANG_PROGRAM([
2646 #if HAVE_ICONV_H
2647 #include <iconv.h>
2648 #endif
2649 ], [
2650 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
2651 ])
2652 ],
2653 [ AC_MSG_RESULT(yes)
2654 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
2655 valid_ucs2_code="UCS-2BE"
2656 ],
2657 [ AC_MSG_RESULT(no) ],
2658 [ AC_MSG_RESULT(no) ]
2659 )
2660
2661 AC_MSG_CHECKING(whether iconv supports UCS-2LE)
2662 AC_RUN_IFELSE(
2663 [AC_LANG_PROGRAM([
2664 #if HAVE_ICONV_H
2665 #include <iconv.h>
2666 #endif
2667 ], [
2668 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
2669 ])
2670 ],
2671 [ AC_MSG_RESULT(yes)
2672 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
2673 valid_ucs2_code="UCS-2LE"
2674 ],
2675 [ AC_MSG_RESULT(no) ],
2676 [ AC_MSG_RESULT(no) ]
2677 )
2678
2679 AC_MSG_CHECKING(whether iconv supports UTF-16)
2680 AC_RUN_IFELSE(
2681 [AC_LANG_PROGRAM([
2682 #if HAVE_ICONV_H
2683 #include <iconv.h>
2684 #endif
2685 ], [
2686 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
2687 ])
2688 ],
2689 [ AC_MSG_RESULT(yes)
2690 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
2691 valid_ucs2_code="UTF-16"
2692 ],
2693 [ AC_MSG_RESULT(no) ],
2694 [ AC_MSG_RESULT(no) ]
2695 )
2696
2697 AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
2698 AC_RUN_IFELSE(
2699 [AC_LANG_PROGRAM([
2700 #if HAVE_ICONV_H
2701 #include <iconv.h>
2702 #endif
2703 ], [
2704 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
2705 ])
2706 ],
2707 [ AC_MSG_RESULT(yes)
2708 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
2709 valid_ucs4_code="UCS-4-INTERNAL"
2710 ],
2711 [ AC_MSG_RESULT(no) ],
2712 [ AC_MSG_RESULT(no) ]
2713 )
2714
2715 AC_MSG_CHECKING(whether iconv supports UCS-4)
2716 AC_RUN_IFELSE(
2717 [AC_LANG_PROGRAM([
2718 #if HAVE_ICONV_H
2719 #include <iconv.h>
2720 #endif
2721 ], [
2722 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
2723 ])
2724 ],
2725 [ AC_MSG_RESULT(yes)
2726 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
2727 valid_ucs4_code="UCS-4"
2728 ],
2729 [ AC_MSG_RESULT(no) ],
2730 [ AC_MSG_RESULT(no) ]
2731 )
2732
2733 AC_MSG_CHECKING(whether iconv supports UCS4)
2734 AC_RUN_IFELSE(
2735 [AC_LANG_PROGRAM([
2736 #if HAVE_ICONV_H
2737 #include <iconv.h>
2738 #endif
2739 ], [
2740 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
2741 ])
2742 ],
2743 [ AC_MSG_RESULT(yes)
2744 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
2745 valid_ucs4_code="UCS4"
2746 ],
2747 [ AC_MSG_RESULT(no) ],
2748 [ AC_MSG_RESULT(no) ]
2749 )
2750
2751 AC_MSG_CHECKING(whether iconv supports UCS-4BE)
2752 AC_RUN_IFELSE(
2753 [AC_LANG_PROGRAM([
2754 #if HAVE_ICONV_H
2755 #include <iconv.h>
2756 #endif
2757 ], [
2758 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
2759 ])
2760 ],
2761 [ AC_MSG_RESULT(yes)
2762 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
2763 valid_ucs4_code="UCS-4BE"
2764 ],
2765 [ AC_MSG_RESULT(no) ],
2766 [ AC_MSG_RESULT(no) ]
2767 )
2768
2769 AC_MSG_CHECKING(whether iconv supports UCS-4LE)
2770 AC_RUN_IFELSE(
2771 [AC_LANG_PROGRAM([
2772 #if HAVE_ICONV_H
2773 #include <iconv.h>
2774 #endif
2775 ], [
2776 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
2777 ])
2778 ],
2779 [ AC_MSG_RESULT(yes)
2780 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
2781 valid_ucs4_code="UCS-4LE"
2782 ],
2783 [ AC_MSG_RESULT(no) ],
2784 [ AC_MSG_RESULT(no) ]
2785 )
2786
2787 AC_MSG_CHECKING(whether iconv supports UTF-32)
2788 AC_RUN_IFELSE(
2789 [AC_LANG_PROGRAM([
2790 #if HAVE_ICONV_H
2791 #include <iconv.h>
2792 #endif
2793 ], [
2794 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
2795 ])
2796 ],
2797 [ AC_MSG_RESULT(yes)
2798 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
2799 valid_ucs4_code="UTF-32"
2800 ],
2801 [ AC_MSG_RESULT(no) ],
2802 [ AC_MSG_RESULT(no) ]
2803 )
2804
2805 AC_MSG_CHECKING(whether iconv supports //IGNORE)
2806 AC_RUN_IFELSE(
2807 [AC_LANG_PROGRAM([
2808 #if HAVE_ICONV_H
2809 #include <iconv.h>
2810 #endif
2811 ], [
2812 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
2813 ])
2814 ],
2815 [ AC_MSG_RESULT(yes)
2816 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
2817 ],
2818 [ AC_MSG_RESULT(no) ],
2819 [ AC_MSG_RESULT(no) ]
2820 )
2821
2822 AC_MSG_CHECKING(whether iconv supports state reset)
2823 AC_RUN_IFELSE(
2824 [AC_LANG_PROGRAM([
2825 #include <stdio.h>
2826 #if HAVE_ICONV_H
2827 #include <iconv.h>
2828 #endif
2829 ], [
2830 iconv_t cd = iconv_open("UTF-8","$valid_ucs2_code");
2831 if (cd == (iconv_t)(-1)) return 1;
2832 return iconv(cd, NULL, NULL, NULL, NULL) != 0;
2833 ])
2834 ],
2835 [ AC_MSG_RESULT(yes)
2836 AC_DEFINE(HAVE_ICONV_STATE_RESET, 1, Define to 1 if iconv supports state reset)
2837 ],
2838 [ AC_MSG_RESULT(no) ],
2839 [ AC_MSG_RESULT(no) ]
2840 )
2841
2842 AC_MSG_CHECKING(whether iconv descriptor cache is needed)
2843 case $enable_iconv_cache in
2844 auto)
2845 case $PLATFORM in
2846 SunOS|HP-UX|AIX)
2847 enable_iconv_cache=yes
2848 ;;
2849 *)
2850 enable_iconv_cache=no
2851 ;;
2852 esac
2853 ;;
2854 yes|no)
2855 ;;
2856 *)
2857 AC_MSG_ERROR([Value given to --enable-iconv-cache must be one of yes, no or auto])
2858 ;;
2859 esac
2860 if test "x$enable_iconv_cache" = "xyes"; then
2861 AC_DEFINE(WITH_ICONV_CACHE, 1, Define to 1 to enable iconv descriptor cache)
2862 fi
2863 AC_MSG_RESULT($enable_iconv_cache)
2864
2865 # taken from ZSH's configure
2866 # Check if iconv uses const in prototype declaration
2867 if test "x$ac_found_iconv" = "xyes"; then
2868 AC_LANG_PUSH([C++])
2869 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
2870 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2871 #include <stdlib.h>
2872 #if HAVE_ICONV_H
2873 #include <iconv.h>
2874 #endif
2875 ]],
2876 [[
2877 char **p = NULL;
2878 iconv(0, (const char **)p, 0, 0, 0);
2879 ]])],
2880 [ac_cv_iconv_const=const],
2881 [ac_cv_iconv_const=])])
2882 AC_LANG_POP([C++])
2883 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2884 [Define as const if the declaration of iconv() needs const.])
2885 fi
2886
2887 if test "x$ac_cv_type_wchar_t" = "xyes"; then
2888 if test $ac_cv_sizeof_wchar_t -eq 2; then
2889 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2890 fi
2891
2892 if test $ac_cv_sizeof_wchar_t -eq 4; then
2893 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2894 fi
2895
2896 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2897 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2898 fi
2899 else
2900 if test "x$BUILD_UNICODE" = "xyes"; then
2901 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2902 fi
2903 fi
2904
2905
2906 #--------------------------------------------------------------------
2907 # MySQL
2908 #--------------------------------------------------------------------
2909
2910 check_substr "$COMPONENTS" "mysql"
2911 if test $? = 0; then
2912 OLD_CPPFLAGS="$CPPFLAGS"
2913 OLD_LDFLAGS="$LDFLAGS"
2914 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2915
2916 CPPFLAGS="$CPPFLAGS $MYSQL_CPPFLAGS"
2917 LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
2918 if test "x$MYSQL_LD_RUN_PATH" != "x"; then
2919 LD_RUN_PATH="${MYSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2920 fi
2921
2922 AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MySQL client installation]))
2923
2924 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
2925 [
2926 AC_MSG_ERROR(libmysqlclient is requred for MySQL support)
2927 ])
2928
2929 OLD_LIBS="$LIBS"
2930 LIBS="$LIBS $MYSQL_LIBS"
2931
2932 AC_CHECK_FUNCS(mysql_real_escape_string)
2933
2934 CPPFLAGS="$OLD_CPPFLAGS"
2935 LDFLAGS="$OLD_LDFLAGS"
2936 LD_RUN_PATH="$OLD_LD_RUN_PATH"
2937 LIBS="$OLD_LIBS"
2938 fi
2939
2940
2941 #--------------------------------------------------------------------
2942 # MariaDB
2943 #--------------------------------------------------------------------
2944
2945 check_substr "$COMPONENTS" "mariadb"
2946 if test $? = 0; then
2947 OLD_CPPFLAGS="$CPPFLAGS"
2948 OLD_LDFLAGS="$LDFLAGS"
2949 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2950
2951 CPPFLAGS="$CPPFLAGS $MARIADB_CPPFLAGS"
2952 LDFLAGS="$LDFLAGS $MARIADB_LDFLAGS"
2953 if test "x$MARIADB_LD_RUN_PATH" != "x"; then
2954 LD_RUN_PATH="${MARIADB_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2955 fi
2956
2957 AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MariaDB client installation]))
2958
2959 AC_CHECK_LIB(mariadb, mysql_init, [MARIADB_LIBS="-lmariadb"],
2960 [
2961 AC_MSG_ERROR(libmariadb is requred for MariaDB support)
2962 ])
2963
2964 CPPFLAGS="$OLD_CPPFLAGS"
2965 LDFLAGS="$OLD_LDFLAGS"
2966 LD_RUN_PATH="$OLD_LD_RUN_PATH"
2967 fi
2968
2969
2970 #--------------------------------------------------------------------
2971 # PostgreSQL
2972 #--------------------------------------------------------------------
2973
2974 check_substr "$COMPONENTS" "pgsql"
2975 if test $? = 0; then
2976 OLD_CPPFLAGS="$CPPFLAGS"
2977 OLD_LDFLAGS="$LDFLAGS"
2978 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2979
2980 CPPFLAGS="$CPPFLAGS $PGSQL_CPPFLAGS"
2981 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
2982 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2983 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2984 fi
2985
2986 AC_CHECK_HEADER(libpq-fe.h,,AC_MSG_ERROR([Cannot find libpq-fe.h - check your PostgreSQL client installation]))
2987
2988 AC_CHECK_DECLS([PGRES_SINGLE_TUPLE],,,[
2989 #include <libpq-fe.h>
2990 ])
2991
2992 AC_CHECK_LIB(m, floor)
2993 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2994 if test "x$PLATFORM" = "xSunOS"; then
2995 if test -d "$PGSQL_LD_RUN_PATH/sparcv9"; then
2996 PGSQL_LDFLAGS="$PGSQL_LDFLAGS/sparcv9"
2997 else
2998 PGSQL_LDFLAGS="$PGSQL_LDFLAGS/64"
2999 fi
3000 LDFLAGS="$OLD_LDFLAGS $PGSQL_LDFLAGS"
3001 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
3002 PGSQL_LD_RUN_PATH="$PGSQL_LD_RUN_PATH/sparcv9"
3003 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${OLD_LD_RUN_PATH:+:}${OLD_LD_RUN_PATH}"
3004 fi
3005 unset ac_cv_lib_pq_PQconnectdb
3006 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
3007 AC_MSG_ERROR(libpq is required for PostgreSQL support)])
3008 else
3009 AC_MSG_ERROR(libpq is required for PostgreSQL support)
3010 fi
3011 ])
3012
3013 CPPFLAGS="$OLD_CPPFLAGS"
3014 LDFLAGS="$OLD_LDFLAGS"
3015 LD_RUN_PATH="$OLD_LD_RUN_PATH"
3016 fi
3017
3018
3019 #--------------------------------------------------------------------
3020 # ODBC
3021 #--------------------------------------------------------------------
3022
3023 check_substr "$COMPONENTS" "odbc"
3024 if test $? = 0; then
3025 OLD_CPPFLAGS="$CPPFLAGS"
3026 OLD_LDFLAGS="$LDFLAGS"
3027 OLD_LD_RUN_PATH="$LD_RUN_PATH"
3028
3029 CPPFLAGS="$CPPFLAGS $ODBC_CPPFLAGS"
3030 LDFLAGS="$LDFLAGS $ODBC_LDFLAGS"
3031 if test "x$ODBC_LD_RUN_PATH" != "x"; then
3032 LD_RUN_PATH="${ODBC_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
3033 fi
3034
3035 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
3036 [AC_MSG_ERROR(libodbc is required for ODBC support)])
3037 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
3038 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
3039 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
3040 fi
3041
3042 CPPFLAGS="$OLD_CPPFLAGS"
3043 LDFLAGS="$OLD_LDFLAGS"
3044 LD_RUN_PATH="$OLD_LD_RUN_PATH"
3045 fi
3046
3047
3048 #--------------------------------------------------------------------
3049 # Oracle
3050 #--------------------------------------------------------------------
3051
3052 check_substr "$COMPONENTS" "oracle"
3053 if test $? = 0; then
3054 OLD_CPPFLAGS="$CPPFLAGS"
3055 OLD_LDFLAGS="$LDFLAGS"
3056 OLD_LD_RUN_PATH="$LD_RUN_PATH"
3057
3058 CPPFLAGS="$CPPFLAGS $ORACLE_CPPFLAGS"
3059 LDFLAGS="$LDFLAGS $ORACLE_LDFLAGS"
3060 if test "x$ORACLE_LD_RUN_PATH" != "x"; then
3061 LD_RUN_PATH="${ORACLE_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
3062 fi
3063
3064 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
3065 AC_CHECK_LIB(nnz12, nzstrcpy, [NNZ_LIB=-lnnz12],
3066 [
3067 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
3068 [
3069 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
3070 ], [-lclntsh])
3071 ], [-lclntsh])
3072 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
3073 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
3074 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
3075 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
3076 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
3077 fi
3078
3079 CPPFLAGS="$OLD_CPPFLAGS"
3080 LDFLAGS="$OLD_LDFLAGS"
3081 LD_RUN_PATH="$OLD_LD_RUN_PATH"
3082 fi
3083
3084 #--------------------------------------------------------------------
3085 # DB2
3086 #--------------------------------------------------------------------
3087
3088 check_substr "$COMPONENTS" "db2"
3089 if test $? = 0; then
3090 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
3091 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
3092 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
3093 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
3094 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
3095 fi
3096 fi
3097
3098 #--------------------------------------------------------------------
3099 # Informix
3100 #--------------------------------------------------------------------
3101
3102 check_substr "$COMPONENTS" "informix"
3103 if test $? = 0; then
3104 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
3105 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
3106 [AC_MSG_ERROR(libthcli is required for Informix support)])
3107 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
3108 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
3109 fi
3110 fi
3111
3112
3113 #--------------------------------------------------------------------
3114 # Java
3115 #--------------------------------------------------------------------
3116
3117 check_substr "$COMPONENTS" "java"
3118 if test $? = 0; then
3119 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
3120 fi
3121
3122
3123 #--------------------------------------------------------------------
3124 # Tuxedo
3125 #--------------------------------------------------------------------
3126
3127 check_substr "$COMPONENTS" "tuxedo"
3128 if test $? = 0; then
3129 OLD_CPPFLAGS="$CPPFLAGS"
3130 OLD_LDFLAGS="$LDFLAGS"
3131 OLD_LIBS="$LIBS"
3132
3133 if test "x$TUXEDO_BASE" != "x"; then
3134 TUXEDO_CPPFLAGS="-I$TUXEDO_BASE/include"
3135 TUXEDO_LDFLAGS="-L$TUXEDO_BASE/lib"
3136 CPPFLAGS="$CPPFLAGS $TUXEDO_CPPFLAGS"
3137 LDFLAGS="$LDFLAGS $TUXEDO_LDFLAGS"
3138 fi
3139
3140 AC_CHECK_HEADER(atmi.h,,AC_MSG_ERROR([*** Cannot find atmi.h - check your Tuxedo installation ***]))
3141
3142 # https://community.oracle.com/thread/2346582
3143 if test "x$PLATFORM" = "xLinux"; then
3144 TUXEDO_LDFLAGS="$TUXEDO_LDFLAGS -Xlinker --no-as-needed"
3145 LDFLAGS="$LDFLAGS -Xlinker --no-as-needed"
3146 fi
3147
3148 if test "$PLATFORM" = "SunOS"; then
3149 AC_CHECK_LIB(rt, nanosleep, [ TUXEDO_LIBS="$TUXEDO_LIBS -lrt" ])
3150 fi
3151
3152 if test "$PLATFORM" = "AIX"; then
3153 AC_MSG_CHECKING(for xa_switchp in libengine)
3154 OLD_LIBS_LIBENGINE="$LIBS"
3155 LIBS="$LIBS -lengine"
3156 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ extern char *xa_switchp; ]], [[ *xa_switchp = 0; ]])],
3157 [
3158 AC_MSG_RESULT(yes)
3159 TUXEDO_LIBS="$TUXEDO_LIBS -lengine"
3160 ],
3161 [ AC_MSG_RESULT(no) ])
3162 LIBS="$OLD_LIBS_LIBENGINE"
3163 fi
3164
3165 LIBS="$LIBS $TUXEDO_LIBS"
3166 AC_CHECK_LIB(tux, tpcall, [], [AC_MSG_ERROR(libtux is required for Tuxedo support)])
3167
3168 CPPFLAGS="$OLD_CPPFLAGS"
3169 LDFLAGS="$OLD_LDFLAGS"
3170 LIBS="$OLD_LIBS"
3171
3172 if test "x$PLATFORM" = "xAIX"; then
3173 if test -e $TUXEDO_BASE/lib/tpinit.o; then
3174 TUXEDO_TPINIT="$TUXEDO_BASE/lib/tpinit.o"
3175 fi
3176 fi
3177 fi
3178
3179
3180 #--------------------------------------------------------------------
3181 # ZeroMQ
3182 #--------------------------------------------------------------------
3183
3184 check_substr "$COMPONENTS" "zeromq"
3185 if test $? = 0; then
3186 OLD_CPPFLAGS="$CPPFLAGS"
3187 OLD_LDFLAGS="$LDFLAGS"
3188 OLD_LIBS="$LIBS"
3189
3190 if test "x$ZEROMQ_BASE" != "x"; then
3191 ZEROMQ_CPPFLAGS="-I$ZEROMQ_BASE/include"
3192 ZEROMQ_LDFLAGS="-L$ZEROMQ_BASE/lib"
3193 CPPFLAGS="$CPPFLAGS $ZEROMQ_CPPFLAGS"
3194 LDFLAGS="$LDFLAGS $ZEROMQ_LDFLAGS"
3195 fi
3196
3197 AC_CHECK_HEADER(zmq.h,,[
3198 if test "x$ZEROMQ_REQUIRED" = "xyes"; then
3199 AC_MSG_ERROR([*** Cannot find zmq.h - check your ZeroMQ installation ***])
3200 else
3201 ZEROMQ_SUPPORT="no"
3202 fi
3203 ])
3204 AC_CHECK_LIB(zmq, zmq_ctx_new, [ SERVER_LIBS="$SERVER_LIBS -lzmq" ], [
3205 if test "x$ZEROMQ_REQUIRED" = "xyes"; then
3206 AC_MSG_ERROR([*** libzmq is missing or too old - check your ZeroMQ installation ***])
3207 else
3208 ZEROMQ_SUPPORT="no"
3209 fi
3210 ])
3211
3212 if test "x$ZEROMQ_SUPPORT" = "xyes"; then
3213 AC_DEFINE(WITH_ZMQ, 1, Define to 1 if ZeroMQ is supported)
3214 fi
3215
3216 CPPFLAGS="$OLD_CPPFLAGS"
3217 LDFLAGS="$OLD_LDFLAGS"
3218 LIBS="$OLD_LIBS"
3219 fi
3220
3221
3222 #--------------------------------------------------------------------
3223 # MQTT
3224 #--------------------------------------------------------------------
3225
3226 if test "x$DISABLE_MQTT" != "xyes"; then
3227 OLD_CPPFLAGS="$CPPFLAGS"
3228 OLD_LDFLAGS="$LDFLAGS"
3229 OLD_LIBS="$LIBS"
3230
3231 if test "x$MOSQUITTO_BASE" != "x"; then
3232 MQTT_CPPFLAGS="-I$MOSQUITTO_BASE/include"
3233 MQTT_LDFLAGS="-L$MOSQUITTO_BASE/lib"
3234 CPPFLAGS="$CPPFLAGS $MQTT_CPPFLAGS"
3235 LDFLAGS="$LDFLAGS $MQTT_LDFLAGS"
3236 fi
3237
3238 AC_CHECK_HEADER(mosquitto.h,,[
3239 AC_MSG_ERROR([*** Cannot find mosquitto.h - check your libmosquitto installation or disable MQTT support with --disable-mqtt ***])
3240 ])
3241 AC_CHECK_LIB(mosquitto, mosquitto_lib_init, [ MQTT_LIBS="-lmosquitto" ], [
3242 AC_MSG_ERROR([*** libmosquitto is missing - check your libmosquitto installation or disable MQTT support with --disable-mqtt***])
3243 ])
3244
3245 MQTT_SUPPORT="yes"
3246 AC_DEFINE(WITH_MQTT, 1, Define to 1 if MQTT is supported)
3247 SUBAGENT_DIRS="$SUBAGENT_DIRS mqtt"
3248
3249 CPPFLAGS="$OLD_CPPFLAGS"
3250 LDFLAGS="$OLD_LDFLAGS"
3251 LIBS="$OLD_LIBS"
3252 fi
3253
3254
3255 #--------------------------------------------------------------------
3256 # MongoDB
3257 #--------------------------------------------------------------------
3258
3259 check_substr "$COMPONENTS" "mongodb"
3260 if test $? = 0; then
3261 OLD_CPPFLAGS="$CPPFLAGS"
3262 OLD_LDFLAGS="$LDFLAGS"
3263 OLD_LIBS="$LIBS"
3264
3265 if test "x$MONGODB_BASE" != "x"; then
3266 MONGODB_CPPFLAGS="-I$MONGODB_BASE/include/libmongoc-1.0/ -I$MONGODB_BASE/include/libbson-1.0/"
3267 MONGODB_LDFLAGS="-L$MONGODB_BASE/lib"
3268 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
3269 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
3270 else
3271 MONGODB_CPPFLAGS="-I/usr/local/include/libmongoc-1.0/ -I/usr/local/include/libbson-1.0/"
3272 MONGODB_LDFLAGS="-L/usr/local/lib"
3273 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
3274 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
3275 fi
3276
3277 AC_CHECK_HEADER(mongoc.h,,AC_MSG_ERROR([*** Cannot find mongoc.h - check your MongoDB installation ***]))
3278 AC_CHECK_LIB(mongoc-1.0, mongoc_client_get_database, [ MONGODB_LIBS="$MONGODB_LIBS -lmongoc-1.0" ])
3279 AC_CHECK_LIB(bson-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lbson-1.0" ])
3280
3281 LIBS="$LIBS $MONGODB_LIBS"
3282
3283 CPPFLAGS="$OLD_CPPFLAGS"
3284 LDFLAGS="$OLD_LDFLAGS"
3285 LIBS="$OLD_LIBS"
3286 fi
3287
3288
3289 #--------------------------------------------------------------------
3290 # VMGR
3291 #--------------------------------------------------------------------
3292
3293 check_substr "$COMPONENTS" "vmgr"
3294 if test $? = 0; then
3295 OLD_CPPFLAGS="$CPPFLAGS"
3296 OLD_LDFLAGS="$LDFLAGS"
3297 OLD_LIBS="$LIBS"
3298
3299 if test "x$LIBVIRT_BASE" != "x"; then
3300 VMGR_CPPFLAGS="-I$LIBVIRT_BASE/include"
3301 VMGR_LDFLAGS="-L$LIBVIRT_BASE/lib"
3302 CPPFLAGS="$CPPFLAGS $VMGR_CPPFLAGS"
3303 LDFLAGS="$LDFLAGS $VMGR_LDFLAGS"
3304 else
3305 VMGR_CPPFLAGS=""
3306 VMGR_LDFLAGS=""
3307 CPPFLAGS="$CPPFLAGS $VMGR_CPPFLAGS"
3308 LDFLAGS="$LDFLAGS $VMGR_LDFLAGS"
3309 fi
3310
3311 AC_CHECK_HEADER(libvirt/libvirt.h,,AC_MSG_ERROR([*** Cannot find libvirt.h - check your libvirt installation ***]))
3312 AC_CHECK_LIB(virt, virConnectGetLibVersion, [ VMGR_LIBS="$VMGR_LIBS -lvirt" ])
3313 LIBS="$LIBS $VMGR_LIBS"
3314
3315 AC_CHECK_FUNCS([virDomainGetTime])
3316
3317 CPPFLAGS="$OLD_CPPFLAGS"
3318 LDFLAGS="$OLD_LDFLAGS"
3319 LIBS="$OLD_LIBS"
3320 fi
3321
3322
3323 #--------------------------------------------------------------------
3324 # XEN
3325 #--------------------------------------------------------------------
3326
3327 check_substr "$COMPONENTS" "xen"
3328 if test $? = 0; then
3329 OLD_CPPFLAGS="$CPPFLAGS"
3330 OLD_LDFLAGS="$LDFLAGS"
3331 OLD_LIBS="$LIBS"
3332
3333 AC_CHECK_HEADER(libxl.h,,AC_MSG_ERROR([*** Cannot find libxl.h - check your libxen installation ***]))
3334 AC_CHECK_LIB(xenlight, libxl_ctx_alloc, [ XEN_LIBS="$XEN_LIBS -lxenlight" ])
3335 AC_CHECK_LIB(xenctrl, xc_vcpu_getinfo, [ XEN_LIBS="$XEN_LIBS -lxenctrl" ])
3336
3337 CPPFLAGS="$OLD_CPPFLAGS"
3338 LDFLAGS="$OLD_LDFLAGS"
3339 LIBS="$OLD_LIBS"
3340 fi
3341
3342
3343 #--------------------------------------------------------------------
3344 # LoraWAN
3345 #--------------------------------------------------------------------
3346
3347 check_substr "$COMPONENTS" "agent"
3348 if test $? = 0; then
3349 if test "x$HAVE_LIBCURL" = "xyes" -a "x$MQTT_SUPPORT" = "xyes"; then
3350 SUBAGENT_DIRS="$SUBAGENT_DIRS lorawan"
3351 fi
3352 fi
3353
3354 #--------------------------------------------------------------------
3355 # Other settings
3356 #--------------------------------------------------------------------
3357
3358 if test "x$RUNTIME_PREFIX" = "x"; then
3359 if test "x${BUILD_UNICODE}" = "xyes"; then
3360 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\" -DSTATEDIR=L\\\"\${localstatedir}/lib/netxms\\\""
3361 else
3362 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\" -DSTATEDIR=\\\"\${localstatedir}/lib/netxms\\\""
3363 fi
3364 else
3365 if test "x${BUILD_UNICODE}" = "xyes"; then
3366 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\\\""
3367 else
3368 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\\\""
3369 fi
3370 LDFLAGS_SUFFIX="$LDFLAGS_SUFFIX -R $RUNTIME_PREFIX/lib"
3371 fi
3372
3373 LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $PTHREAD_LDFLAGS $LDFLAGS_SUFFIX"
3374
3375 if test "x${ENABLE_WERROR}" = "xyes"; then
3376 CPPFLAGS="$CPPFLAGS -Werror"
3377 fi
3378
3379 if test "x$PLATFORM" = "xDarwin"; then
3380 SHLIB_SUFFIX=".so"
3381 else
3382 if test "x$shrext_cmds" != "x"; then
3383 SHLIB_SUFFIX="$shrext_cmds"
3384 else
3385 SHLIB_SUFFIX=".so"
3386 fi
3387 fi
3388 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$SHLIB_SUFFIX"), [Define to platform's shared library suffix])
3389
3390 if test "x$ENABLE_DEBUG" = "xno"; then
3391 CPPFLAGS="$CPPFLAGS -DNDEBUG"
3392 fi
3393
3394 if test "x$WITH_JEMALLOC" = "xyes"; then
3395 LIBS="$LIBS -ljemalloc"
3396 fi
3397
3398 AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
3399 AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
3400 AM_CONDITIONAL([USE_INTERNAL_JANSSON], [test "x$HAVE_JANSSON" = "xno"])
3401 AM_CONDITIONAL([USE_INTERNAL_SQLITE], [test "x$HAVE_SQLITE" = "xno"])
3402 AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$HAVE_ZLIB" = "no"])
3403 AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
3404 AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
3405 AM_CONDITIONAL([USE_ENCRYPTION], [test "x${WITH_ENCRYPTION}" = "xyes"])
3406 AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
3407 AM_CONDITIONAL([MQTT_SUPPORT], [test "x$MQTT_SUPPORT" = "xyes"])
3408 AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
3409 AM_CONDITIONAL([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
3410
3411
3412 #--------------------------------------------------------------------
3413 # Get compiler version
3414 #--------------------------------------------------------------------
3415
3416 COMPILER_VERSION=""
3417 if test "$CXX" = "CC"; then
3418 v=`$CXX -V 2>&1 | head -1`
3419 if test $? = 0; then
3420 COMPILER_VERSION="$v"
3421 fi
3422 else
3423 for opt in -qversion --version -v -V; do
3424 v=`$CXX $opt 2>/dev/null | head -1`
3425 if test $? = 0; then
3426 if test "x$v" != "x" -a "x$COMPILER_VERSION" = "x"; then
3427 COMPILER_VERSION="$v"
3428 fi
3429 fi
3430 done
3431 fi
3432 AC_DEFINE_UNQUOTED([CPP_COMPILER_VERSION], "$COMPILER_VERSION", [C++ compiler version information])
3433
3434
3435 #--------------------------------------------------------------------
3436 # Cleanup variables
3437 #--------------------------------------------------------------------
3438
3439 AS_IF([test "x$with_dist" = "xyes"],
3440 [
3441 AGENT_DIRS=`echo $AGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3442 SUBAGENT_DIRS=`echo $SUBAGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3443 MODULES=`echo $MODULES|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3444 SMSDRV_DIRS=`echo $SMSDRV_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3445 HDLINK_DIRS=`echo $HDLINK_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3446 ])
3447
3448
3449 #--------------------------------------------------------------------
3450 # Substitute variables
3451 #--------------------------------------------------------------------
3452
3453 AC_SUBST(DB_DRIVERS)
3454 AC_SUBST(MODULES)
3455 AC_SUBST(AGENT_DIRS)
3456 AC_SUBST(SUBAGENT_DIRS)
3457 AC_SUBST(SERVER_INCLUDE)
3458 AC_SUBST(SERVER_LIBS)
3459 AC_SUBST(SERVER_TOOLS)
3460 AC_SUBST(SMSDRV_DIRS)
3461 AC_SUBST(HDLINK_DIRS)
3462 AC_SUBST(PDSDRV_DIRS)
3463 AC_SUBST(TOP_LEVEL_MODULES)
3464 AC_SUBST(CONTRIB_MODULES)
3465 AC_SUBST(CLIENT_COMPONENTS)
3466 AC_SUBST(STATIC_SUBAGENT_LIST)
3467 AC_SUBST(SUBAGENT_LIBS)
3468 AC_SUBST(BUILD_SERVER)
3469 AC_SUBST(BUILD_SDK)
3470 AC_SUBST(MYSQL_CPPFLAGS)
3471 AC_SUBST(MYSQL_LDFLAGS)
3472 AC_SUBST(MYSQL_LIBS)
3473 AC_SUBST(MARIADB_CPPFLAGS)
3474 AC_SUBST(MARIADB_LDFLAGS)
3475 AC_SUBST(MARIADB_LIBS)
3476 AC_SUBST(PGSQL_CPPFLAGS)
3477 AC_SUBST(PGSQL_LDFLAGS)
3478 AC_SUBST(PGSQL_LIBS)
3479 AC_SUBST(ORACLE_CPPFLAGS)
3480 AC_SUBST(ORACLE_LDFLAGS)
3481 AC_SUBST(ORACLE_LIBS)
3482 AC_SUBST(ODBC_CPPFLAGS)
3483 AC_SUBST(ODBC_LDFLAGS)
3484 AC_SUBST(ODBC_LIBS)
3485 AC_SUBST(DB2_CPPFLAGS)
3486 AC_SUBST(DB2_LDFLAGS)
3487 AC_SUBST(DB2_LIBS)
3488 AC_SUBST(INFORMIX_CPPFLAGS)
3489 AC_SUBST(INFORMIX_LDFLAGS)
3490 AC_SUBST(INFORMIX_LIBS)
3491 AC_SUBST(INSTALL_LIBPATH)
3492 AC_SUBST(OBJECT_MODE)
3493 AC_SUBST(SQLFLAGS)
3494 AC_SUBST(SHLIB_SUFFIX)
3495 AC_SUBST(TUXEDO_CPPFLAGS)
3496 AC_SUBST(TUXEDO_LDFLAGS)
3497 AC_SUBST(TUXEDO_LIBS)
3498 AC_SUBST(TUXEDO_TPINIT)
3499 AC_SUBST(MONGODB_CPPFLAGS)
3500 AC_SUBST(MONGODB_LDFLAGS)
3501 AC_SUBST(MONGODB_LIBS)
3502 AC_SUBST(MQTT_CPPFLAGS)
3503 AC_SUBST(MQTT_LDFLAGS)
3504 AC_SUBST(MQTT_LIBS)
3505 AC_SUBST(VMGR_CPPFLAGS)
3506 AC_SUBST(VMGR_LDFLAGS)
3507 AC_SUBST(VMGR_LIBS)
3508 AC_SUBST(XEN_CPPFLAGS)
3509 AC_SUBST(XEN_LDFLAGS)
3510 AC_SUBST(XEN_LIBS)
3511 AC_SUBST(ZEROMQ_CPPFLAGS)
3512 AC_SUBST(ZEROMQ_LDFLAGS)
3513
3514 #--------------------------------------------------------------------
3515 # Shared libs versions
3516 #
3517 # versioning scheme: current:revision:age
3518 #
3519 # current
3520 # The number of the current interface exported by the library. A current
3521 # value of `0', means that you are calling the interface exported by this
3522 # library interface 0.
3523 #
3524 # revision
3525 # The implementation number of the most recent interface exported by this
3526 # library. In this case, a revision value of `0' means that this is the
3527 # first implementation of the interface.
3528 # If the next release of this library exports the same interface, but has a
3529 # different implementation (perhaps some bugs have been fixed), the revision
3530 # number will be higher, but current number will be the same. In that case,
3531 # when given a choice, the library with the highest revision will always
3532 # be used by the runtime loader.
3533 #
3534 # age
3535 # The number of previous additional interfaces supported by this library.
3536 # If age were `2', then this library can be linked into executables which
3537 # were built with a release of this library that exported the current
3538 # interface number, current, or any of the previous two interfaces.
3539 # By definition age must be less than or equal to current. At the outset,
3540 # only the first ever interface is implemented, so age can only be `0'.
3541 #--------------------------------------------------------------------
3542
3543 NETXMS_LIBRARY_VERSION=2:0:0
3544 AC_SUBST(NETXMS_LIBRARY_VERSION)
3545
3546 #--------------------------------------------------------------------
3547 # Generate output files
3548 #--------------------------------------------------------------------
3549
3550 AC_CONFIG_FILES([
3551 Makefile
3552 contrib/Makefile
3553 contrib/backgrounds/Makefile
3554 contrib/integration/Makefile
3555 contrib/integration/HP_EVA/Makefile
3556 contrib/integration/HP_P2000/Makefile
3557 contrib/mibs/Makefile
3558 contrib/music/Makefile
3559 contrib/startup/Makefile
3560 contrib/startup/systemd/Makefile
3561 contrib/startup/debian/Makefile
3562 contrib/startup/gentoo/Makefile
3563 contrib/startup/hp-ux/Makefile
3564 contrib/startup/redhat/Makefile
3565 contrib/startup/suse/Makefile
3566 contrib/startup/ubuntu/Makefile
3567 contrib/startup/solaris/Makefile
3568 contrib/templates/Makefile
3569 doc/Makefile
3570 doc/internal/Makefile
3571 doc/manuals/Makefile
3572 doc/misc/Makefile
3573 images/Makefile
3574 include/Makefile
3575 include/msvc/Makefile
3576 m4/Makefile
3577 src/Makefile
3578 src/agent/Makefile
3579 src/agent/core/Makefile
3580 src/agent/install/Makefile
3581 src/agent/libnxagent/Makefile
3582 src/agent/libnxappc/Makefile
3583 src/agent/libnxsd/Makefile
3584 src/agent/libnxtux/Makefile
3585 src/agent/subagents/Makefile
3586 src/agent/subagents/aix/Makefile
3587 src/agent/subagents/bind9/Makefile
3588 src/agent/subagents/darwin/Makefile
3589 src/agent/subagents/db2/Makefile
3590 src/agent/subagents/dbquery/Makefile
3591 src/agent/subagents/devemu/Makefile
3592 src/agent/subagents/ds18x20/Makefile
3593 src/agent/subagents/ecs/Makefile
3594 src/agent/subagents/filemgr/Makefile
3595 src/agent/subagents/freebsd/Makefile
3596 src/agent/subagents/gps/Makefile
3597 src/agent/subagents/hpux/Makefile
3598 src/agent/subagents/informix/Makefile
3599 src/agent/subagents/ipso/Makefile
3600 src/agent/subagents/java/Makefile
3601 src/agent/subagents/java/java/Makefile
3602 src/agent/subagents/jmx/Makefile
3603 src/agent/subagents/linux/Makefile
3604 src/agent/subagents/lmsensors/Makefile
3605 src/agent/subagents/logwatch/Makefile
3606 src/agent/subagents/lorawan/Makefile
3607 src/agent/subagents/minix/Makefile
3608 src/agent/subagents/mqtt/Makefile
3609 src/agent/subagents/mysql/Makefile
3610 src/agent/subagents/netbsd/Makefile
3611 src/agent/subagents/netsvc/Makefile
3612 src/agent/subagents/odbcquery/Makefile
3613 src/agent/subagents/openbsd/Makefile
3614 src/agent/subagents/oracle/Makefile
3615 src/agent/subagents/ping/Makefile
3616 src/agent/subagents/portCheck/Makefile
3617 src/agent/subagents/rpi/Makefile
3618 src/agent/subagents/sms/Makefile
3619 src/agent/subagents/ssh/Makefile
3620 src/agent/subagents/sunos/Makefile
3621 src/agent/subagents/tuxedo/Makefile
3622 src/agent/subagents/mongodb/Makefile
3623 src/agent/subagents/ubntlw/Makefile
3624 src/agent/subagents/ups/Makefile
3625 src/agent/subagents/vmgr/Makefile
3626 src/agent/subagents/winnt/Makefile
3627 src/agent/subagents/winperf/Makefile
3628 src/agent/subagents/wmi/Makefile
3629 src/agent/subagents/xen/Makefile
3630 src/agent/tools/Makefile
3631 src/agent/tools/nxappget/Makefile
3632 src/agent/tools/nxapush/Makefile
3633 src/appagent/Makefile
3634 src/client/Makefile
3635 src/client/install/Makefile
3636 src/client/libnxclient/Makefile
3637 src/client/nxalarm/Makefile
3638 src/client/nxevent/Makefile
3639 src/client/nxpush/Makefile
3640 src/client/nxshell/Makefile
3641 src/client/nxshell/java/Makefile
3642 src/client/nxsms/Makefile
3643 src/db/Makefile
3644 src/db/dbdrv/Makefile
3645 src/db/dbdrv/db2/Makefile
3646 src/db/dbdrv/informix/Makefile
3647 src/db/dbdrv/odbc/Makefile
3648 src/db/dbdrv/mariadb/Makefile
3649 src/db/dbdrv/mssql/Makefile
3650 src/db/dbdrv/mysql/Makefile
3651 src/db/dbdrv/oracle/Makefile
3652 src/db/dbdrv/pgsql/Makefile
3653 src/db/dbdrv/sqlite/Makefile
3654 src/db/libnxdb/Makefile
3655 src/install/Makefile
3656 src/install/windows/Makefile
3657 src/jansson/Makefile
3658 src/libexpat/Makefile
3659 src/libexpat/libexpat/Makefile
3660 src/libnetxms/Makefile
3661 src/libnxcc/Makefile
3662 src/libnxjava/Makefile
3663 src/libnxjava/java/Makefile
3664 src/libnxlp/Makefile
3665 src/libnxmb/Makefile
3666 src/libnxsl/Makefile
3667 src/libstrophe/Makefile
3668 src/libtre/Makefile
3669 src/libtre/win32/Makefile
3670 src/nxcproxy/Makefile
3671 src/nxlptest/Makefile
3672 src/nxscript/Makefile
3673 src/server/Makefile
3674 src/server/core/Makefile
3675 src/server/drivers/Makefile
3676 src/server/drivers/airespace/Makefile
3677 src/server/drivers/at/Makefile
3678 src/server/drivers/baystack/Makefile
3679 src/server/drivers/cat2900xl/Makefile
3680 src/server/drivers/catalyst/Makefile
3681 src/server/drivers/cisco-esw/Makefile
3682 src/server/drivers/cisco-sb/Makefile
3683 src/server/drivers/dell-pwc/Makefile
3684 src/server/drivers/dlink/Makefile
3685 src/server/drivers/ers8000/Makefile
3686 src/server/drivers/extreme/Makefile
3687 src/server/drivers/h3c/Makefile
3688 src/server/drivers/hpsw/Makefile
3689 src/server/drivers/ignitenet/Makefile
3690 src/server/drivers/juniper/Makefile
3691 src/server/drivers/lib/Makefile
3692 src/server/drivers/lib/avaya-ers/Makefile
3693 src/server/drivers/lib/cisco/Makefile
3694 src/server/drivers/mikrotik/Makefile
3695 src/server/drivers/netonix/Makefile
3696 src/server/drivers/netscreen/Makefile
3697 src/server/drivers/ntws/Makefile
3698 src/server/drivers/ping3/Makefile
3699 src/server/drivers/procurve/Makefile
3700 src/server/drivers/qtech-olt/Makefile
3701 src/server/drivers/symbol-ws/Makefile
3702 src/server/drivers/tb/Makefile
3703 src/server/drivers/ubnt/Makefile
3704 src/server/hdlink/Makefile
3705 src/server/hdlink/jira/Makefile
3706 src/server/hdlink/redmine/Makefile
3707 src/server/include/Makefile
3708 src/server/libnxsrv/Makefile
3709 src/server/netxmsd/Makefile
3710 src/server/pdsdrv/Makefile
3711 src/server/pdsdrv/rrdtool/Makefile
3712 src/server/tools/Makefile
3713 src/server/tools/nxaction/Makefile
3714 src/server/tools/nxadm/Makefile
3715 src/server/tools/nxap/Makefile
3716 src/server/tools/nxconfig/Makefile
3717 src/server/tools/nxconfig/res/Makefile
3718 src/server/tools/nxdbmgr/Makefile
3719 src/server/tools/nxget/Makefile
3720 src/server/tools/nxminfo/Makefile
3721 src/server/tools/nxupload/Makefile
3722 src/smsdrv/Makefile
3723 src/smsdrv/anysms/Makefile
3724 src/smsdrv/dbemu/Makefile
3725 src/smsdrv/dummy/Makefile
3726 src/smsdrv/generic/Makefile
3727 src/smsdrv/kannel/Makefile
3728 src/smsdrv/mymobile/Makefile
3729 src/smsdrv/nexmo/Makefile
3730 src/smsdrv/nxagent/Makefile
3731 src/smsdrv/portech/Makefile
3732 src/smsdrv/slack/Makefile
3733 src/smsdrv/smseagle/Makefile
3734 src/smsdrv/text2reach/Makefile
3735 src/smsdrv/websms/Makefile
3736 src/snmp/Makefile
3737 src/snmp/libnxsnmp/Makefile
3738 src/snmp/nxmibc/Makefile
3739 src/snmp/nxsnmpget/Makefile
3740 src/snmp/nxsnmpset/Makefile
3741 src/snmp/nxsnmpwalk/Makefile
3742 src/sqlite/Makefile
3743 src/tools/Makefile
3744 src/tools/nxdevcfg/Makefile
3745 src/tools/nxencpasswd/Makefile
3746 src/tools/nxgenguid/Makefile
3747 src/zlib/Makefile
3748 sql/Makefile
3749 tests/Makefile
3750 tests/include/Makefile
3751 tests/test-libnetxms/Makefile
3752 tests/test-libnxcc/Makefile
3753 tests/test-libnxdb/Makefile
3754 tests/test-libnxsnmp/Makefile
3755 tools/Makefile
3756 ])
3757
3758 AC_OUTPUT
3759
3760 echo "Updating libtool"
3761 sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
3762
3763 # On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
3764 if test "x$ac_compiler_gnu" = "xyes" && test "x$PLATFORM" = "xHP-UX"; then
3765 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
3766 fi
3767
3768 # On AIX, correct OBJECT_MODE must be set before linking
3769 # To avoid manual setting by user, we add this to libtool script
3770 if test "x$PLATFORM" = "xAIX"; then
3771 head -n 1 ./libtool > ./libtool.new
3772 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
3773 tail -n +2 ./libtool >> ./libtool.new
3774 mv libtool.new libtool
3775 chmod +x ./libtool
3776 fi
3777
3778 #--------------------------------------------------------------------
3779 # Print summary
3780 #--------------------------------------------------------------------
3781
3782 echo
3783 echo
3784 echo
3785 echo '---------------------------------------------------------------------'
3786 echo ' Configure results'
3787 echo '---------------------------------------------------------------------'
3788 echo
3789 echo "Prefix : ${prefix}"
3790 echo "Platform : ${PLATFORM}"
3791 echo "Shared library suffix : ${SHLIB_SUFFIX}"
3792 if test "x$IPV6_SUPPORT" = "xyes"; then
3793 echo "IPv6 support : YES"
3794 else
3795 echo "IPv6 support : NO"
3796 fi
3797 if test "x${MQTT_SUPPORT}" = "xyes"; then
3798 echo "MQTT support : YES"
3799 else
3800 echo "MQTT support : NO"
3801 fi
3802 if test "x${BUILD_SERVER}" = "xyes"; then
3803 echo "Build Server : YES"
3804 echo "Server libs : ${SERVER_LIBS}"
3805 if test "x${LDAP_SUPPORT}" = "xyes"; then
3806 echo "LDAP support : YES"
3807 else
3808 echo "LDAP support : NO"
3809 fi
3810 if test "x${XMPP_SUPPORT}" = "xyes"; then
3811 echo "XMPP support : YES"
3812 else
3813 echo "XMPP support : NO"
3814 fi
3815 if test "x${ZEROMQ_SUPPORT}" = "xyes"; then
3816 echo "ZeroMQ support : YES"
3817 else
3818 echo "ZeroMQ support : NO"
3819 fi
3820 else
3821 echo "Build Server : NO"
3822 fi
3823 if test "x${WITH_ENCRYPTION}" = "xyes"; then
3824 echo "Encryption enabled : YES"
3825 else
3826 echo "Encryption enabled : NO"
3827 fi
3828 if test "x${HAVE_LIBSSH}" = "xyes"; then
3829 echo "SSH support enabled : YES"
3830 else
3831 echo "SSH support enabled : NO"
3832 fi
3833 if test "x${DB_DRIVERS}" != "x"; then
3834 echo "Build DB-Drivers :${DB_DRIVERS}"
3835 else
3836 echo "Build DB-Drivers : NO"
3837 fi
3838 if test "x${BUILD_CLIENT}" = "xyes"; then
3839 echo "Build Clients : YES"
3840 else
3841 echo "Build Clients : NO"
3842 fi
3843 if test "x${BUILD_AGENT}" = "xyes"; then
3844 echo "Build Agent : YES"
3845 echo "Agent extra components : ${AGENT_DIRS}"
3846 echo "Subagents list : ${SUBAGENT_DIRS}"
3847 else
3848 echo "Build Agent : NO"
3849 fi
3850 if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
3851 echo "Build Static Agent : YES"
3852 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
3853 else
3854 echo "Build Static Agent : NO"
3855 fi
3856 if test "x${BUILD_UNICODE}" = "xyes"; then
3857 echo "UNICODE build : YES"
3858 else
3859 echo "UNICODE build : NO"
3860 fi
3861 if test "x${HAVE_LIBEXPAT}" = "xno"; then
3862 echo "Use internal libexpat : YES"
3863 else
3864 echo "Use internal libexpat : NO"
3865 fi
3866 if test "x${HAVE_LIBTRE}" = "xno"; then
3867 echo "Use internal libtre : YES"
3868 else
3869 echo "Use internal libtre : NO"
3870 fi
3871 if test "x${HAVE_JANSSON}" = "xno"; then
3872 echo "Use internal libjansson : YES"
3873 else
3874 echo "Use internal libjansson : NO"
3875 fi
3876 check_substr "$COMPONENTS" "sqlite"
3877 if test $? = 0; then
3878 if test "x${HAVE_SQLITE}" = "xno"; then
3879 echo "Use internal sqlite : YES"
3880 else
3881 echo "Use internal sqlite : NO"
3882 fi
3883 fi
3884 if test "x${HAVE_ZLIB}" = "xno"; then
3885 echo "Use internal zlib : YES"
3886 else
3887 echo "Use internal zlib : NO"
3888 fi
3889 if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
3890 echo "Force 32bit build : YES"
3891 else
3892 echo "Force 32bit build : NO"
3893 fi
3894
3895 echo "C compiler : ${CC}"
3896 echo "C++ compiler : ${CXX}"
3897 echo "C++ compiler info : ${COMPILER_VERSION}"
3898 echo "CPPFLAGS : ${CPPFLAGS}"
3899 echo "CXXFLAGS : ${CXXFLAGS}"
3900 echo "CFLAGS : ${CFLAGS}"
3901 echo "LDFLAGS : ${LDFLAGS}"
3902 echo "LIBS : ${LIBS}"
3903
3904 if test "x${MYSQL_CPPFLAGS}" != "x"; then
3905 echo "MySQL CPPFLAGS : ${MYSQL_CPPFLAGS}"
3906 fi
3907 if test "x${MYSQL_LDFLAGS}" != "x"; then
3908 echo "MySQL LDFLAGS : ${MYSQL_LDFLAGS}"
3909 fi
3910 if test "x${MYSQL_LIBS}" != "x"; then
3911 echo "MySQL LIBS : ${MYSQL_LIBS}"
3912 fi
3913
3914 if test "x${MARIADB_CPPFLAGS}" != "x"; then
3915 echo "MariaDB CPPFLAGS : ${MARIADB_CPPFLAGS}"
3916 fi
3917 if test "x${MARIADB_LDFLAGS}" != "x"; then
3918 echo "MariaDB LDFLAGS : ${MARIADB_LDFLAGS}"
3919 fi
3920 if test "x${MARIADB_LIBS}" != "x"; then
3921 echo "MariaDB LIBS : ${MARIADB_LIBS}"
3922 fi
3923
3924 if test "x${PGSQL_CPPFLAGS}" != "x"; then
3925 echo "PostgreSQL CPPFLAGS : ${PGSQL_CPPFLAGS}"
3926 fi
3927 if test "x${PGSQL_LDFLAGS}" != "x"; then
3928 echo "PostgreSQL LDFLAGS : ${PGSQL_LDFLAGS}"
3929 fi
3930 if test "x${PGSQL_LIBS}" != "x"; then
3931 echo "PostgreSQL LIBS : ${PGSQL_LIBS}"
3932 fi
3933
3934 if test "x${ORACLE_CPPFLAGS}" != "x"; then
3935 echo "Oracle CPPFLAGS : ${ORACLE_CPPFLAGS}"
3936 fi
3937 if test "x${ORACLE_LDFLAGS}" != "x"; then
3938 echo "Oracle LDFLAGS : ${ORACLE_LDFLAGS}"
3939 fi
3940 if test "x${ORACLE_LIBS}" != "x"; then
3941 echo "Oracle LIBS : ${ORACLE_LIBS}"
3942 fi
3943
3944 if test "x${ODBC_CPPFLAGS}" != "x"; then
3945 echo "ODBC CPPFLAGS : ${ODBC_CPPFLAGS}"
3946 fi
3947 if test "x${ODBC_LDFLAGS}" != "x"; then
3948 echo "ODBC LDFLAGS : ${ODBC_LDFLAGS}"
3949 fi
3950 if test "x${ODBC_LIBS}" != "x"; then
3951 echo "ODBC LIBS : ${ODBC_LIBS}"
3952 fi
3953
3954 if test "x${DB2_CPPFLAGS}" != "x"; then
3955 echo "DB2 CPPFLAGS : ${DB2_CPPFLAGS}"
3956 fi
3957 if test "x${DB2_LDFLAGS}" != "x"; then
3958 echo "DB2 LDFLAGS : ${DB2_LDFLAGS}"
3959 fi
3960 if test "x${DB2_LIBS}" != "x"; then
3961 echo "DB2 LIBS : ${DB2_LIBS}"
3962 fi
3963
3964 if test "x${INFORMIX_CPPFLAGS}" != "x"; then
3965 echo "Informix CPPFLAGS : ${INFORMIX_CPPFLAGS}"
3966 fi
3967 if test "x${INFORMIX_LDFLAGS}" != "x"; then
3968 echo "Informix LDFLAGS : ${INFORMIX_LDFLAGS}"
3969 fi
3970 if test "x${INFORMIX_LIBS}" != "x"; then
3971 echo "Informix LIBS : ${INFORMIX_LIBS}"
3972 fi
3973
3974 if test "x${TUXEDO_CPPFLAGS}" != "x"; then
3975 echo "Tuxedo CPPFLAGS : ${TUXEDO_CPPFLAGS}"
3976 fi
3977 if test "x${TUXEDO_LDFLAGS}" != "x"; then
3978 echo "Tuxedo LDFLAGS : ${TUXEDO_LDFLAGS}"
3979 fi
3980 if test "x${TUXEDO_LIBS}" != "x"; then
3981 echo "Tuxedo LIBS : ${TUXEDO_LIBS}"
3982 fi
3983
3984 if test "x${MONGODB_CPPFLAGS}" != "x"; then
3985 echo "MongoDB CPPFLAGS : ${MONGODB_CPPFLAGS}"
3986 fi
3987 if test "x${MONGODB_LDFLAGS}" != "x"; then
3988 echo "MongoDB LDFLAGS : ${MONGODB_LDFLAGS}"
3989 fi
3990
3991 if test "x${ZEROMQ_CPPFLAGS}" != "x"; then
3992 echo "ZeroMQ CPPFLAGS : ${ZEROMQ_CPPFLAGS}"
3993 fi
3994 if test "x${ZEROMQ_LDFLAGS}" != "x"; then
3995 echo "ZeroMQ LDFLAGS : ${ZEROMQ_LDFLAGS}"
3996 fi
3997
3998 if test "x${VMGR_CPPFLAGS}" != "x"; then
3999 echo "Vmgr CPPFLAGS : ${VMGR_CPPFLAGS}"
4000 fi
4001 if test "x${VMGR_LDFLAGS}" != "x"; then
4002 echo "Vmgr LDFLAGS : ${VMGR_LDFLAGS}"
4003 fi
4004 if test "x${VMGR_LIBS}" != "x"; then
4005 echo "Vmgr LIBS : ${VMGR_LIBS}"
4006 fi
4007
4008 if test "x${XEN_CPPFLAGS}" != "x"; then
4009 echo "XEN CPPFLAGS : ${XEN_CPPFLAGS}"
4010 fi
4011 if test "x${XEN_LDFLAGS}" != "x"; then
4012 echo "XEN LDFLAGS : ${XEN_LDFLAGS}"
4013 fi
4014 if test "x${XEN_LIBS}" != "x"; then
4015 echo "XEN LIBS : ${XEN_LIBS}"
4016 fi
4017
4018 FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
4019 echo "/* Automatically generated by configure */" > $FLAGS_CPP
4020 echo "#include <nms_common.h>" >> $FLAGS_CPP
4021 echo "const TCHAR *g_cppFlags = _T(\"${CPPFLAGS}\");" >> $FLAGS_CPP
4022 echo "const TCHAR *g_cFlags = _T(\"${CFLAGS}\");" >> $FLAGS_CPP
4023 echo "const TCHAR *g_cxxFlags = _T(\"${CXXFLAGS}\");" >> $FLAGS_CPP
4024 echo "const TCHAR *g_ldFlags = _T(\"${LDFLAGS}\");" >> $FLAGS_CPP
4025 echo "const TCHAR *g_libs = _T(\"${LIBS}\");" >> $FLAGS_CPP
4026 echo "const TCHAR *g_cc = _T(\"${CC}\");" >> $FLAGS_CPP
4027 echo "const TCHAR *g_cxx = _T(\"${CXX}\");" >> $FLAGS_CPP
4028 echo "const TCHAR *g_ld = _T(\"${LD}\");" >> $FLAGS_CPP
4029 echo "const TCHAR *g_perl = _T(\"${PERL}\");" >> $FLAGS_CPP
4030 echo "const TCHAR *g_serverLibs = _T(\"${SERVER_LIBS}\");" >> $FLAGS_CPP
4031 echo "const TCHAR *g_tuxedoCppFlags = _T(\"${TUXEDO_CPPFLAGS}\");" >> $FLAGS_CPP
4032 echo "const TCHAR *g_tuxedoLdFlags = _T(\"${TUXEDO_LDFLAGS}\");" >> $FLAGS_CPP
4033 echo "const TCHAR *g_tuxedoLibs = _T(\"${TUXEDO_LIBS}\");" >> $FLAGS_CPP