4d36bb0a81be8580c0426be18b16008e46350e72
[public/netxms.git] / configure.ac
1 # $Id$
2 #
3 # NetXMS - Network Management System
4 # Configure script
5 #
6
7 AC_INIT([NetXMS], [2.1], [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"
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 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 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 libnxmb"
1007 else
1008 MODULES="$MODULES appagent client libnxsl libnxmb 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
2498 AC_CHECK_DECLS([putws],,,[
2499 #if HAVE_WCHAR_H
2500 #include <wchar.h>
2501 #endif
2502 ])
2503
2504 if test "x$ac_cv_func_wcsftime" = "xyes"; then
2505 AC_MSG_CHECKING(whether wcsftime is working correctly)
2506 AC_RUN_IFELSE(
2507 [AC_LANG_PROGRAM([
2508 #include <stdio.h>
2509 #ifdef HAVE_UNISTD_H
2510 #include <unistd.h>
2511 #endif
2512 #ifdef HAVE_TIME_H
2513 #include <time.h>
2514 #endif
2515 #ifdef HAVE_SYS_TIME_H
2516 #include <sys/time.h>
2517 #endif
2518 #if HAVE_WCHAR_H
2519 #include <wchar.h>
2520 #endif
2521 ], [[
2522 wchar_t buffer[64];
2523 struct tm *ltm;
2524 time_t t;
2525
2526 t = time(NULL);
2527 ltm = localtime(&t);
2528 wcsftime(buffer, 64, L"%Y", ltm);
2529 return wcstol(buffer, NULL, 10) == ltm->tm_year + 1900 ? 0 : 1;
2530 ]])
2531 ],
2532 [ AC_MSG_RESULT(yes)
2533 AC_DEFINE(WORKING_WCSFTIME, 1, Define to 1 if wcsftime is working correctly)
2534 ],
2535 [ AC_MSG_RESULT(no) ],
2536 [ AC_MSG_RESULT(no) ]
2537 )
2538 fi
2539
2540 if test "x$DISABLE_ICONV" != "xyes"; then
2541 AC_CHECK_LIB(iconv, libiconv_open,
2542 [ ac_found_iconv=yes
2543 LIBS="$LIBS -liconv"
2544 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
2545 ],
2546 [
2547 AC_CHECK_LIB(iconv, iconv,
2548 [ ac_found_iconv=yes
2549 LIBS="$LIBS -liconv"
2550 ])
2551 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
2552 ])
2553 else
2554 ac_found_iconv=no
2555 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
2556 fi
2557
2558 AC_MSG_CHECKING(whether fgetws can be used with popen)
2559 AC_RUN_IFELSE(
2560 [AC_LANG_PROGRAM([
2561 #include <stdio.h>
2562 #ifdef HAVE_UNISTD_H
2563 #include <unistd.h>
2564 #endif
2565 #if HAVE_WCHAR_H
2566 #include <wchar.h>
2567 #endif
2568 ], [[
2569 int rc = 1;
2570 wchar_t line[4096];
2571 FILE *f = popen("echo test", "r");
2572 if(f!=NULL)
2573 {
2574 fgetws(line, 4096, f);
2575 pclose(f);
2576 rc = 0;
2577 }
2578 return rc;
2579 ]])
2580 ],
2581 [ AC_MSG_RESULT(yes)
2582 AC_DEFINE(SAFE_FGETWS_WITH_POPEN, 1, Define to 1 if fgetws can be used with popen)
2583 ],
2584 [ AC_MSG_RESULT(no) ],
2585 [ AC_MSG_RESULT(no) ]
2586 )
2587
2588 AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
2589 AC_RUN_IFELSE(
2590 [AC_LANG_PROGRAM([
2591 #if HAVE_ICONV_H
2592 #include <iconv.h>
2593 #endif
2594 ], [
2595 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
2596 ])
2597 ],
2598 [ AC_MSG_RESULT(yes)
2599 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
2600 valid_ucs2_code="UCS-2-INTERNAL"
2601 ],
2602 [ AC_MSG_RESULT(no) ],
2603 [ AC_MSG_RESULT(no) ]
2604 )
2605
2606 AC_MSG_CHECKING(whether iconv supports UCS-2)
2607 AC_RUN_IFELSE(
2608 [AC_LANG_PROGRAM([
2609 #if HAVE_ICONV_H
2610 #include <iconv.h>
2611 #endif
2612 ], [
2613 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
2614 ])
2615 ],
2616 [ AC_MSG_RESULT(yes)
2617 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
2618 valid_ucs2_code="UCS-2"
2619 ],
2620 [ AC_MSG_RESULT(no) ],
2621 [ AC_MSG_RESULT(no) ]
2622 )
2623
2624 AC_MSG_CHECKING(whether iconv supports UCS2)
2625 AC_RUN_IFELSE(
2626 [AC_LANG_PROGRAM([
2627 #if HAVE_ICONV_H
2628 #include <iconv.h>
2629 #endif
2630 ], [
2631 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
2632 ])
2633 ],
2634 [ AC_MSG_RESULT(yes)
2635 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
2636 valid_ucs2_code="UCS2"
2637 ],
2638 [ AC_MSG_RESULT(no) ],
2639 [ AC_MSG_RESULT(no) ]
2640 )
2641
2642 AC_MSG_CHECKING(whether iconv supports UCS-2BE)
2643 AC_RUN_IFELSE(
2644 [AC_LANG_PROGRAM([
2645 #if HAVE_ICONV_H
2646 #include <iconv.h>
2647 #endif
2648 ], [
2649 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
2650 ])
2651 ],
2652 [ AC_MSG_RESULT(yes)
2653 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
2654 valid_ucs2_code="UCS-2BE"
2655 ],
2656 [ AC_MSG_RESULT(no) ],
2657 [ AC_MSG_RESULT(no) ]
2658 )
2659
2660 AC_MSG_CHECKING(whether iconv supports UCS-2LE)
2661 AC_RUN_IFELSE(
2662 [AC_LANG_PROGRAM([
2663 #if HAVE_ICONV_H
2664 #include <iconv.h>
2665 #endif
2666 ], [
2667 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
2668 ])
2669 ],
2670 [ AC_MSG_RESULT(yes)
2671 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
2672 valid_ucs2_code="UCS-2LE"
2673 ],
2674 [ AC_MSG_RESULT(no) ],
2675 [ AC_MSG_RESULT(no) ]
2676 )
2677
2678 AC_MSG_CHECKING(whether iconv supports UTF-16)
2679 AC_RUN_IFELSE(
2680 [AC_LANG_PROGRAM([
2681 #if HAVE_ICONV_H
2682 #include <iconv.h>
2683 #endif
2684 ], [
2685 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
2686 ])
2687 ],
2688 [ AC_MSG_RESULT(yes)
2689 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
2690 valid_ucs2_code="UTF-16"
2691 ],
2692 [ AC_MSG_RESULT(no) ],
2693 [ AC_MSG_RESULT(no) ]
2694 )
2695
2696 AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
2697 AC_RUN_IFELSE(
2698 [AC_LANG_PROGRAM([
2699 #if HAVE_ICONV_H
2700 #include <iconv.h>
2701 #endif
2702 ], [
2703 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
2704 ])
2705 ],
2706 [ AC_MSG_RESULT(yes)
2707 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
2708 valid_ucs4_code="UCS-4-INTERNAL"
2709 ],
2710 [ AC_MSG_RESULT(no) ],
2711 [ AC_MSG_RESULT(no) ]
2712 )
2713
2714 AC_MSG_CHECKING(whether iconv supports UCS-4)
2715 AC_RUN_IFELSE(
2716 [AC_LANG_PROGRAM([
2717 #if HAVE_ICONV_H
2718 #include <iconv.h>
2719 #endif
2720 ], [
2721 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
2722 ])
2723 ],
2724 [ AC_MSG_RESULT(yes)
2725 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
2726 valid_ucs4_code="UCS-4"
2727 ],
2728 [ AC_MSG_RESULT(no) ],
2729 [ AC_MSG_RESULT(no) ]
2730 )
2731
2732 AC_MSG_CHECKING(whether iconv supports UCS4)
2733 AC_RUN_IFELSE(
2734 [AC_LANG_PROGRAM([
2735 #if HAVE_ICONV_H
2736 #include <iconv.h>
2737 #endif
2738 ], [
2739 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
2740 ])
2741 ],
2742 [ AC_MSG_RESULT(yes)
2743 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
2744 valid_ucs4_code="UCS4"
2745 ],
2746 [ AC_MSG_RESULT(no) ],
2747 [ AC_MSG_RESULT(no) ]
2748 )
2749
2750 AC_MSG_CHECKING(whether iconv supports UCS-4BE)
2751 AC_RUN_IFELSE(
2752 [AC_LANG_PROGRAM([
2753 #if HAVE_ICONV_H
2754 #include <iconv.h>
2755 #endif
2756 ], [
2757 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
2758 ])
2759 ],
2760 [ AC_MSG_RESULT(yes)
2761 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
2762 valid_ucs4_code="UCS-4BE"
2763 ],
2764 [ AC_MSG_RESULT(no) ],
2765 [ AC_MSG_RESULT(no) ]
2766 )
2767
2768 AC_MSG_CHECKING(whether iconv supports UCS-4LE)
2769 AC_RUN_IFELSE(
2770 [AC_LANG_PROGRAM([
2771 #if HAVE_ICONV_H
2772 #include <iconv.h>
2773 #endif
2774 ], [
2775 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
2776 ])
2777 ],
2778 [ AC_MSG_RESULT(yes)
2779 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
2780 valid_ucs4_code="UCS-4LE"
2781 ],
2782 [ AC_MSG_RESULT(no) ],
2783 [ AC_MSG_RESULT(no) ]
2784 )
2785
2786 AC_MSG_CHECKING(whether iconv supports UTF-32)
2787 AC_RUN_IFELSE(
2788 [AC_LANG_PROGRAM([
2789 #if HAVE_ICONV_H
2790 #include <iconv.h>
2791 #endif
2792 ], [
2793 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
2794 ])
2795 ],
2796 [ AC_MSG_RESULT(yes)
2797 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
2798 valid_ucs4_code="UTF-32"
2799 ],
2800 [ AC_MSG_RESULT(no) ],
2801 [ AC_MSG_RESULT(no) ]
2802 )
2803
2804 AC_MSG_CHECKING(whether iconv supports //IGNORE)
2805 AC_RUN_IFELSE(
2806 [AC_LANG_PROGRAM([
2807 #if HAVE_ICONV_H
2808 #include <iconv.h>
2809 #endif
2810 ], [
2811 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
2812 ])
2813 ],
2814 [ AC_MSG_RESULT(yes)
2815 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
2816 ],
2817 [ AC_MSG_RESULT(no) ],
2818 [ AC_MSG_RESULT(no) ]
2819 )
2820
2821 AC_MSG_CHECKING(whether iconv supports state reset)
2822 AC_RUN_IFELSE(
2823 [AC_LANG_PROGRAM([
2824 #include <stdio.h>
2825 #if HAVE_ICONV_H
2826 #include <iconv.h>
2827 #endif
2828 ], [
2829 iconv_t cd = iconv_open("UTF-8","$valid_ucs2_code");
2830 if (cd == (iconv_t)(-1)) return 1;
2831 return iconv(cd, NULL, NULL, NULL, NULL) != 0;
2832 ])
2833 ],
2834 [ AC_MSG_RESULT(yes)
2835 AC_DEFINE(HAVE_ICONV_STATE_RESET, 1, Define to 1 if iconv supports state reset)
2836 ],
2837 [ AC_MSG_RESULT(no) ],
2838 [ AC_MSG_RESULT(no) ]
2839 )
2840
2841 AC_MSG_CHECKING(whether iconv descriptor cache is needed)
2842 case $enable_iconv_cache in
2843 auto)
2844 case $PLATFORM in
2845 SunOS|HP-UX|AIX)
2846 enable_iconv_cache=yes
2847 ;;
2848 *)
2849 enable_iconv_cache=no
2850 ;;
2851 esac
2852 ;;
2853 yes|no)
2854 ;;
2855 *)
2856 AC_MSG_ERROR([Value given to --enable-iconv-cache must be one of yes, no or auto])
2857 ;;
2858 esac
2859 if test "x$enable_iconv_cache" = "xyes"; then
2860 AC_DEFINE(WITH_ICONV_CACHE, 1, Define to 1 to enable iconv descriptor cache)
2861 fi
2862 AC_MSG_RESULT($enable_iconv_cache)
2863
2864 # taken from ZSH's configure
2865 # Check if iconv uses const in prototype declaration
2866 if test "x$ac_found_iconv" = "xyes"; then
2867 AC_LANG_PUSH([C++])
2868 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
2869 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2870 #include <stdlib.h>
2871 #if HAVE_ICONV_H
2872 #include <iconv.h>
2873 #endif
2874 ]],
2875 [[
2876 char **p = NULL;
2877 iconv(0, (const char **)p, 0, 0, 0);
2878 ]])],
2879 [ac_cv_iconv_const=const],
2880 [ac_cv_iconv_const=])])
2881 AC_LANG_POP([C++])
2882 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2883 [Define as const if the declaration of iconv() needs const.])
2884 fi
2885
2886 if test "x$ac_cv_type_wchar_t" = "xyes"; then
2887 if test $ac_cv_sizeof_wchar_t -eq 2; then
2888 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2889 fi
2890
2891 if test $ac_cv_sizeof_wchar_t -eq 4; then
2892 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2893 fi
2894
2895 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2896 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2897 fi
2898 else
2899 if test "x$BUILD_UNICODE" = "xyes"; then
2900 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2901 fi
2902 fi
2903
2904
2905 #--------------------------------------------------------------------
2906 # MySQL
2907 #--------------------------------------------------------------------
2908
2909 check_substr "$COMPONENTS" "mysql"
2910 if test $? = 0; then
2911 OLD_CPPFLAGS="$CPPFLAGS"
2912 OLD_LDFLAGS="$LDFLAGS"
2913 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2914
2915 CPPFLAGS="$CPPFLAGS $MYSQL_CPPFLAGS"
2916 LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
2917 if test "x$MYSQL_LD_RUN_PATH" != "x"; then
2918 LD_RUN_PATH="${MYSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2919 fi
2920
2921 AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MySQL client installation]))
2922
2923 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
2924 [
2925 AC_MSG_ERROR(libmysqlclient is requred for MySQL support)
2926 ])
2927
2928 OLD_LIBS="$LIBS"
2929 LIBS="$LIBS $MYSQL_LIBS"
2930
2931 AC_CHECK_FUNCS(mysql_real_escape_string)
2932
2933 CPPFLAGS="$OLD_CPPFLAGS"
2934 LDFLAGS="$OLD_LDFLAGS"
2935 LD_RUN_PATH="$OLD_LD_RUN_PATH"
2936 LIBS="$OLD_LIBS"
2937 fi
2938
2939
2940 #--------------------------------------------------------------------
2941 # MariaDB
2942 #--------------------------------------------------------------------
2943
2944 check_substr "$COMPONENTS" "mariadb"
2945 if test $? = 0; then
2946 OLD_CPPFLAGS="$CPPFLAGS"
2947 OLD_LDFLAGS="$LDFLAGS"
2948 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2949
2950 CPPFLAGS="$CPPFLAGS $MARIADB_CPPFLAGS"
2951 LDFLAGS="$LDFLAGS $MARIADB_LDFLAGS"
2952 if test "x$MARIADB_LD_RUN_PATH" != "x"; then
2953 LD_RUN_PATH="${MARIADB_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2954 fi
2955
2956 AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MariaDB client installation]))
2957
2958 AC_CHECK_LIB(mariadb, mysql_init, [MARIADB_LIBS="-lmariadb"],
2959 [
2960 AC_MSG_ERROR(libmariadb is requred for MariaDB support)
2961 ])
2962
2963 CPPFLAGS="$OLD_CPPFLAGS"
2964 LDFLAGS="$OLD_LDFLAGS"
2965 LD_RUN_PATH="$OLD_LD_RUN_PATH"
2966 fi
2967
2968
2969 #--------------------------------------------------------------------
2970 # PostgreSQL
2971 #--------------------------------------------------------------------
2972
2973 check_substr "$COMPONENTS" "pgsql"
2974 if test $? = 0; then
2975 OLD_CPPFLAGS="$CPPFLAGS"
2976 OLD_LDFLAGS="$LDFLAGS"
2977 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2978
2979 CPPFLAGS="$CPPFLAGS $PGSQL_CPPFLAGS"
2980 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
2981 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2982 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2983 fi
2984
2985 AC_CHECK_HEADER(libpq-fe.h,,AC_MSG_ERROR([Cannot find libpq-fe.h - check your PostgreSQL client installation]))
2986
2987 AC_CHECK_DECLS([PGRES_SINGLE_TUPLE],,,[
2988 #include <libpq-fe.h>
2989 ])
2990
2991 AC_CHECK_LIB(m, floor)
2992 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2993 if test "x$PLATFORM" = "xSunOS"; then
2994 if test -d "$PGSQL_LD_RUN_PATH/sparcv9"; then
2995 PGSQL_LDFLAGS="$PGSQL_LDFLAGS/sparcv9"
2996 else
2997 PGSQL_LDFLAGS="$PGSQL_LDFLAGS/64"
2998 fi
2999 LDFLAGS="$OLD_LDFLAGS $PGSQL_LDFLAGS"
3000 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
3001 PGSQL_LD_RUN_PATH="$PGSQL_LD_RUN_PATH/sparcv9"
3002 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${OLD_LD_RUN_PATH:+:}${OLD_LD_RUN_PATH}"
3003 fi
3004 unset ac_cv_lib_pq_PQconnectdb
3005 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
3006 AC_MSG_ERROR(libpq is required for PostgreSQL support)])
3007 else
3008 AC_MSG_ERROR(libpq is required for PostgreSQL support)
3009 fi
3010 ])
3011
3012 CPPFLAGS="$OLD_CPPFLAGS"
3013 LDFLAGS="$OLD_LDFLAGS"
3014 LD_RUN_PATH="$OLD_LD_RUN_PATH"
3015 fi
3016
3017
3018 #--------------------------------------------------------------------
3019 # ODBC
3020 #--------------------------------------------------------------------
3021
3022 check_substr "$COMPONENTS" "odbc"
3023 if test $? = 0; then
3024 OLD_CPPFLAGS="$CPPFLAGS"
3025 OLD_LDFLAGS="$LDFLAGS"
3026 OLD_LD_RUN_PATH="$LD_RUN_PATH"
3027
3028 CPPFLAGS="$CPPFLAGS $ODBC_CPPFLAGS"
3029 LDFLAGS="$LDFLAGS $ODBC_LDFLAGS"
3030 if test "x$ODBC_LD_RUN_PATH" != "x"; then
3031 LD_RUN_PATH="${ODBC_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
3032 fi
3033
3034 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
3035 [AC_MSG_ERROR(libodbc is required for ODBC support)])
3036 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
3037 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
3038 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
3039 fi
3040
3041 CPPFLAGS="$OLD_CPPFLAGS"
3042 LDFLAGS="$OLD_LDFLAGS"
3043 LD_RUN_PATH="$OLD_LD_RUN_PATH"
3044 fi
3045
3046
3047 #--------------------------------------------------------------------
3048 # Oracle
3049 #--------------------------------------------------------------------
3050
3051 check_substr "$COMPONENTS" "oracle"
3052 if test $? = 0; then
3053 OLD_CPPFLAGS="$CPPFLAGS"
3054 OLD_LDFLAGS="$LDFLAGS"
3055 OLD_LD_RUN_PATH="$LD_RUN_PATH"
3056
3057 CPPFLAGS="$CPPFLAGS $ORACLE_CPPFLAGS"
3058 LDFLAGS="$LDFLAGS $ORACLE_LDFLAGS"
3059 if test "x$ORACLE_LD_RUN_PATH" != "x"; then
3060 LD_RUN_PATH="${ORACLE_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
3061 fi
3062
3063 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
3064 AC_CHECK_LIB(nnz12, nzstrcpy, [NNZ_LIB=-lnnz12],
3065 [
3066 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
3067 [
3068 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
3069 ], [-lclntsh])
3070 ], [-lclntsh])
3071 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
3072 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
3073 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
3074 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
3075 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
3076 fi
3077
3078 CPPFLAGS="$OLD_CPPFLAGS"
3079 LDFLAGS="$OLD_LDFLAGS"
3080 LD_RUN_PATH="$OLD_LD_RUN_PATH"
3081 fi
3082
3083 #--------------------------------------------------------------------
3084 # DB2
3085 #--------------------------------------------------------------------
3086
3087 check_substr "$COMPONENTS" "db2"
3088 if test $? = 0; then
3089 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
3090 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
3091 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
3092 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
3093 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
3094 fi
3095 fi
3096
3097 #--------------------------------------------------------------------
3098 # Informix
3099 #--------------------------------------------------------------------
3100
3101 check_substr "$COMPONENTS" "informix"
3102 if test $? = 0; then
3103 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
3104 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
3105 [AC_MSG_ERROR(libthcli is required for Informix support)])
3106 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
3107 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
3108 fi
3109 fi
3110
3111
3112 #--------------------------------------------------------------------
3113 # Java
3114 #--------------------------------------------------------------------
3115
3116 check_substr "$COMPONENTS" "java"
3117 if test $? = 0; then
3118 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
3119 fi
3120
3121
3122 #--------------------------------------------------------------------
3123 # Tuxedo
3124 #--------------------------------------------------------------------
3125
3126 check_substr "$COMPONENTS" "tuxedo"
3127 if test $? = 0; then
3128 OLD_CPPFLAGS="$CPPFLAGS"
3129 OLD_LDFLAGS="$LDFLAGS"
3130 OLD_LIBS="$LIBS"
3131
3132 if test "x$TUXEDO_BASE" != "x"; then
3133 TUXEDO_CPPFLAGS="-I$TUXEDO_BASE/include"
3134 TUXEDO_LDFLAGS="-L$TUXEDO_BASE/lib"
3135 CPPFLAGS="$CPPFLAGS $TUXEDO_CPPFLAGS"
3136 LDFLAGS="$LDFLAGS $TUXEDO_LDFLAGS"
3137 fi
3138
3139 AC_CHECK_HEADER(atmi.h,,AC_MSG_ERROR([*** Cannot find atmi.h - check your Tuxedo installation ***]))
3140
3141 # https://community.oracle.com/thread/2346582
3142 if test "x$PLATFORM" = "xLinux"; then
3143 TUXEDO_LDFLAGS="$TUXEDO_LDFLAGS -Xlinker --no-as-needed"
3144 LDFLAGS="$LDFLAGS -Xlinker --no-as-needed"
3145 fi
3146
3147 if test "$PLATFORM" = "SunOS"; then
3148 AC_CHECK_LIB(rt, nanosleep, [ TUXEDO_LIBS="$TUXEDO_LIBS -lrt" ])
3149 fi
3150
3151 if test "$PLATFORM" = "AIX"; then
3152 AC_MSG_CHECKING(for xa_switchp in libengine)
3153 OLD_LIBS_LIBENGINE="$LIBS"
3154 LIBS="$LIBS -lengine"
3155 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ extern char *xa_switchp; ]], [[ *xa_switchp = 0; ]])],
3156 [
3157 AC_MSG_RESULT(yes)
3158 TUXEDO_LIBS="$TUXEDO_LIBS -lengine"
3159 ],
3160 [ AC_MSG_RESULT(no) ])
3161 LIBS="$OLD_LIBS_LIBENGINE"
3162 fi
3163
3164 LIBS="$LIBS $TUXEDO_LIBS"
3165 AC_CHECK_LIB(tux, tpcall, [], [AC_MSG_ERROR(libtux is required for Tuxedo support)])
3166
3167 CPPFLAGS="$OLD_CPPFLAGS"
3168 LDFLAGS="$OLD_LDFLAGS"
3169 LIBS="$OLD_LIBS"
3170
3171 if test "x$PLATFORM" = "xAIX"; then
3172 if test -e $TUXEDO_BASE/lib/tpinit.o; then
3173 TUXEDO_TPINIT="$TUXEDO_BASE/lib/tpinit.o"
3174 fi
3175 fi
3176 fi
3177
3178
3179 #--------------------------------------------------------------------
3180 # ZeroMQ
3181 #--------------------------------------------------------------------
3182
3183 check_substr "$COMPONENTS" "zeromq"
3184 if test $? = 0; then
3185 OLD_CPPFLAGS="$CPPFLAGS"
3186 OLD_LDFLAGS="$LDFLAGS"
3187 OLD_LIBS="$LIBS"
3188
3189 if test "x$ZEROMQ_BASE" != "x"; then
3190 ZEROMQ_CPPFLAGS="-I$ZEROMQ_BASE/include"
3191 ZEROMQ_LDFLAGS="-L$ZEROMQ_BASE/lib"
3192 CPPFLAGS="$CPPFLAGS $ZEROMQ_CPPFLAGS"
3193 LDFLAGS="$LDFLAGS $ZEROMQ_LDFLAGS"
3194 fi
3195
3196 AC_CHECK_HEADER(zmq.h,,[
3197 if test "x$ZEROMQ_REQUIRED" = "xyes"; then
3198 AC_MSG_ERROR([*** Cannot find zmq.h - check your ZeroMQ installation ***])
3199 else
3200 ZEROMQ_SUPPORT="no"
3201 fi
3202 ])
3203 AC_CHECK_LIB(zmq, zmq_ctx_new, [ SERVER_LIBS="$SERVER_LIBS -lzmq" ], [
3204 if test "x$ZEROMQ_REQUIRED" = "xyes"; then
3205 AC_MSG_ERROR([*** libzmq is missing or too old - check your ZeroMQ installation ***])
3206 else
3207 ZEROMQ_SUPPORT="no"
3208 fi
3209 ])
3210
3211 if test "x$ZEROMQ_SUPPORT" = "xyes"; then
3212 AC_DEFINE(WITH_ZMQ, 1, Define to 1 if ZeroMQ is supported)
3213 fi
3214
3215 CPPFLAGS="$OLD_CPPFLAGS"
3216 LDFLAGS="$OLD_LDFLAGS"
3217 LIBS="$OLD_LIBS"
3218 fi
3219
3220
3221 #--------------------------------------------------------------------
3222 # MQTT
3223 #--------------------------------------------------------------------
3224
3225 if test "x$DISABLE_MQTT" != "xyes"; then
3226 OLD_CPPFLAGS="$CPPFLAGS"
3227 OLD_LDFLAGS="$LDFLAGS"
3228 OLD_LIBS="$LIBS"
3229
3230 if test "x$MOSQUITTO_BASE" != "x"; then
3231 MQTT_CPPFLAGS="-I$MOSQUITTO_BASE/include"
3232 MQTT_LDFLAGS="-L$MOSQUITTO_BASE/lib"
3233 CPPFLAGS="$CPPFLAGS $MQTT_CPPFLAGS"
3234 LDFLAGS="$LDFLAGS $MQTT_LDFLAGS"
3235 fi
3236
3237 AC_CHECK_HEADER(mosquitto.h,,[
3238 AC_MSG_ERROR([*** Cannot find mosquitto.h - check your libmosquitto installation or disable MQTT support with --disable-mqtt ***])
3239 ])
3240 AC_CHECK_LIB(mosquitto, mosquitto_lib_init, [ MQTT_LIBS="-lmosquitto" ], [
3241 AC_MSG_ERROR([*** libmosquitto is missing - check your libmosquitto installation or disable MQTT support with --disable-mqtt***])
3242 ])
3243
3244 MQTT_SUPPORT="yes"
3245 AC_DEFINE(WITH_MQTT, 1, Define to 1 if MQTT is supported)
3246 SUBAGENT_DIRS="$SUBAGENT_DIRS mqtt"
3247
3248 CPPFLAGS="$OLD_CPPFLAGS"
3249 LDFLAGS="$OLD_LDFLAGS"
3250 LIBS="$OLD_LIBS"
3251 fi
3252
3253
3254 #--------------------------------------------------------------------
3255 # MongoDB
3256 #--------------------------------------------------------------------
3257
3258 check_substr "$COMPONENTS" "mongodb"
3259 if test $? = 0; then
3260 OLD_CPPFLAGS="$CPPFLAGS"
3261 OLD_LDFLAGS="$LDFLAGS"
3262 OLD_LIBS="$LIBS"
3263
3264 if test "x$MONGODB_BASE" != "x"; then
3265 MONGODB_CPPFLAGS="-I$MONGODB_BASE/include/libmongoc-1.0/ -I$MONGODB_BASE/include/libbson-1.0/"
3266 MONGODB_LDFLAGS="-L$MONGODB_BASE/lib"
3267 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
3268 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
3269 else
3270 MONGODB_CPPFLAGS="-I/usr/local/include/libmongoc-1.0/ -I/usr/local/include/libbson-1.0/"
3271 MONGODB_LDFLAGS="-L/usr/local/lib"
3272 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
3273 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
3274 fi
3275
3276 AC_CHECK_HEADER(mongoc.h,,AC_MSG_ERROR([*** Cannot find mongoc.h - check your MongoDB installation ***]))
3277 AC_CHECK_LIB(mongoc-1.0, mongoc_client_get_database, [ MONGODB_LIBS="$MONGODB_LIBS -lmongoc-1.0" ])
3278 AC_CHECK_LIB(bson-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lbson-1.0" ])
3279
3280 LIBS="$LIBS $MONGODB_LIBS"
3281
3282 CPPFLAGS="$OLD_CPPFLAGS"
3283 LDFLAGS="$OLD_LDFLAGS"
3284 LIBS="$OLD_LIBS"
3285 fi
3286
3287
3288 #--------------------------------------------------------------------
3289 # VMGR
3290 #--------------------------------------------------------------------
3291
3292 check_substr "$COMPONENTS" "vmgr"
3293 if test $? = 0; then
3294 OLD_CPPFLAGS="$CPPFLAGS"
3295 OLD_LDFLAGS="$LDFLAGS"
3296 OLD_LIBS="$LIBS"
3297
3298 if test "x$LIBVIRT_BASE" != "x"; then
3299 VMGR_CPPFLAGS="-I$LIBVIRT_BASE/include"
3300 VMGR_LDFLAGS="-L$LIBVIRT_BASE/lib"
3301 CPPFLAGS="$CPPFLAGS $VMGR_CPPFLAGS"
3302 LDFLAGS="$LDFLAGS $VMGR_LDFLAGS"
3303 else
3304 VMGR_CPPFLAGS=""
3305 VMGR_LDFLAGS=""
3306 CPPFLAGS="$CPPFLAGS $VMGR_CPPFLAGS"
3307 LDFLAGS="$LDFLAGS $VMGR_LDFLAGS"
3308 fi
3309
3310 AC_CHECK_HEADER(libvirt/libvirt.h,,AC_MSG_ERROR([*** Cannot find libvirt.h - check your libvirt installation ***]))
3311 AC_CHECK_LIB(virt, virConnectGetLibVersion, [ VMGR_LIBS="$VMGR_LIBS -lvirt" ])
3312 LIBS="$LIBS $VMGR_LIBS"
3313
3314 AC_CHECK_FUNCS([virDomainGetTime])
3315
3316 CPPFLAGS="$OLD_CPPFLAGS"
3317 LDFLAGS="$OLD_LDFLAGS"
3318 LIBS="$OLD_LIBS"
3319 fi
3320
3321
3322 #--------------------------------------------------------------------
3323 # XEN
3324 #--------------------------------------------------------------------
3325
3326 check_substr "$COMPONENTS" "xen"
3327 if test $? = 0; then
3328 OLD_CPPFLAGS="$CPPFLAGS"
3329 OLD_LDFLAGS="$LDFLAGS"
3330 OLD_LIBS="$LIBS"
3331
3332 AC_CHECK_HEADER(libxl.h,,AC_MSG_ERROR([*** Cannot find libxl.h - check your libxen installation ***]))
3333 AC_CHECK_LIB(xenlight, libxl_ctx_alloc, [ XEN_LIBS="$XEN_LIBS -lxenlight" ])
3334 AC_CHECK_LIB(xenctrl, xc_vcpu_getinfo, [ XEN_LIBS="$XEN_LIBS -lxenctrl" ])
3335
3336 CPPFLAGS="$OLD_CPPFLAGS"
3337 LDFLAGS="$OLD_LDFLAGS"
3338 LIBS="$OLD_LIBS"
3339 fi
3340
3341 #--------------------------------------------------------------------
3342 # Other settings
3343 #--------------------------------------------------------------------
3344
3345 if test "x$RUNTIME_PREFIX" = "x"; then
3346 if test "x${BUILD_UNICODE}" = "xyes"; then
3347 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\" -DSTATEDIR=L\\\"\${localstatedir}/lib/netxms\\\""
3348 else
3349 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\" -DSTATEDIR=\\\"\${localstatedir}/lib/netxms\\\""
3350 fi
3351 else
3352 if test "x${BUILD_UNICODE}" = "xyes"; then
3353 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\\\""
3354 else
3355 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\\\""
3356 fi
3357 LDFLAGS_SUFFIX="$LDFLAGS_SUFFIX -R $RUNTIME_PREFIX/lib"
3358 fi
3359
3360 LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $PTHREAD_LDFLAGS $LDFLAGS_SUFFIX"
3361
3362 if test "x${ENABLE_WERROR}" = "xyes"; then
3363 CPPFLAGS="$CPPFLAGS -Werror"
3364 fi
3365
3366 if test "x$PLATFORM" = "xDarwin"; then
3367 SHLIB_SUFFIX=".so"
3368 else
3369 if test "x$shrext_cmds" != "x"; then
3370 SHLIB_SUFFIX="$shrext_cmds"
3371 else
3372 SHLIB_SUFFIX=".so"
3373 fi
3374 fi
3375 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$SHLIB_SUFFIX"), [Define to platform's shared library suffix])
3376
3377 if test "x$ENABLE_DEBUG" = "xno"; then
3378 CPPFLAGS="$CPPFLAGS -DNDEBUG"
3379 fi
3380
3381 if test "x$WITH_JEMALLOC" = "xyes"; then
3382 LIBS="$LIBS -ljemalloc"
3383 fi
3384
3385 AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
3386 AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
3387 AM_CONDITIONAL([USE_INTERNAL_JANSSON], [test "x$HAVE_JANSSON" = "xno"])
3388 AM_CONDITIONAL([USE_INTERNAL_SQLITE], [test "x$HAVE_SQLITE" = "xno"])
3389 AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$HAVE_ZLIB" = "no"])
3390 AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
3391 AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
3392 AM_CONDITIONAL([USE_ENCRYPTION], [test "x${WITH_ENCRYPTION}" = "xyes"])
3393 AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
3394 AM_CONDITIONAL([MQTT_SUPPORT], [test "x$MQTT_SUPPORT" = "xyes"])
3395 AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
3396 AM_CONDITIONAL([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
3397
3398
3399 #--------------------------------------------------------------------
3400 # Get compiler version
3401 #--------------------------------------------------------------------
3402
3403 COMPILER_VERSION=""
3404 if test "$CXX" = "CC"; then
3405 v=`$CXX -V 2>&1 | head -1`
3406 if test $? = 0; then
3407 COMPILER_VERSION="$v"
3408 fi
3409 else
3410 for opt in -qversion --version -v -V; do
3411 v=`$CXX $opt 2>/dev/null | head -1`
3412 if test $? = 0; then
3413 if test "x$v" != "x" -a "x$COMPILER_VERSION" = "x"; then
3414 COMPILER_VERSION="$v"
3415 fi
3416 fi
3417 done
3418 fi
3419 AC_DEFINE_UNQUOTED([CPP_COMPILER_VERSION], "$COMPILER_VERSION", [C++ compiler version information])
3420
3421
3422 #--------------------------------------------------------------------
3423 # Cleanup variables
3424 #--------------------------------------------------------------------
3425
3426 AS_IF([test "x$with_dist" = "xyes"],
3427 [
3428 AGENT_DIRS=`echo $AGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3429 SUBAGENT_DIRS=`echo $SUBAGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3430 MODULES=`echo $MODULES|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3431 SMSDRV_DIRS=`echo $SMSDRV_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3432 HDLINK_DIRS=`echo $HDLINK_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3433 ])
3434
3435
3436 #--------------------------------------------------------------------
3437 # Substitute variables
3438 #--------------------------------------------------------------------
3439
3440 AC_SUBST(DB_DRIVERS)
3441 AC_SUBST(MODULES)
3442 AC_SUBST(AGENT_DIRS)
3443 AC_SUBST(SUBAGENT_DIRS)
3444 AC_SUBST(SERVER_INCLUDE)
3445 AC_SUBST(SERVER_LIBS)
3446 AC_SUBST(SERVER_TOOLS)
3447 AC_SUBST(SMSDRV_DIRS)
3448 AC_SUBST(HDLINK_DIRS)
3449 AC_SUBST(PDSDRV_DIRS)
3450 AC_SUBST(TOP_LEVEL_MODULES)
3451 AC_SUBST(CONTRIB_MODULES)
3452 AC_SUBST(CLIENT_COMPONENTS)
3453 AC_SUBST(STATIC_SUBAGENT_LIST)
3454 AC_SUBST(SUBAGENT_LIBS)
3455 AC_SUBST(BUILD_SERVER)
3456 AC_SUBST(BUILD_SDK)
3457 AC_SUBST(MYSQL_CPPFLAGS)
3458 AC_SUBST(MYSQL_LDFLAGS)
3459 AC_SUBST(MYSQL_LIBS)
3460 AC_SUBST(MARIADB_CPPFLAGS)
3461 AC_SUBST(MARIADB_LDFLAGS)
3462 AC_SUBST(MARIADB_LIBS)
3463 AC_SUBST(PGSQL_CPPFLAGS)
3464 AC_SUBST(PGSQL_LDFLAGS)
3465 AC_SUBST(PGSQL_LIBS)
3466 AC_SUBST(ORACLE_CPPFLAGS)
3467 AC_SUBST(ORACLE_LDFLAGS)
3468 AC_SUBST(ORACLE_LIBS)
3469 AC_SUBST(ODBC_CPPFLAGS)
3470 AC_SUBST(ODBC_LDFLAGS)
3471 AC_SUBST(ODBC_LIBS)
3472 AC_SUBST(DB2_CPPFLAGS)
3473 AC_SUBST(DB2_LDFLAGS)
3474 AC_SUBST(DB2_LIBS)
3475 AC_SUBST(INFORMIX_CPPFLAGS)
3476 AC_SUBST(INFORMIX_LDFLAGS)
3477 AC_SUBST(INFORMIX_LIBS)
3478 AC_SUBST(INSTALL_LIBPATH)
3479 AC_SUBST(OBJECT_MODE)
3480 AC_SUBST(SQLFLAGS)
3481 AC_SUBST(SHLIB_SUFFIX)
3482 AC_SUBST(TUXEDO_CPPFLAGS)
3483 AC_SUBST(TUXEDO_LDFLAGS)
3484 AC_SUBST(TUXEDO_LIBS)
3485 AC_SUBST(TUXEDO_TPINIT)
3486 AC_SUBST(MONGODB_CPPFLAGS)
3487 AC_SUBST(MONGODB_LDFLAGS)
3488 AC_SUBST(MONGODB_LIBS)
3489 AC_SUBST(MQTT_CPPFLAGS)
3490 AC_SUBST(MQTT_LDFLAGS)
3491 AC_SUBST(MQTT_LIBS)
3492 AC_SUBST(VMGR_CPPFLAGS)
3493 AC_SUBST(VMGR_LDFLAGS)
3494 AC_SUBST(VMGR_LIBS)
3495 AC_SUBST(XEN_CPPFLAGS)
3496 AC_SUBST(XEN_LDFLAGS)
3497 AC_SUBST(XEN_LIBS)
3498 AC_SUBST(ZEROMQ_CPPFLAGS)
3499 AC_SUBST(ZEROMQ_LDFLAGS)
3500
3501 #--------------------------------------------------------------------
3502 # Shared libs versions
3503 #
3504 # versioning scheme: current:revision:age
3505 #
3506 # current
3507 # The number of the current interface exported by the library. A current
3508 # value of `0', means that you are calling the interface exported by this
3509 # library interface 0.
3510 #
3511 # revision
3512 # The implementation number of the most recent interface exported by this
3513 # library. In this case, a revision value of `0' means that this is the
3514 # first implementation of the interface.
3515 # If the next release of this library exports the same interface, but has a
3516 # different implementation (perhaps some bugs have been fixed), the revision
3517 # number will be higher, but current number will be the same. In that case,
3518 # when given a choice, the library with the highest revision will always
3519 # be used by the runtime loader.
3520 #
3521 # age
3522 # The number of previous additional interfaces supported by this library.
3523 # If age were `2', then this library can be linked into executables which
3524 # were built with a release of this library that exported the current
3525 # interface number, current, or any of the previous two interfaces.
3526 # By definition age must be less than or equal to current. At the outset,
3527 # only the first ever interface is implemented, so age can only be `0'.
3528 #--------------------------------------------------------------------
3529
3530 NETXMS_LIBRARY_VERSION=2:0:0
3531 AC_SUBST(NETXMS_LIBRARY_VERSION)
3532
3533 #--------------------------------------------------------------------
3534 # Generate output files
3535 #--------------------------------------------------------------------
3536
3537 AC_CONFIG_FILES([
3538 Makefile
3539 contrib/Makefile
3540 contrib/backgrounds/Makefile
3541 contrib/integration/Makefile
3542 contrib/integration/HP_EVA/Makefile
3543 contrib/integration/HP_P2000/Makefile
3544 contrib/mibs/Makefile
3545 contrib/music/Makefile
3546 contrib/startup/Makefile
3547 contrib/startup/systemd/Makefile
3548 contrib/startup/debian/Makefile
3549 contrib/startup/gentoo/Makefile
3550 contrib/startup/hp-ux/Makefile
3551 contrib/startup/redhat/Makefile
3552 contrib/startup/suse/Makefile
3553 contrib/startup/ubuntu/Makefile
3554 contrib/startup/solaris/Makefile
3555 contrib/templates/Makefile
3556 doc/Makefile
3557 doc/internal/Makefile
3558 doc/manuals/Makefile
3559 doc/misc/Makefile
3560 images/Makefile
3561 include/Makefile
3562 m4/Makefile
3563 src/Makefile
3564 src/agent/Makefile
3565 src/agent/core/Makefile
3566 src/agent/install/Makefile
3567 src/agent/libnxagent/Makefile
3568 src/agent/libnxappc/Makefile
3569 src/agent/libnxsd/Makefile
3570 src/agent/libnxtux/Makefile
3571 src/agent/subagents/Makefile
3572 src/agent/subagents/aix/Makefile
3573 src/agent/subagents/bind9/Makefile
3574 src/agent/subagents/darwin/Makefile
3575 src/agent/subagents/db2/Makefile
3576 src/agent/subagents/dbquery/Makefile
3577 src/agent/subagents/devemu/Makefile
3578 src/agent/subagents/ds18x20/Makefile
3579 src/agent/subagents/ecs/Makefile
3580 src/agent/subagents/filemgr/Makefile
3581 src/agent/subagents/freebsd/Makefile
3582 src/agent/subagents/gps/Makefile
3583 src/agent/subagents/hpux/Makefile
3584 src/agent/subagents/informix/Makefile
3585 src/agent/subagents/ipso/Makefile
3586 src/agent/subagents/java/Makefile
3587 src/agent/subagents/java/java/Makefile
3588 src/agent/subagents/jmx/Makefile
3589 src/agent/subagents/linux/Makefile
3590 src/agent/subagents/lmsensors/Makefile
3591 src/agent/subagents/logwatch/Makefile
3592 src/agent/subagents/minix/Makefile
3593 src/agent/subagents/mqtt/Makefile
3594 src/agent/subagents/mysql/Makefile
3595 src/agent/subagents/netbsd/Makefile
3596 src/agent/subagents/netsvc/Makefile
3597 src/agent/subagents/odbcquery/Makefile
3598 src/agent/subagents/openbsd/Makefile
3599 src/agent/subagents/oracle/Makefile
3600 src/agent/subagents/ping/Makefile
3601 src/agent/subagents/portCheck/Makefile
3602 src/agent/subagents/rpi/Makefile
3603 src/agent/subagents/sms/Makefile
3604 src/agent/subagents/ssh/Makefile
3605 src/agent/subagents/sunos/Makefile
3606 src/agent/subagents/tuxedo/Makefile
3607 src/agent/subagents/mongodb/Makefile
3608 src/agent/subagents/ubntlw/Makefile
3609 src/agent/subagents/ups/Makefile
3610 src/agent/subagents/vmgr/Makefile
3611 src/agent/subagents/winnt/Makefile
3612 src/agent/subagents/winperf/Makefile
3613 src/agent/subagents/wmi/Makefile
3614 src/agent/subagents/xen/Makefile
3615 src/agent/tools/Makefile
3616 src/agent/tools/nxappget/Makefile
3617 src/agent/tools/nxapush/Makefile
3618 src/appagent/Makefile
3619 src/client/Makefile
3620 src/client/install/Makefile
3621 src/client/libnxclient/Makefile
3622 src/client/nxalarm/Makefile
3623 src/client/nxevent/Makefile
3624 src/client/nxpush/Makefile
3625 src/client/nxshell/Makefile
3626 src/client/nxshell/java/Makefile
3627 src/client/nxsms/Makefile
3628 src/db/Makefile
3629 src/db/dbdrv/Makefile
3630 src/db/dbdrv/db2/Makefile
3631 src/db/dbdrv/informix/Makefile
3632 src/db/dbdrv/odbc/Makefile
3633 src/db/dbdrv/mariadb/Makefile
3634 src/db/dbdrv/mssql/Makefile
3635 src/db/dbdrv/mysql/Makefile
3636 src/db/dbdrv/oracle/Makefile
3637 src/db/dbdrv/pgsql/Makefile
3638 src/db/dbdrv/sqlite/Makefile
3639 src/db/libnxdb/Makefile
3640 src/install/Makefile
3641 src/install/windows/Makefile
3642 src/jansson/Makefile
3643 src/libexpat/Makefile
3644 src/libexpat/libexpat/Makefile
3645 src/libnetxms/Makefile
3646 src/libnxcc/Makefile
3647 src/libnxjava/Makefile
3648 src/libnxjava/java/Makefile
3649 src/libnxlp/Makefile
3650 src/libnxmb/Makefile
3651 src/libnxsl/Makefile
3652 src/libstrophe/Makefile
3653 src/libtre/Makefile
3654 src/libtre/win32/Makefile
3655 src/nxcproxy/Makefile
3656 src/nxlptest/Makefile
3657 src/nxscript/Makefile
3658 src/server/Makefile
3659 src/server/core/Makefile
3660 src/server/drivers/Makefile
3661 src/server/drivers/airespace/Makefile
3662 src/server/drivers/at/Makefile
3663 src/server/drivers/baystack/Makefile
3664 src/server/drivers/cat2900xl/Makefile
3665 src/server/drivers/catalyst/Makefile
3666 src/server/drivers/cisco-esw/Makefile
3667 src/server/drivers/cisco-sb/Makefile
3668 src/server/drivers/dell-pwc/Makefile
3669 src/server/drivers/dlink/Makefile
3670 src/server/drivers/ers8000/Makefile
3671 src/server/drivers/extreme/Makefile
3672 src/server/drivers/h3c/Makefile
3673 src/server/drivers/hpsw/Makefile
3674 src/server/drivers/ignitenet/Makefile
3675 src/server/drivers/juniper/Makefile
3676 src/server/drivers/lib/Makefile
3677 src/server/drivers/lib/avaya-ers/Makefile
3678 src/server/drivers/lib/cisco/Makefile
3679 src/server/drivers/mikrotik/Makefile
3680 src/server/drivers/netonix/Makefile
3681 src/server/drivers/netscreen/Makefile
3682 src/server/drivers/ntws/Makefile
3683 src/server/drivers/ping3/Makefile
3684 src/server/drivers/procurve/Makefile
3685 src/server/drivers/qtech-olt/Makefile
3686 src/server/drivers/symbol-ws/Makefile
3687 src/server/drivers/tb/Makefile
3688 src/server/drivers/ubnt/Makefile
3689 src/server/hdlink/Makefile
3690 src/server/hdlink/jira/Makefile
3691 src/server/hdlink/redmine/Makefile
3692 src/server/include/Makefile
3693 src/server/libnxsrv/Makefile
3694 src/server/netxmsd/Makefile
3695 src/server/pdsdrv/Makefile
3696 src/server/pdsdrv/rrdtool/Makefile
3697 src/server/tools/Makefile
3698 src/server/tools/nxaction/Makefile
3699 src/server/tools/nxadm/Makefile
3700 src/server/tools/nxap/Makefile
3701 src/server/tools/nxconfig/Makefile
3702 src/server/tools/nxconfig/res/Makefile
3703 src/server/tools/nxdbmgr/Makefile
3704 src/server/tools/nxget/Makefile
3705 src/server/tools/nxminfo/Makefile
3706 src/server/tools/nxupload/Makefile
3707 src/smsdrv/Makefile
3708 src/smsdrv/anysms/Makefile
3709 src/smsdrv/dbemu/Makefile
3710 src/smsdrv/dummy/Makefile
3711 src/smsdrv/generic/Makefile
3712 src/smsdrv/kannel/Makefile
3713 src/smsdrv/mymobile/Makefile
3714 src/smsdrv/nexmo/Makefile
3715 src/smsdrv/nxagent/Makefile
3716 src/smsdrv/portech/Makefile
3717 src/smsdrv/slack/Makefile
3718 src/smsdrv/smseagle/Makefile
3719 src/smsdrv/text2reach/Makefile
3720 src/smsdrv/websms/Makefile
3721 src/snmp/Makefile
3722 src/snmp/libnxsnmp/Makefile
3723 src/snmp/nxmibc/Makefile
3724 src/snmp/nxsnmpget/Makefile
3725 src/snmp/nxsnmpset/Makefile
3726 src/snmp/nxsnmpwalk/Makefile
3727 src/sqlite/Makefile
3728 src/tools/Makefile
3729 src/tools/nxdevcfg/Makefile
3730 src/tools/nxencpasswd/Makefile
3731 src/tools/nxgenguid/Makefile
3732 src/zlib/Makefile
3733 sql/Makefile
3734 tests/Makefile
3735 tests/include/Makefile
3736 tests/test-libnetxms/Makefile
3737 tests/test-libnxcc/Makefile
3738 tests/test-libnxdb/Makefile
3739 tests/test-libnxsnmp/Makefile
3740 tools/Makefile
3741 ])
3742
3743 AC_OUTPUT
3744
3745 echo "Updating libtool"
3746 sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
3747
3748 # On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
3749 if test "x$ac_compiler_gnu" = "xyes" && test "x$PLATFORM" = "xHP-UX"; then
3750 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
3751 fi
3752
3753 # On AIX, correct OBJECT_MODE must be set before linking
3754 # To avoid manual setting by user, we add this to libtool script
3755 if test "x$PLATFORM" = "xAIX"; then
3756 head -n 1 ./libtool > ./libtool.new
3757 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
3758 tail -n +2 ./libtool >> ./libtool.new
3759 mv libtool.new libtool
3760 chmod +x ./libtool
3761 fi
3762
3763 #--------------------------------------------------------------------
3764 # Print summary
3765 #--------------------------------------------------------------------
3766
3767 echo
3768 echo
3769 echo
3770 echo '---------------------------------------------------------------------'
3771 echo ' Configure results'
3772 echo '---------------------------------------------------------------------'
3773 echo
3774 echo "Prefix : ${prefix}"
3775 echo "Platform : ${PLATFORM}"
3776 echo "Shared library suffix : ${SHLIB_SUFFIX}"
3777 if test "x$IPV6_SUPPORT" = "xyes"; then
3778 echo "IPv6 support : YES"
3779 else
3780 echo "IPv6 support : NO"
3781 fi
3782 if test "x${MQTT_SUPPORT}" = "xyes"; then
3783 echo "MQTT support : YES"
3784 else
3785 echo "MQTT support : NO"
3786 fi
3787 if test "x${BUILD_SERVER}" = "xyes"; then
3788 echo "Build Server : YES"
3789 echo "Server libs : ${SERVER_LIBS}"
3790 if test "x${LDAP_SUPPORT}" = "xyes"; then
3791 echo "LDAP support : YES"
3792 else
3793 echo "LDAP support : NO"
3794 fi
3795 if test "x${XMPP_SUPPORT}" = "xyes"; then
3796 echo "XMPP support : YES"
3797 else
3798 echo "XMPP support : NO"
3799 fi
3800 if test "x${ZEROMQ_SUPPORT}" = "xyes"; then
3801 echo "ZeroMQ support : YES"
3802 else
3803 echo "ZeroMQ support : NO"
3804 fi
3805 else
3806 echo "Build Server : NO"
3807 fi
3808 if test "x${WITH_ENCRYPTION}" = "xyes"; then
3809 echo "Encryption enabled : YES"
3810 else
3811 echo "Encryption enabled : NO"
3812 fi
3813 if test "x${HAVE_LIBSSH}" = "xyes"; then
3814 echo "SSH support enabled : YES"
3815 else
3816 echo "SSH support enabled : NO"
3817 fi
3818 if test "x${DB_DRIVERS}" != "x"; then
3819 echo "Build DB-Drivers :${DB_DRIVERS}"
3820 else
3821 echo "Build DB-Drivers : NO"
3822 fi
3823 if test "x${BUILD_CLIENT}" = "xyes"; then
3824 echo "Build Clients : YES"
3825 else
3826 echo "Build Clients : NO"
3827 fi
3828 if test "x${BUILD_AGENT}" = "xyes"; then
3829 echo "Build Agent : YES"
3830 echo "Agent extra components : ${AGENT_DIRS}"
3831 echo "Subagents list : ${SUBAGENT_DIRS}"
3832 else
3833 echo "Build Agent : NO"
3834 fi
3835 if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
3836 echo "Build Static Agent : YES"
3837 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
3838 else
3839 echo "Build Static Agent : NO"
3840 fi
3841 if test "x${BUILD_UNICODE}" = "xyes"; then
3842 echo "UNICODE build : YES"
3843 else
3844 echo "UNICODE build : NO"
3845 fi
3846 if test "x${HAVE_LIBEXPAT}" = "xno"; then
3847 echo "Use internal libexpat : YES"
3848 else
3849 echo "Use internal libexpat : NO"
3850 fi
3851 if test "x${HAVE_LIBTRE}" = "xno"; then
3852 echo "Use internal libtre : YES"
3853 else
3854 echo "Use internal libtre : NO"
3855 fi
3856 if test "x${HAVE_JANSSON}" = "xno"; then
3857 echo "Use internal libjansson : YES"
3858 else
3859 echo "Use internal libjansson : NO"
3860 fi
3861 check_substr "$COMPONENTS" "sqlite"
3862 if test $? = 0; then
3863 if test "x${HAVE_SQLITE}" = "xno"; then
3864 echo "Use internal sqlite : YES"
3865 else
3866 echo "Use internal sqlite : NO"
3867 fi
3868 fi
3869 if test "x${HAVE_ZLIB}" = "xno"; then
3870 echo "Use internal zlib : YES"
3871 else
3872 echo "Use internal zlib : NO"
3873 fi
3874 if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
3875 echo "Force 32bit build : YES"
3876 else
3877 echo "Force 32bit build : NO"
3878 fi
3879
3880 echo "C compiler : ${CC}"
3881 echo "C++ compiler : ${CXX}"
3882 echo "C++ compiler info : ${COMPILER_VERSION}"
3883 echo "CPPFLAGS : ${CPPFLAGS}"
3884 echo "CXXFLAGS : ${CXXFLAGS}"
3885 echo "CFLAGS : ${CFLAGS}"
3886 echo "LDFLAGS : ${LDFLAGS}"
3887 echo "LIBS : ${LIBS}"
3888
3889 if test "x${MYSQL_CPPFLAGS}" != "x"; then
3890 echo "MySQL CPPFLAGS : ${MYSQL_CPPFLAGS}"
3891 fi
3892 if test "x${MYSQL_LDFLAGS}" != "x"; then
3893 echo "MySQL LDFLAGS : ${MYSQL_LDFLAGS}"
3894 fi
3895 if test "x${MYSQL_LIBS}" != "x"; then
3896 echo "MySQL LIBS : ${MYSQL_LIBS}"
3897 fi
3898
3899 if test "x${MARIADB_CPPFLAGS}" != "x"; then
3900 echo "MariaDB CPPFLAGS : ${MARIADB_CPPFLAGS}"
3901 fi
3902 if test "x${MARIADB_LDFLAGS}" != "x"; then
3903 echo "MariaDB LDFLAGS : ${MARIADB_LDFLAGS}"
3904 fi
3905 if test "x${MARIADB_LIBS}" != "x"; then
3906 echo "MariaDB LIBS : ${MARIADB_LIBS}"
3907 fi
3908
3909 if test "x${PGSQL_CPPFLAGS}" != "x"; then
3910 echo "PostgreSQL CPPFLAGS : ${PGSQL_CPPFLAGS}"
3911 fi
3912 if test "x${PGSQL_LDFLAGS}" != "x"; then
3913 echo "PostgreSQL LDFLAGS : ${PGSQL_LDFLAGS}"
3914 fi
3915 if test "x${PGSQL_LIBS}" != "x"; then
3916 echo "PostgreSQL LIBS : ${PGSQL_LIBS}"
3917 fi
3918
3919 if test "x${ORACLE_CPPFLAGS}" != "x"; then
3920 echo "Oracle CPPFLAGS : ${ORACLE_CPPFLAGS}"
3921 fi
3922 if test "x${ORACLE_LDFLAGS}" != "x"; then
3923 echo "Oracle LDFLAGS : ${ORACLE_LDFLAGS}"
3924 fi
3925 if test "x${ORACLE_LIBS}" != "x"; then
3926 echo "Oracle LIBS : ${ORACLE_LIBS}"
3927 fi
3928
3929 if test "x${ODBC_CPPFLAGS}" != "x"; then
3930 echo "ODBC CPPFLAGS : ${ODBC_CPPFLAGS}"
3931 fi
3932 if test "x${ODBC_LDFLAGS}" != "x"; then
3933 echo "ODBC LDFLAGS : ${ODBC_LDFLAGS}"
3934 fi
3935 if test "x${ODBC_LIBS}" != "x"; then
3936 echo "ODBC LIBS : ${ODBC_LIBS}"
3937 fi
3938
3939 if test "x${DB2_CPPFLAGS}" != "x"; then
3940 echo "DB2 CPPFLAGS : ${DB2_CPPFLAGS}"
3941 fi
3942 if test "x${DB2_LDFLAGS}" != "x"; then
3943 echo "DB2 LDFLAGS : ${DB2_LDFLAGS}"
3944 fi
3945 if test "x${DB2_LIBS}" != "x"; then
3946 echo "DB2 LIBS : ${DB2_LIBS}"
3947 fi
3948
3949 if test "x${INFORMIX_CPPFLAGS}" != "x"; then
3950 echo "Informix CPPFLAGS : ${INFORMIX_CPPFLAGS}"
3951 fi
3952 if test "x${INFORMIX_LDFLAGS}" != "x"; then
3953 echo "Informix LDFLAGS : ${INFORMIX_LDFLAGS}"
3954 fi
3955 if test "x${INFORMIX_LIBS}" != "x"; then
3956 echo "Informix LIBS : ${INFORMIX_LIBS}"
3957 fi
3958
3959 if test "x${TUXEDO_CPPFLAGS}" != "x"; then
3960 echo "Tuxedo CPPFLAGS : ${TUXEDO_CPPFLAGS}"
3961 fi
3962 if test "x${TUXEDO_LDFLAGS}" != "x"; then
3963 echo "Tuxedo LDFLAGS : ${TUXEDO_LDFLAGS}"
3964 fi
3965 if test "x${TUXEDO_LIBS}" != "x"; then
3966 echo "Tuxedo LIBS : ${TUXEDO_LIBS}"
3967 fi
3968
3969 if test "x${MONGODB_CPPFLAGS}" != "x"; then
3970 echo "MongoDB CPPFLAGS : ${MONGODB_CPPFLAGS}"
3971 fi
3972 if test "x${MONGODB_LDFLAGS}" != "x"; then
3973 echo "MongoDB LDFLAGS : ${MONGODB_LDFLAGS}"
3974 fi
3975
3976 if test "x${ZEROMQ_CPPFLAGS}" != "x"; then
3977 echo "ZeroMQ CPPFLAGS : ${ZEROMQ_CPPFLAGS}"
3978 fi
3979 if test "x${ZEROMQ_LDFLAGS}" != "x"; then
3980 echo "ZeroMQ LDFLAGS : ${ZEROMQ_LDFLAGS}"
3981 fi
3982
3983 if test "x${VMGR_CPPFLAGS}" != "x"; then
3984 echo "Vmgr CPPFLAGS : ${VMGR_CPPFLAGS}"
3985 fi
3986 if test "x${VMGR_LDFLAGS}" != "x"; then
3987 echo "Vmgr LDFLAGS : ${VMGR_LDFLAGS}"
3988 fi
3989 if test "x${VMGR_LIBS}" != "x"; then
3990 echo "Vmgr LIBS : ${VMGR_LIBS}"
3991 fi
3992
3993 if test "x${XEN_CPPFLAGS}" != "x"; then
3994 echo "XEN CPPFLAGS : ${XEN_CPPFLAGS}"
3995 fi
3996 if test "x${XEN_LDFLAGS}" != "x"; then
3997 echo "XEN LDFLAGS : ${XEN_LDFLAGS}"
3998 fi
3999 if test "x${XEN_LIBS}" != "x"; then
4000 echo "XEN LIBS : ${XEN_LIBS}"
4001 fi
4002
4003 FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
4004 echo "/* Automatically generated by configure */" > $FLAGS_CPP
4005 echo "#include <nms_common.h>" >> $FLAGS_CPP
4006 echo "const TCHAR *g_cppFlags = _T(\"${CPPFLAGS}\");" >> $FLAGS_CPP
4007 echo "const TCHAR *g_cFlags = _T(\"${CFLAGS}\");" >> $FLAGS_CPP
4008 echo "const TCHAR *g_cxxFlags = _T(\"${CXXFLAGS}\");" >> $FLAGS_CPP
4009 echo "const TCHAR *g_ldFlags = _T(\"${LDFLAGS}\");" >> $FLAGS_CPP
4010 echo "const TCHAR *g_libs = _T(\"${LIBS}\");" >> $FLAGS_CPP
4011 echo "const TCHAR *g_cc = _T(\"${CC}\");" >> $FLAGS_CPP
4012 echo "const TCHAR *g_cxx = _T(\"${CXX}\");" >> $FLAGS_CPP
4013 echo "const TCHAR *g_ld = _T(\"${LD}\");" >> $FLAGS_CPP
4014 echo "const TCHAR *g_perl = _T(\"${PERL}\");" >> $FLAGS_CPP
4015 echo "const TCHAR *g_serverLibs = _T(\"${SERVER_LIBS}\");" >> $FLAGS_CPP
4016 echo "const TCHAR *g_tuxedoCppFlags = _T(\"${TUXEDO_CPPFLAGS}\");" >> $FLAGS_CPP
4017 echo "const TCHAR *g_tuxedoLdFlags = _T(\"${TUXEDO_LDFLAGS}\");" >> $FLAGS_CPP
4018 echo "const TCHAR *g_tuxedoLibs = _T(\"${TUXEDO_LIBS}\");" >> $FLAGS_CPP