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