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