additional methods in ClientSession for flags access
[public/netxms.git] / configure.ac
CommitLineData
8e76f8aa 1# $Id$
d16cf8a5 2#
ef0c727b
VK
3# NetXMS - Network Management System
4# Configure script
d16cf8a5
AK
5#
6
8c2489aa 7AC_INIT([NetXMS], [1.2.14], [bugs@netxms.org])
ba1d810c 8AC_CONFIG_AUX_DIR(config)
8e7f84bf 9AC_CONFIG_HEADERS(config.h)
d16cf8a5 10AM_INIT_AUTOMAKE
09867021 11m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
d16cf8a5 12
aa24418a 13AC_CONFIG_MACRO_DIR([m4])
5387ff75 14
ef0c727b
VK
15#--------------------------------------------------------------------
16# Functions
17#--------------------------------------------------------------------
5387ff75 18
ef0c727b
VK
19check_substr()
20{
1010cff7 21 for w in $1; do
ef0c727b
VK
22 if test "x$w" = "x$2"; then
23 return 0;
24 fi
25 done
26 return 1
27}
16dff090 28
d3c8926d 29
ef0c727b
VK
30#--------------------------------------------------------------------
31# Initialize variables
32#--------------------------------------------------------------------
d3c8926d 33
ef0c727b 34PLATFORM=`uname -s`
c3900dbb 35CPUTYPE=`uname -p`
ef0c727b
VK
36COMPONENTS=""
37DISABLE_ICONV="no"
38DISABLE_ENCRYPTION="no"
4050bafb 39DISABLE_LMSENSORS="no"
f974a50a 40ENABLE_DEBUG="no"
25ae8377 41ENABLE_WERROR="no"
ef0c727b 42STATIC_BUILD="no"
c1165d33 43ALL_STATIC="no"
ef0c727b
VK
44DBDRIVER_SELECTED="no"
45USE_PTH="no"
46BUILD_SERVER="no"
47BUILD_AGENT="no"
48BUILD_CLIENT="no"
ef0c727b 49BUILD_STATIC_AGENT="no"
447350a9 50BUILD_SDK="no"
ef0c727b 51NEED_ZLIB="no"
f65df2b1 52MODULES="libnetxms tools install"
ef0c727b 53STATIC_SUBAGENT_LIST=""
c1165d33 54PROPOSED_STATIC_SUBAGENTS="default"
ef0c727b
VK
55SUBAGENT_DIRS=""
56SUBAGENT_LIBS=""
7c48e2aa 57SERVER_LIBS=""
ef0c727b 58SERVER_TOOLS=""
7dda4453 59SERVER_INCLUDE=""
31b0f68b 60SMSDRV_DIRS=""
6fad8870 61HDLINK_DIRS=""
ef0c727b
VK
62TOP_LEVEL_MODULES=""
63CONTRIB_MODULES=""
c2612d83 64CLIENT_COMPONENTS=""
8b86c5dc 65BUILD_UNICODE="no"
7d8c91ef 66ORACLE_LIBS=""
6fce76d8
VK
67PGSQL_LIBS=""
68MYSQL_LIBS=""
69ODBC_LIBS=""
467c489f 70FORCE_INTERNAL_EXPAT="no"
17b35ccc
VK
71USE_INTERNAL_LIBTRE="no"
72FORCE_INTERNAL_LIBTRE="no"
f5393033 73FORCE_INTERNAL_JANSSON="no"
1fd41bcd 74FORCE_INTERNAL_ZLIB="no"
cc297a70 75FORCE_32BIT_BUILD="no"
df9812a9 76FORCE_INTERNAL_GETOPT="no"
545bda2d
VK
77LDFLAGS_PREFIX=""
78LDFLAGS_SUFFIX=""
1ef5e57a
VK
79LTINIT_CC=""
80LTINIT_CXX=""
9113e749 81SQLFLAGS=""
a5a95ac8 82RUNTIME_PREFIX=""
6dde8627 83HPUX_HPPA="no"
058bf6fc 84XMPP_SUPPORT="yes"
d3c8926d 85
16dff090 86
ef0c727b 87#--------------------------------------------------------------------
fecf6a2b
VK
88# Common compilation flags
89#--------------------------------------------------------------------
90
842c22f4 91CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DTRE_WCHAR=1"
fecf6a2b
VK
92
93
94#--------------------------------------------------------------------
ef0c727b
VK
95# Parse command line parameters
96#--------------------------------------------------------------------
7c9c94a7 97
a5a95ac8 98AC_ARG_WITH(runtime-prefix,
125543aa 99[AS_HELP_STRING(--with-runtime-prefix=prefix,installation prefix to be used at run time)],
a5a95ac8
VK
100[
101 RUNTIME_PREFIX="$withval"
102])
103
ef0c727b
VK
104AC_ARG_WITH(server,
105[AS_HELP_STRING(--with-server,build server)],
106[
8817f620 107 COMPONENTS="$COMPONENTS sqlite snmp server agent"
c5c0f362
VK
108])
109
110AC_ARG_WITH(snmp,
111[AS_HELP_STRING(--with-snmp,build SNMP library and tools)],
112[
113 COMPONENTS="$COMPONENTS snmp"
ef0c727b 114])
7c9c94a7 115
ef0c727b
VK
116AC_ARG_WITH(client,
117[AS_HELP_STRING(--with-client,build client library and tools)],
118[
119 COMPONENTS="$COMPONENTS client"
120])
d16cf8a5 121
a7a03ffd
VK
122AC_ARG_WITH(client-proxy,
123[AS_HELP_STRING(--with-client-proxy,build client proxy)],
124[
125 COMPONENTS="$COMPONENTS client-proxy"
126])
127
c2612d83 128AC_ARG_WITH(agent,
ef0c727b
VK
129[AS_HELP_STRING(--with-agent,build agent)],
130[
8817f620 131 COMPONENTS="$COMPONENTS sqlite agent"
ef0c727b 132])
d16cf8a5 133
ef0c727b
VK
134AC_ARG_WITH(static-agent,
135[AS_HELP_STRING(--with-static-agent,build statically linked agent)],
136[
8817f620 137 COMPONENTS="$COMPONENTS sqlite static-agent"
ef0c727b 138])
d16cf8a5 139
ef0c727b
VK
140AC_ARG_WITH(ipso-agent,
141[AS_HELP_STRING(--with-ipso-agent,build statically linked IPSO agent)],
142[
971abf4f 143 COMPONENTS="$COMPONENTS ipso-agent"
ef0c727b 144])
521d90e7 145
7dda4453
VK
146AC_ARG_WITH(sdk,
147[AS_HELP_STRING(--with-sdk,build and install files necessary for extension development)],
148[
b550188f 149 COMPONENTS="$COMPONENTS sqlite sdk"
7dda4453
VK
150 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES include"
151 SERVER_INCLUDE="include"
447350a9 152 BUILD_SDK="yes"
4671448c
VK
153])
154
155AC_ARG_WITH(static-sdk,
156[AS_HELP_STRING(--with-static-sdk,build and install files necessary for extension development (static libs only))],
157[
b550188f 158 COMPONENTS="$COMPONENTS sqlite sdk"
4671448c
VK
159 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES include"
160 SERVER_INCLUDE="include"
161 BUILD_SDK="yes"
162 STATIC_BUILD="yes"
7dda4453
VK
163])
164
ef0c727b
VK
165AC_ARG_WITH(mdebug,
166[AS_HELP_STRING(--with-mdebug,use debug version of memory allocation functions)],
167[
168 CPPFLAGS="$CPPFLAGS -DNETXMS_MEMORY_DEBUG"
169])
d16cf8a5 170
b82ad936
AK
171AC_ARG_WITH(profiler,
172[AS_HELP_STRING(--with-profiler,link with libprofiler from gperftools)],
173[
174 LDFLAGS="$LDFLAGS -lprofiler"
175])
176
467c489f
VK
177AC_ARG_WITH(internal-libexpat,
178[AS_HELP_STRING(--with-internal-libexpat,force use of bundled libexpat)],
179[
180 FORCE_INTERNAL_EXPAT="yes"
181])
182
17b35ccc
VK
183AC_ARG_WITH(internal-libtre,
184[AS_HELP_STRING(--with-internal-libtre,force use of bundled libtre)],
185[
186 FORCE_INTERNAL_LIBTRE="yes"
187])
188
f5393033
VK
189AC_ARG_WITH(internal-libjansson,
190[AS_HELP_STRING(--with-internal-libjansson,force use of bundled libjansson)],
191[
192 FORCE_INTERNAL_JANSSON="yes"
193])
194
1fd41bcd
VK
195AC_ARG_WITH(internal-zlib,
196[AS_HELP_STRING(--with-internal-zlib,force use of bundled zlib)],
197[
198 FORCE_INTERNAL_ZLIB="yes"
199])
200
df9812a9
VK
201AC_ARG_WITH(internal-getopt,
202[AS_HELP_STRING(--with-internal-getopt,force use of bundled getopt)],
203[
204 FORCE_INTERNAL_GETOPT="yes"
205])
206
c1165d33
VK
207AC_ARG_WITH(all-static,
208[AS_HELP_STRING(--with-all-static,use -all-static flag for linking executables)],
209[
210 ALL_STATIC="yes"
211])
212
213AC_ARG_WITH(static-subagents,
214[AS_HELP_STRING(--with-static-subagents=list,define list of static subagents (separated by spaces))],
215[
216 PROPOSED_STATIC_SUBAGENTS="$withval"
217])
218
50e4bc8c
VK
219AC_ARG_WITH(jdk,
220[AS_HELP_STRING(--with-jdk,build Java-dependent components)],
221[ if test "x$withval" != "xno" ; then
222 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
223 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
224 LDFLAGS="$LDFLAGS -L${withval}/lib"
225 CPPFLAGS="$CPPFLAGS -I${withval}/include"
226 fi
227 COMPONENTS="$COMPONENTS java"
228fi ])
229
9486b324
VK
230AC_ARG_WITH(sqlite,
231[AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
232[ if test "x$withval" != "xno" ; then
8817f620 233 COMPONENTS="$COMPONENTS sqlite_drv"
ef0c727b 234 DBDRIVER_SELECTED="yes"
9486b324
VK
235fi ])
236
c4b88c3d
VK
237AC_ARG_WITH(odbc,
238[AS_HELP_STRING(--with-odbc,build ODBC database driver)],
239[ if test "x$withval" != "xno" ; then
240 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
241 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
242 LDFLAGS="$LDFLAGS -L${withval}/lib"
243 CPPFLAGS="$CPPFLAGS -I${withval}/include"
ef0c727b
VK
244 fi
245 COMPONENTS="$COMPONENTS odbc"
246 DBDRIVER_SELECTED="yes"
c4b88c3d
VK
247fi ])
248
ed77e726 249AC_ARG_WITH(oracle,
41b4790d
VK
250[AS_HELP_STRING(--with-oracle,build Oracle database driver)],
251[ if test "x$withval" != "xno" ; then
252 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
7d8c91ef
VK
253 if test -x "$withval/lib" ; then
254 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
255 LDFLAGS="$LDFLAGS -L${withval}/lib"
256 else
257 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
258 LDFLAGS="$LDFLAGS -L${withval}"
259 fi
260 if test -x "$withval/include" ; then
261 CPPFLAGS="$CPPFLAGS -I${withval}/include"
262 fi
263 if test -x "$withval/sdk/include" ; then
264 CPPFLAGS="$CPPFLAGS -I${withval}/sdk/include"
265 fi
41b4790d
VK
266 fi
267 COMPONENTS="$COMPONENTS oracle"
268 DBDRIVER_SELECTED="yes"
269fi ])
270
d16cf8a5 271AC_ARG_WITH(mysql,
c4b88c3d 272[AS_HELP_STRING(--with-mysql,build MySQL database driver)],
d16cf8a5
AK
273[ if test "x$withval" != "xno" ; then
274 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
275 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
276 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib"
6693a1d0 277 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
d16cf8a5 278 else
007ae516
VK
279 LD_RUN_PATH="/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:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
280 LDFLAGS="$LDFLAGS -L/usr/local/mysql/lib -L/usr/lib64/mysql -L/usr/lib/mysql -L/usr/mysql/lib -L/usr/local/lib/mysql -L/usr/local/mysql/lib/mysql -L/usr/mysql/lib/mysql"
6693a1d0 281 CPPFLAGS="$CPPFLAGS -I/usr/local/mysql/include -I/usr/include/mysql -I/usr/mysql/include -I/usr/local/include/mysql -I/usr/local/mysql/include/mysql -I/usr/mysql/include/mysql"
d16cf8a5 282 fi
ef0c727b
VK
283 COMPONENTS="$COMPONENTS mysql"
284 DBDRIVER_SELECTED="yes"
6693a1d0 285fi ])
d16cf8a5
AK
286
287AC_ARG_WITH(pgsql,
c4b88c3d 288[AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
d16cf8a5 289[ if test "x$withval" != "xno" ; then
6693a1d0
AK
290 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
291 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
292 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"
293 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"
294 else
007ae516
VK
295 LD_RUN_PATH="/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:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
296 LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib -L/usr/lib64/pgsql -L/usr/lib/pgsql -L/usr/pgsql/lib -L/usr/local/lib/pgsql -L/usr/local/pgsql/lib/pgsql -L/usr/pgsql/lib/pgsql -L/usr/local/postgresql/lib -L/usr/lib/postgresql -L/usr/postgresql/lib -L/usr/local/lib/postgresql -L/usr/local/postgresql/lib/postgresql -L/usr/postgresql/lib/postgresql"
6693a1d0
AK
297 CPPFLAGS="$CPPFLAGS -I/usr/local/pgsql/include -I/usr/include/pgsql -I/usr/pgsql/include -I/usr/local/include/pgsql -I/usr/local/pgsql/include/pgsql -I/usr/pgsql/include/pgsql -I/usr/local/postgresql/include -I/usr/include/postgresql -I/usr/postgresql/include -I/usr/local/include/postgresql -I/usr/local/postgresql/include/postgresql -I/usr/postgresql/include/postgresql"
298 fi
ef0c727b
VK
299 COMPONENTS="$COMPONENTS pgsql"
300 DBDRIVER_SELECTED="yes"
6693a1d0 301fi ])
d16cf8a5 302
84277a0f
AK
303AC_ARG_WITH(db2,
304[AS_HELP_STRING(--with-db2,build DB2 database driver)],
305[ if test "x$withval" != "xno" ; then
306 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
307 if test `uname -m` = 'i386' || test `uname -m` = 'i686'; then
308 DB2_LIB_DIR=lib32
309 else
310 DB2_LIB_DIR=lib64
311 fi
312 if test -x "$withval/${DB2_LIB_DIR}" ; then
313 LD_RUN_PATH="${withval}/${DB2_LIB_DIR}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
314 LDFLAGS="$LDFLAGS -L${withval}/${DB2_LIB_DIR}"
315 else
316 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
317 LDFLAGS="$LDFLAGS -L${withval}"
318 fi
319 if test -x "$withval/include" ; then
320 CPPFLAGS="$CPPFLAGS -I${withval}/include"
321 fi
322
323 unset DB2_LIB_DIR
324 fi
325 COMPONENTS="$COMPONENTS db2"
326 DBDRIVER_SELECTED="yes"
327fi ])
328
37861c72
VK
329AC_ARG_WITH(informix,
330[AS_HELP_STRING(--with-informix,build Informix database driver)],
331[ if test "x$withval" != "xno" ; then
332 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
333 if test -x "$withval/lib/cli" ; then
334 LD_RUN_PATH="${withval}/lib/cli${LD_RUN_PATH:+:}${LD_RUN_PATH}"
335 LDFLAGS="$LDFLAGS -L${withval}/lib/cli"
336 if test -x "$withval/lib/esql" ; then
337 LD_RUN_PATH="${withval}/lib/esql${LD_RUN_PATH:+:}${LD_RUN_PATH}"
338 LDFLAGS="$LDFLAGS -L${withval}/lib/esql"
339 fi
340 else
341 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
342 LDFLAGS="$LDFLAGS -L${withval}"
343 fi
344 if test -x "$withval/incl/cli" ; then
345 CPPFLAGS="$CPPFLAGS -I${withval}/incl/cli"
346 fi
347 fi
348 COMPONENTS="$COMPONENTS informix"
349 DBDRIVER_SELECTED="yes"
350fi ])
351
ef0c727b 352AC_ARG_WITH(openssl,
1010cff7
VK
353[AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
354[
355 if test "x$withval" != "xno" ; then
356 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
357 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
358 LDFLAGS="$LDFLAGS -L${withval}/lib"
359 CPPFLAGS="$CPPFLAGS -I${withval}/include"
360 else
361 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
362 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
4d37b0c5 363 CPPFLAGS="$CPPFLAGS -I/opt/openssl/include"
ef0c727b 364 fi
1010cff7 365 fi
1010cff7 366])
ef0c727b
VK
367
368AC_ARG_ENABLE(iconv,
369[AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)],
3a7ce527 370[
ef0c727b 371 DISABLE_ICONV="yes"
3a7ce527 372])
3a7ce527 373
ef0c727b
VK
374AC_ARG_ENABLE(encryption,
375[AS_HELP_STRING(--disable-encryption,disable encryption support)],
e0760102 376[
ef0c727b 377 DISABLE_ENCRYPTION="yes"
058bf6fc 378 XMPP_SUPPORT="no"
e0760102
VK
379])
380
4050bafb
VK
381AC_ARG_ENABLE(lmsensors,
382[AS_HELP_STRING(--disable-lmsensors,disable lmsensors support)],
383[
384 DISABLE_LMSENSORS="yes"
385])
386
058bf6fc
VK
387AC_ARG_ENABLE(xmpp,
388[AS_HELP_STRING(--disable-xmpp,disable XMPP support)],
389[
390 XMPP_SUPPORT="no"
391])
392
a67fa146
VK
393AC_ARG_ENABLE(unicode,
394[AS_HELP_STRING(--enable-unicode,enable UNICODE build)],
395[
396 BUILD_UNICODE="yes"
842c22f4 397 CPPFLAGS="$CPPFLAGS -DUNICODE"
76b1d3d8 398 FORCE_INTERNAL_LIBTRE="yes"
a67fa146
VK
399])
400
f974a50a
VK
401AC_ARG_ENABLE(debug,
402[AS_HELP_STRING(--enable-debug,enable additional debugging functionality)],
403[
404 ENABLE_DEBUG="yes"
405])
406
25ae8377
VK
407AC_ARG_ENABLE(werror,
408[AS_HELP_STRING(--enable-werror,threat all warnings as errors)],
409[
410 ENABLE_WERROR="yes"
411])
412
cc297a70 413AC_ARG_ENABLE(64bit,
e5be5b83 414[AS_HELP_STRING(--disable-64bit,disable 64bit build (force 32bit build on 64bit machine))],
cc297a70
VK
415[
416 FORCE_32BIT_BUILD="yes"
417])
418
ef0c727b
VK
419AC_ARG_WITH(dist,
420[AS_HELP_STRING(--with-dist,for maintainers only)],
87f1fff0 421 DB_DRIVERS=" mysql pgsql odbc mssql sqlite oracle db2 informix"
f5393033 422 MODULES="jansson libexpat libstrophe libtre zlib libnetxms install sqlite snmp libnxsl libnxlp db server agent libnxmap libnxcl client nxscript nxcproxy tools"
6afe141e 423 SUBAGENT_DIRS="linux freebsd openbsd netbsd sunos aix ipso hpux odbcquery informix oracle lmsensors darwin rpi java netsvc db2"
31b0f68b 424 SMSDRV_DIRS="websms"
6fad8870 425 HDLINK_DIRS="jira"
ef0c727b 426 NXCONFIG="nxconfig"
7dda4453
VK
427 TOP_LEVEL_MODULES="include sql images"
428 SERVER_INCLUDE="include"
ef0c727b 429 CONTRIB_MODULES="mibs backgrounds"
9cb6c12f 430 CLIENT_COMPONENTS="nxalarm nxevent nxlexer nxpush nxsms scilexer windows"
ef0c727b
VK
431 SERVER_TOOLS="nxconfig"
432)
433
247f8a6c
AK
434AC_ARG_WITH(rpi-agent,
435[AS_HELP_STRING(--with-rpi-agent,build Raspberry Pi agent)],
436[
437 COMPONENTS="$COMPONENTS raspberrypi"
438])
439
d8ca9c03 440
ef0c727b 441#--------------------------------------------------------------------
12313882
VK
442# Set LD_LIBRARY_PATH from LD_RUN_PATH because on some systems
443# LD_RUN_PATH ignored by linker and some tests may fail
444#--------------------------------------------------------------------
445
446if test "x$LD_RUN_PATH" != "x"; then
447 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}${LD_RUN_PATH}"
448 export LD_LIBRARY_PATH
449fi
450
451
452#--------------------------------------------------------------------
ef0c727b
VK
453# Validate command line parameters and set various checking options
454#--------------------------------------------------------------------
455
8817f620
VK
456check_substr "$COMPONENTS" "sqlite"
457if test $? = 0; then
458 MODULES="$MODULES sqlite"
459fi
460
ef0c727b 461check_substr "$COMPONENTS" "static-agent"
1010cff7 462if test $? = 0; then
971abf4f
VK
463 if test "x$COMPONENTS" != "x sqlite static-agent"; then
464 AC_MSG_ERROR(Static agent and other components are mutually exclusive.)
ef0c727b
VK
465 fi
466 STATIC_BUILD="yes"
467 BUILD_STATIC_AGENT="yes"
60a1159a 468 MODULES="$MODULES libnxlp db agent"
3a6979cf 469 DISABLE_ICONV="yes"
ef0c727b 470 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
c1165d33
VK
471 if test "x$PROPOSED_STATIC_SUBAGENTS" = "xdefault"; then
472 STATIC_SUBAGENT_LIST="ecs logwatch ping portcheck ups"
473 else
474 STATIC_SUBAGENT_LIST="$PROPOSED_STATIC_SUBAGENTS"
475 fi
60a1159a 476
c1165d33 477 SUBAGENT_LIBS="../subagents/ecs/ecs.la ../subagents/logwatch/logwatch.la ../subagents/ping/ping.la ../subagents/portCheck/portcheck.la ../subagents/ups/ups.la"
e8636669 478
60a1159a
VK
479 check_substr "$STATIC_SUBAGENT_LIST" "odbcquery"
480 if test $? = 0; then
481 COMPONENTS="$COMPONENTS odbc"
482 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/odbcquery/odbcquery.la"
483 fi
484
485 check_substr "$STATIC_SUBAGENT_LIST" "oracle"
486 if test $? = 0; then
487 COMPONENTS="$COMPONENTS oracle"
488 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/oracle/oracle.la"
489 fi
490
6afe141e 491 check_substr "$STATIC_SUBAGENT_LIST" "informix"
492 if test $? = 0; then
493 COMPONENTS="$COMPONENTS informix"
494 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/informix/informix.la"
495 fi
496
497 check_substr "$STATIC_SUBAGENT_LIST" "db2"
60a1159a 498 if test $? = 0; then
6afe141e 499 COMPONENTS="$COMPONENTS db2"
500 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/db2/db2.la"
60a1159a
VK
501 fi
502
ef0c727b 503 case "$PLATFORM" in
e8636669
VK
504 Linux)
505 SUBAGENT_DIRS="linux"
c1165d33 506 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/linux/linux.la"
d0b5a098 507 STATIC_SUBAGENT_LIST="linux $STATIC_SUBAGENT_LIST"
e8636669
VK
508 ;;
509 FreeBSD)
510 SUBAGENT_DIRS="freebsd"
c1165d33 511 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/freebsd/freebsd.la"
d0b5a098 512 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
e8636669 513 ;;
992ba479
AK
514 OpenBSD)
515 SUBAGENT_DIRS="openbsd"
c1165d33 516 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/openbsd/openbsd.la"
992ba479
AK
517 STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST"
518 ;;
ad0f1ada
VK
519 NetBSD)
520 SUBAGENT_DIRS="netbsd"
c1165d33 521 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/netbsd/netbsd.la"
ad0f1ada
VK
522 STATIC_SUBAGENT_LIST="netbsd $STATIC_SUBAGENT_LIST"
523 ;;
e8636669
VK
524 SunOS)
525 SUBAGENT_DIRS="sunos"
c1165d33 526 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/sunos/sunos.la"
d0b5a098
VK
527 STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
528 ;;
529 AIX)
530 SUBAGENT_DIRS="aix"
c1165d33 531 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/aix/aix.la"
d0b5a098 532 STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
e8636669 533 ;;
c29360a9
VK
534 HP-UX)
535 SUBAGENT_DIRS="hpux"
c1165d33 536 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/hpux/hpux.la"
c29360a9
VK
537 STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
538 ;;
cf52e714
AK
539 Darwin)
540 SUBAGENT_DIRS="darwin"
541 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/darwin/darwin.la"
542 STATIC_SUBAGENT_LIST="darwin $STATIC_SUBAGENT_LIST"
543 ;;
e8636669
VK
544 *)
545 # unknown
546 ;;
547 esac
ef0c727b 548fi
2b23dc1e 549
ef0c727b 550check_substr "$COMPONENTS" "ipso-agent"
1010cff7 551if test $? = 0; then
fd5a401b 552 if test "x$COMPONENTS" != "x ipso-agent"; then
971abf4f 553 AC_MSG_ERROR(IPSO agent and other components are mutually exclusive.)
ef0c727b
VK
554 fi
555 STATIC_BUILD="yes"
556 BUILD_STATIC_AGENT="yes"
3a6979cf 557 DISABLE_ICONV="yes"
ef0c727b 558 USE_PTH="yes"
60a1159a 559 MODULES="$MODULES libnxlp db agent"
aa24418a 560 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO -D_USE_GNU_PTH -DSQLITE_THREADSAFE=0 -I/usr/local/include"
ef0c727b 561 LDFLAGS="$LDFLAGS -all-static"
971abf4f 562 STATIC_SUBAGENT_LIST="ecs ipso logwatch ping portcheck ups"
ef0c727b 563 SUBAGENT_DIRS="ipso"
c1165d33 564 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"
ef0c727b 565fi
c688d2a7 566
c5c0f362
VK
567check_substr "$COMPONENTS" "snmp"
568if test $? = 0; then
569 NEED_ZLIB="yes"
570 MODULES="$MODULES snmp"
571fi
572
ef0c727b 573check_substr "$COMPONENTS" "server"
1010cff7 574if test $? = 0; then
ef0c727b
VK
575 if test "x$DBDRIVER_SELECTED" != "xyes"; then
576 AC_MSG_ERROR(You must select at least one database driver when building server.)
577 fi
578 BUILD_SERVER="yes"
d1834406 579 MODULES="$MODULES libnxmap libnxsl libnxlp db server nxscript"
ef0c727b
VK
580 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
581 CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds"
058bf6fc
VK
582 if test "x$XMPP_SUPPORT" = "xyes"; then
583 MODULES="libstrophe $MODULES"
584 AC_DEFINE(XMPP_SUPPORTED, 1, Define to 1 if XMPP is supported)
585 fi
ef0c727b 586fi
dff54fed 587
e44986e5
VK
588check_substr "$COMPONENTS" "client"
589if test $? = 0; then
590 BUILD_CLIENT="yes"
591 NEED_ZLIB="yes"
aa24418a 592 MODULES="$MODULES libnxmap libnxcl client"
36ad9f45 593 CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxalarm nxevent nxpush nxsms"
e44986e5
VK
594fi
595
a7a03ffd
VK
596check_substr "$COMPONENTS" "client-proxy"
597if test $? = 0; then
598 MODULES="$MODULES nxcproxy"
599fi
600
ef0c727b 601check_substr "$COMPONENTS" "agent"
1010cff7 602if test $? = 0; then
ef0c727b 603 BUILD_AGENT="yes"
28ba6824 604 MODULES="$MODULES libnxlp db agent"
1010cff7
VK
605
606 case "$PLATFORM" in
607 Linux)
608 SUBAGENT_DIRS="linux"
609 ;;
610 FreeBSD)
611 SUBAGENT_DIRS="freebsd"
612 ;;
613 OpenBSD)
614 SUBAGENT_DIRS="openbsd"
615 ;;
ad0f1ada
VK
616 NetBSD)
617 SUBAGENT_DIRS="netbsd"
618 ;;
1010cff7
VK
619 SunOS)
620 SUBAGENT_DIRS="sunos"
621 ;;
622 AIX)
623 SUBAGENT_DIRS="aix"
624 ;;
625 HP-UX)
626 SUBAGENT_DIRS="hpux"
cf52e714
AK
627 ;;
628 Darwin)
629 SUBAGENT_DIRS="darwin"
1010cff7
VK
630 ;;
631 *)
632 # unknown
633 ;;
634 esac
ef0c727b 635fi
b97191d2 636
ef0c727b 637check_substr "$COMPONENTS" "mysql"
1010cff7 638if test $? = 0; then
ef0c727b 639 DB_DRIVERS="$DB_DRIVERS mysql"
b67a9e12 640fi
6619a6b0 641
ef0c727b 642check_substr "$COMPONENTS" "pgsql"
1010cff7 643if test $? = 0; then
ef0c727b
VK
644 DB_DRIVERS="$DB_DRIVERS pgsql"
645fi
e8636669 646
8817f620 647check_substr "$COMPONENTS" "sqlite_drv"
1010cff7 648if test $? = 0; then
ef0c727b 649 DB_DRIVERS="$DB_DRIVERS sqlite"
e8636669
VK
650fi
651
ef0c727b 652check_substr "$COMPONENTS" "odbc"
1010cff7 653if test $? = 0; then
ef0c727b
VK
654 DB_DRIVERS="$DB_DRIVERS odbc"
655fi
656
41b4790d
VK
657check_substr "$COMPONENTS" "oracle"
658if test $? = 0; then
659 DB_DRIVERS="$DB_DRIVERS oracle"
4d1753cd 660 SUBAGENT_DIRS="$SUBAGENT_DIRS oracle"
41b4790d
VK
661fi
662
84277a0f
AK
663check_substr "$COMPONENTS" "db2"
664if test $? = 0; then
665 DB_DRIVERS="$DB_DRIVERS db2"
6afe141e 666 SUBAGENT_DIRS="$SUBAGENT_DIRS db2"
84277a0f
AK
667fi
668
87f1fff0
VK
669check_substr "$COMPONENTS" "informix"
670if test $? = 0; then
671 DB_DRIVERS="$DB_DRIVERS informix"
80e96a82 672 SUBAGENT_DIRS="$SUBAGENT_DIRS informix"
87f1fff0
VK
673fi
674
247f8a6c
AK
675check_substr "$COMPONENTS" "raspberrypi"
676if test $? = 0; then
677 NEED_ZLIB="yes"
678 SUBAGENT_DIRS="$SUBAGENT_DIRS rpi"
679fi
ef0c727b 680
50e4bc8c
VK
681check_substr "$COMPONENTS" "java"
682if test $? = 0; then
683 SUBAGENT_DIRS="$SUBAGENT_DIRS java"
684fi
685
b550188f
VK
686check_substr "$COMPONENTS" "sdk"
687if test $? = 0; then
688 MODULES="$MODULES libnxmap libnxcl libnxsl libnxlp db nxscript"
689fi
690
691
ef0c727b
VK
692#--------------------------------------------------------------------
693# Check for programs
694#--------------------------------------------------------------------
695
696if test "x$PLATFORM" = "xHP-UX"; then
f172d7b7 697 AC_CHECK_PROG([CC], [aCC], [aCC])
e7d9c4ae 698 AC_CHECK_PROG([CCC], [aCC], [aCC])
ef0c727b 699fi
df9812a9 700if test "x$PLATFORM" = "xAIX"; then
f172d7b7 701 AC_CHECK_PROG([CC], [xlc_r], [xlc_r])
df9812a9
VK
702 AC_CHECK_PROG([CCC], [xlC_r], [xlC_r])
703fi
9113e749 704if test "x$PLATFORM" = "xSunOS"; then
f172d7b7 705 AC_CHECK_PROG([CC], [cc], [cc])
9113e749
VK
706 AC_CHECK_PROG([CCC], [CC], [CC])
707fi
f172d7b7 708AC_PROG_CC
ef0c727b
VK
709AC_PROG_CPP
710AC_PROG_CXX
c3cfc039 711if test "x$CXX" = "xg++"; then
753206b5
AK
712 AC_CHECK_PROG([GPLUSPLUS], [g++], [yes], [no])
713 if test "x$GPLUSPLUS" = "xno"; then
c3cfc039
VK
714 AC_MSG_ERROR([*** FATAL: Cannot find any usable C++ compiler])
715 fi
716fi
fdf7ec40 717AM_PROG_AS
ef0c727b
VK
718AC_PROG_INSTALL
719AC_PROG_LEX
76154a95 720AC_CHECK_PROGS(YACC,bison byacc,yacc)
ef0c727b
VK
721AC_PROG_LN_S
722
723AC_ARG_VAR(PERL,local path to the perl interpreter)
724perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
725AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
726
727
728#--------------------------------------------------------------------
ef0c727b
VK
729# C/C++ capabilities
730#--------------------------------------------------------------------
731
732AC_C_CONST
733AC_PROG_GCC_TRADITIONAL
1d9cc60e 734AC_C_BIGENDIAN
ef0c727b
VK
735
736
737#--------------------------------------------------------------------
738# Platform-dependent settings
739#--------------------------------------------------------------------
740
741case "$PLATFORM" in
742 AIX)
545bda2d 743 LDFLAGS_PREFIX="-no-undefined -Wl,-brtl $LDFLAGS"
ef0c727b
VK
744 ;;
745 HP-UX)
53c96e2d 746 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"
ef0c727b 747 if test "x$CXX" = "xaCC"; then
5a64ab96 748 CPPFLAGS="$CPPFLAGS -D_HP_ATOMIC_INLINE"
53c96e2d 749 CFLAGS="$CFLAGS -AC99"
cfd95c74 750 CXXFLAGS="-mt $CXXFLAGS +W749 +W829"
ef0c727b
VK
751 LDFLAGS="$LDFLAGS -mt"
752 fi
6dde8627
VK
753 if test `uname -m` != 'ia64'; then
754 HPUX_HPPA="yes"
755 fi
ef0c727b 756 ;;
75c30ed4 757 SunOS)
b92efe0e 758 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__"
44ca59aa
VK
759 AC_MSG_CHECKING(whether C compiler accepts -O2)
760 OLD_CPPFLAGS="$CPPFLAGS"
761 CPPFLAGS="$CPPFLAGS -O2"
12313882 762 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
44ca59aa
VK
763 [ AC_MSG_RESULT(yes) ],
764 [
765 CPPFLAGS="$OLD_CPPFLAGS"
766 AC_MSG_RESULT(no)
767 ])
75c30ed4 768 ;;
56b2f755 769 Linux)
f47bd4ca 770 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -O2"
56b2f755 771 ;;
d1056954 772 Darwin)
f47bd4ca 773 CPPFLAGS="$CPPFLAGS -Wno-deprecated-declarations -O2"
d1056954 774 ;;
ef0c727b
VK
775 *)
776 ;;
777esac
778
779
780#--------------------------------------------------------------------
c90d3610 781# C++ compiler tuning:
cc297a70 782# * Disable C++ exceptions and RTTI
779ce551 783# * Turn on 64bit mode on HP-UX/Itanium
cc297a70 784# * Turn on 64bit mode on AIX
d358c73f 785# * Turn on 64bit mode on Solaris
ef0c727b
VK
786#--------------------------------------------------------------------
787
5482ef16 788if test "x$ac_compiler_gnu" = "xyes" ; then
9113e749 789 SQLFLAGS="-x c -Wundef"
6e383343 790 CPPFLAGS="$CPPFLAGS -Wformat"
ef0c727b
VK
791
792 AC_LANG_PUSH([C++])
793
794 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
e6b112bc 795 OLD_CXXFLAGS="$CXXFLAGS"
ef0c727b
VK
796 CXXFLAGS="$CXXFLAGS -fno-rtti"
797 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
798 [ AC_MSG_RESULT(yes) ],
799 [
800 CXXFLAGS="$OLD_CXXFLAGS"
801 AC_MSG_RESULT(no)
802 ])
803
50e4bc8c
VK
804 check_substr "$COMPONENTS" "java"
805 if test $? != 0; then
806 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
807 OLD_CXXFLAGS="$CXXFLAGS"
808 CXXFLAGS="$CXXFLAGS -fno-exceptions"
809 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
810 [ AC_MSG_RESULT(yes) ],
811 [
812 CXXFLAGS="$OLD_CXXFLAGS"
813 AC_MSG_RESULT(no)
814 ])
815 fi
ef0c727b
VK
816
817 AC_LANG_POP([C++])
818
779ce551 819 if test "x$PLATFORM" = "xHP-UX"; then
cc297a70
VK
820 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
821 AC_MSG_CHECKING(whether C compiler accepts -milp32)
822 OLD_CPPFLAGS="$CPPFLAGS"
823 CPPFLAGS="$CPPFLAGS -milp32"
824 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
825 [
826 LDFLAGS="-milp32 $LDFLAGS"
827 AC_MSG_RESULT(yes)
828 ],
829 [
830 CPPFLAGS="$OLD_CPPFLAGS"
831 AC_MSG_RESULT(no)
832 ])
833 else
834 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
835 OLD_CPPFLAGS="$CPPFLAGS"
836 CPPFLAGS="$CPPFLAGS -mlp64"
837 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
838 [
839 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
840 AC_MSG_RESULT(yes)
841 ],
842 [
843 CPPFLAGS="$OLD_CPPFLAGS"
844 AC_MSG_RESULT(no)
845 ])
846 fi
847 fi
848
849 if test "x$PLATFORM" = "xAIX"; then
850 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
851 AC_MSG_CHECKING(whether C compiler accepts -maix32)
852 OLD_CPPFLAGS="$CPPFLAGS"
853 CPPFLAGS="$CPPFLAGS -maix32"
fecf6a2b 854 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
855 [
856 LDFLAGS="-maix32 $LDFLAGS"
5482ef16
VK
857 LTINIT_CC="$CC -maix32"
858 LTINIT_CXX="$CXX -maix32"
1c45282c 859 OBJECT_MODE=32
cc297a70
VK
860 AC_MSG_RESULT(yes)
861 ],
862 [
863 CPPFLAGS="$OLD_CPPFLAGS"
864 AC_MSG_RESULT(no)
865 ])
866 else
867 AC_MSG_CHECKING(whether C compiler accepts -maix64)
868 OLD_CPPFLAGS="$CPPFLAGS"
869 CPPFLAGS="$CPPFLAGS -maix64"
fecf6a2b 870 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
871 [
872 LDFLAGS="-maix64 $LDFLAGS"
5482ef16
VK
873 LTINIT_CC="$CC -maix64"
874 LTINIT_CXX="$CXX -maix64"
1c45282c 875 OBJECT_MODE=64
cc297a70
VK
876 AC_MSG_RESULT(yes)
877 ],
878 [
879 CPPFLAGS="$OLD_CPPFLAGS"
880 AC_MSG_RESULT(no)
881 ])
882 fi
779ce551 883 fi
d358c73f
VK
884
885 if test "x$PLATFORM" = "xSunOS"; then
886 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
887 AC_MSG_CHECKING(whether C compiler accepts -m32)
888 OLD_CPPFLAGS="$CPPFLAGS"
889 CPPFLAGS="$CPPFLAGS -m32"
890 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
891 [
892 LDFLAGS="-m32 $LDFLAGS"
893 AC_MSG_RESULT(yes)
894 ],
895 [
896 CPPFLAGS="$OLD_CPPFLAGS"
897 AC_MSG_RESULT(no)
898 ])
899 else
900 AC_MSG_CHECKING(whether C compiler accepts -m64)
901 OLD_CPPFLAGS="$CPPFLAGS"
902 CPPFLAGS="$CPPFLAGS -m64"
903 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
904 [
905 LDFLAGS="-m64 $LDFLAGS"
906 AC_MSG_RESULT(yes)
907 ],
908 [
909 CPPFLAGS="$OLD_CPPFLAGS"
910 AC_MSG_RESULT(no)
911 ])
912 fi
913 fi
779ce551 914
ce5592b2
VK
915 if test "x$ENABLE_DEBUG" = "xyes"; then
916 CPPFLAGS="$CPPFLAGS -ggdb3"
917 fi
ef0c727b
VK
918fi
919
cfd95c74
VK
920if test "x$CXX" = "xaCC" ; then
921 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
451b735a
VK
922 if test "x$HPUX_HPPA" = "xyes"; then
923 ARCHFLAG="+DA1.1"
924 else
925 ARCHFLAG="+DD32"
926 fi
927 AC_MSG_CHECKING(whether C compiler accepts $ARCHFLAG)
4d37b0c5 928 OLD_CPPFLAGS="$CPPFLAGS"
451b735a 929 CPPFLAGS="$ARCHFLAG $CPPFLAGS"
cfd95c74
VK
930 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
931 [
451b735a
VK
932 LDFLAGS="$ARCHFLAG $LDFLAGS"
933 CCASFLAGS="$ARCHFLAG $CCASFLAGS"
cfd95c74
VK
934 AC_MSG_RESULT(yes)
935 ],
936 [
4d37b0c5
VK
937 CPPFLAGS="$OLD_CPPFLAGS"
938 AC_MSG_RESULT(no)
cfd95c74 939 ])
4d37b0c5 940 else
451b735a
VK
941 if test "x$HPUX_HPPA" = "xyes"; then
942 ARCHFLAG="+DA2.0W"
943 else
944 ARCHFLAG="+DD64"
945 fi
946 AC_MSG_CHECKING(whether C compiler accepts $ARCHFLAG)
cfd95c74 947 OLD_CPPFLAGS="$CPPFLAGS"
451b735a 948 CPPFLAGS="$ARCHFLAG $CPPFLAGS"
cfd95c74
VK
949 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
950 [
451b735a
VK
951 LDFLAGS="$ARCHFLAG $LDFLAGS"
952 CCASFLAGS="$ARCHFLAG $CCASFLAGS"
cfd95c74
VK
953 AC_MSG_RESULT(yes)
954 ],
955 [
956 CPPFLAGS="$OLD_CPPFLAGS"
957 AC_MSG_RESULT(no)
958 ])
4d37b0c5 959 fi
ef0c727b
VK
960fi
961
df9812a9 962if test "x$CXX" = "xxlC_r" ; then
d1cb61cf 963 SQLFLAGS="-qnoppline"
9b99f1c0
VK
964 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
965 AC_MSG_CHECKING(whether C compiler accepts -q32)
966 OLD_CPPFLAGS="$CPPFLAGS"
967 CPPFLAGS="-q32 $CPPFLAGS"
968 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
969 [
970 LDFLAGS="-q32 $LDFLAGS"
df9812a9 971 OBJECT_MODE=32
9b99f1c0
VK
972 AC_MSG_RESULT(yes)
973 ],
974 [
975 CPPFLAGS="$OLD_CPPFLAGS"
976 AC_MSG_RESULT(no)
977 ])
978 else
979 AC_MSG_CHECKING(whether C compiler accepts -q64)
980 OLD_CPPFLAGS="$CPPFLAGS"
981 CPPFLAGS="-q64 $CPPFLAGS"
982 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
983 [
984 LDFLAGS="-q64 $LDFLAGS"
df9812a9 985 OBJECT_MODE=64
9b99f1c0
VK
986 AC_MSG_RESULT(yes)
987 ],
988 [
989 CPPFLAGS="$OLD_CPPFLAGS"
990 AC_MSG_RESULT(no)
991 ])
992 fi
993fi
994
9113e749
VK
995if test "x$CXX" = "xCC" ; then
996 SQLFLAGS="-Qn"
997 CPPFLAGS="$CPPFLAGS -mt"
998
999 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1000 AC_MSG_CHECKING(whether C compiler accepts -m32)
f5e5296e
VK
1001 count=`$CC -flags | grep '^\-m32 ' | wc -l`
1002 if test $count -eq 1; then
1003 AC_MSG_RESULT(yes)
1004 CPPFLAGS="$CPPFLAGS -m32"
1005 LDFLAGS="-m32 $LDFLAGS"
1006 else
1007 AC_MSG_RESULT(no)
1008 fi
9113e749 1009 else
c3900dbb 1010 TEST_XARCH="no"
9113e749 1011 AC_MSG_CHECKING(whether C compiler accepts -m64)
f5e5296e
VK
1012 count=`$CC -flags | grep '^\-m64 ' | wc -l`
1013 if test $count -eq 1; then
1014 AC_MSG_RESULT(yes)
1015 CPPFLAGS="$CPPFLAGS -m64"
1016 LDFLAGS="-m64 $LDFLAGS"
1017 else
1018 AC_MSG_RESULT(no)
1019 TEST_XARCH="yes"
1020 fi
c3900dbb
VK
1021 if test "x$TEST_XARCH" = "xyes"; then
1022 if test "x$CPUTYPE" = "xsparc"; then
1023 ARCH="-xarch=v9"
1024 else
1025 ARCH="-xarch=amd64"
1026 fi
1027 AC_MSG_CHECKING(whether C compiler accepts $ARCH)
1028 OLD_CPPFLAGS="$CPPFLAGS"
1029 CPPFLAGS="$CPPFLAGS $ARCH"
1030 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1031 [
1032 LDFLAGS="$ARCH $LDFLAGS"
1033 AC_MSG_RESULT(yes)
1034 ],
1035 [
1036 CPPFLAGS="$OLD_CPPFLAGS"
1037 AC_MSG_RESULT(no)
1038 ])
1039 fi
9113e749
VK
1040 fi
1041fi
1042
edb018d7
VK
1043
1044#--------------------------------------------------------------------
1045# Initialize libtool
1046#--------------------------------------------------------------------
1047
1048if test "x$STATIC_BUILD" = "xyes"; then
1049 enable_shared=no
1050 enable_static=yes
1051else
1052 enable_shared=yes
e99eba92
VK
1053 if test "x$BUILD_SDK" = "xyes"; then
1054 enable_static=yes
1055 else
1056 enable_static=no
1057 fi
edb018d7 1058fi
1ef5e57a
VK
1059
1060if test "x$LTINIT_CC" != "x"; then
1061 SAVED_CC="$CC"
1062 CC="$LTINIT_CC"
1063fi
1064if test "x$LTINIT_CXX" != "x"; then
1065 SAVED_CXX="$CXX"
1066 CXX="$LTINIT_CXX"
1067fi
1068
ff12e2f1 1069LT_PREREQ([2.2])
1ef5e57a
VK
1070LT_INIT([dlopen])
1071
1072if test "x$SAVED_CC" != "x"; then
1073 CC="$SAVED_CC"
1074fi
1075if test "x$SAVED_CXX" != "x"; then
1076 CXX="$SAVED_CXX"
1077fi
edb018d7
VK
1078
1079
cfd95c74
VK
1080#--------------------------------------------------------------------
1081# Additional include and library directories
1082#--------------------------------------------------------------------
ef0c727b 1083
cfd95c74
VK
1084if test "x$CXX" != "xaCC"; then
1085 if test -d /usr/local/include; then
5482ef16 1086 if test "x$ac_compiler_gnu" = "xyes"; then
cfd95c74
VK
1087 AC_MSG_CHECKING(whether -I/usr/local/include needed)
1088 OLD_CPPFLAGS="$CPPFLAGS"
1089 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
2adc2d49 1090 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
cfd95c74
VK
1091 [
1092 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
1093 AC_MSG_RESULT(yes)
1094 ],
1095 [
1096 CPPFLAGS="$OLD_CPPFLAGS"
1097 AC_MSG_RESULT(no)
1098 ]
1099 )
1100 else
1101 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
1102 fi
1103 fi
1104
1105 if test -d /usr/kerberos/include; then
1106 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1107 fi
ef0c727b 1108
cfd95c74
VK
1109 if test -d /usr/local/lib; then
1110 LDFLAGS="$LDFLAGS -L/usr/local/lib"
1111 fi
1112fi
ef0c727b
VK
1113
1114#--------------------------------------------------------------------
1115# Check for threads library - either POSIX or GNU
1116#--------------------------------------------------------------------
1117
1118if test "x$USE_PTH" = "xyes"; then
1119 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
1120else
1121 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
1122
1123 if test "x$CXX" = "xaCC"; then
1124 PTHREAD_LIBS=""
1125 else
1126 PTHREAD_LIBS="error"
1127 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
1128 AC_EGREP_CPP(yes,
1129 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
1130 yes
1131 #endif
1132 ], AC_MSG_RESULT(yes)
fecf6a2b 1133 PTHREAD_LIBS="-pthread",
ef0c727b
VK
1134 AC_MSG_RESULT(no))
1135 if test "x$PTHREAD_LIBS" = "xerror"; then
1136 AC_CHECK_LIB(pthread, pthread_attr_init,
1137 PTHREAD_LIBS="-lpthread")
1138 fi
f725c1b7 1139 # On HP-UX (at least 11.00) pthread library contains
b041c587 1140 # __pthread_attr_init_system instead of pthread_attr_init
f725c1b7 1141 if test "x$PTHREAD_LIBS" = "xerror"; then
b041c587 1142 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
f725c1b7
VK
1143 PTHREAD_LIBS="-lpthread")
1144 fi
ef0c727b
VK
1145 if test "x$PTHREAD_LIBS" = "xerror"; then
1146 AC_CHECK_LIB(pthreads, pthread_attr_init,
1147 PTHREAD_LIBS="-lpthreads")
1148 fi
1149 if test "x$PTHREAD_LIBS" = "xerror"; then
1150 AC_CHECK_FUNC(pthread_attr_init,
1151 PTHREAD_LIBS="")
1152 fi
1153 fi
1154
1155 if test "x$PTHREAD_LIBS" = "xerror"; then
1156 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
1157 fi
8d131dda 1158 LIBS="$LIBS $PTHREAD_LIBS"
ef0c727b
VK
1159
1160 # Extensions to posix threads
1161 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 1162#include <pthread.h>
ef0c727b
VK
1163 ])
1164 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
1165
1166 # Check for recursive mutexes
39086394
VK
1167 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
1168 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
1169#include <pthread.h>
1170#if HAVE_PTHREAD_NP_H
1171#include <pthread_np.h>
1172#endif
ef0c727b
VK
1173 ])
1174
1175 # Check for read/write locks
1176 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
1177 # additional defines
1178 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
1179 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
1180 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
afd0c386
VK
1181 [AC_COMPILE_IFELSE([
1182 AC_LANG_PROGRAM([
9c29f76e
VK
1183#include <sys/types.h>
1184#include <pthread.h>
afd0c386
VK
1185 ],
1186 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b 1187 ac_cv_struct_pthread_rw=yes, [
afd0c386
VK
1188 AC_COMPILE_IFELSE([
1189 AC_LANG_PROGRAM([
9c29f76e
VK
1190#define _XOPEN_SOURCE 500
1191#include <sys/types.h>
1192#include <pthread.h>
afd0c386
VK
1193 ],
1194 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b
VK
1195 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
1196 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1197 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
1198 fi
1199 ])])
1200 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1201 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
1202 fi
1203 fi
1204
1205fi
1206
1207
1208#--------------------------------------------------------------------
1209# Checks for OpenSSL
1210#--------------------------------------------------------------------
1211
1212if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
1213 AC_CHECK_LIB(crypto, RSA_new,
1214 [
1215 AC_DEFINE(WITH_OPENSSL,,[with openssl])
1216 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
e0a77f08 1217 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
ef0c727b 1218 AC_CHECK_LIB(crypto, EVP_bf_cbc,
e0a77f08 1219 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
ef0c727b 1220 AC_CHECK_LIB(crypto, EVP_idea_cbc,
e0a77f08 1221 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
ef0c727b 1222 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
e0a77f08 1223 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
d27e7413 1224 SERVER_LIBS="$SERVER_LIBS -lssl"
e0a77f08
VK
1225 if test "x$HAVE_LIBCRYPTO" = "xyes"; then
1226 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
1227# LIBS="$LIBS -Wl,-Bstatic -lcrypto -Wl,-Bdynamic"
1228 LIBS="$LIBS -lcrypto"
1229 else
1230 LIBS="$LIBS -lcrypto"
1231 fi
1232 else
058bf6fc 1233 AC_MSG_ERROR(libcrypto does not provide any suitable encryption algorithm)
e0a77f08 1234 fi
ef0c727b
VK
1235 ],
1236 [
058bf6fc 1237 AC_MSG_ERROR(libcrypto is required for encryption support)
ef0c727b
VK
1238 ])
1239fi
1240
1241
1242#--------------------------------------------------------------------
0322eed7
VK
1243# Checks for header files
1244#--------------------------------------------------------------------
1245
1246AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h alloca.h])
2e98cdb4 1247AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h sys/wait.h])
e9c8eb1d 1248AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h netinet/tcp.h net/nh.h sys/socket.h])
0322eed7
VK
1249AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
1250AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
c1099678 1251AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h locale.h])
df9812a9 1252AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
f09c2d05 1253AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
1254[[#ifdef HAVE_SYS_TYPES_H
1255# include <sys/types.h>
1256#endif
1257#ifdef HAVE_SYS_TIME_H
1258# include <sys/time.h>
1259#endif
1260#ifdef HAVE_SYS_SOCKET_H
1261# include <sys/socket.h>
1262#endif
1263]])
1264
1265
1266#--------------------------------------------------------------------
ef0c727b
VK
1267# Checks for other libs.
1268#--------------------------------------------------------------------
d16cf8a5 1269
779ce551 1270AC_CHECK_LIB(xnet, accept)
521d90e7 1271AC_CHECK_LIB(socket, if_nameindex)
87bb64a7 1272AC_CHECK_LIB(dl, dlopen)
1b3c0ef0 1273AC_CHECK_LIB(kstat, kstat_open)
d16cf8a5 1274
e0760102 1275if test "x$BUILD_SERVER" = "xyes" ; then
7c48e2aa
VK
1276 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"]))])
1277 AC_CHECK_LIB(readline, readline, [SERVER_LIBS="$SERVER_LIBS -lreadline"], [AC_CHECK_LIB(edit, readline, [SERVER_LIBS="$SERVER_LIBS -ledit"])])
1278 SAVED_LDFLAGS="$LDFLAGS"
1279 LDFLAGS="$LDFLAGS $SERVER_LIBS"
1280
0322eed7
VK
1281 AC_CHECK_FUNCS([readline])
1282
1283 # Check if passing rl_insert to rl_bind_key needs cast
1284 if test "$ac_cv_func_readline" = "yes"; then
1285 AC_LANG_PUSH([C++])
1286
1287 AC_MSG_CHECKING(for rl_insert cast)
1288
afd0c386 1289 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1290 [
1291#include <stdio.h>
1292#include <readline/readline.h>
afd0c386 1293 ],[ rl_bind_key('\t', (Function *)rl_insert); ])],
0322eed7
VK
1294 [
1295 AC_MSG_RESULT((Function *))
1296 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
1297 ],[
afd0c386 1298 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1299 [
1300#include <stdio.h>
1301#include <readline/readline.h>
afd0c386 1302 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ])],
0322eed7
VK
1303 [
1304 AC_MSG_RESULT((rl_command_func_t *))
1305 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
1306 ],[
1307 AC_MSG_RESULT(not needed)
1308 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
1309 ]
1310 )
1311 ]
1312 )
1313
1314 AC_LANG_POP([C++])
1315 fi
7c48e2aa 1316 LDFLAGS="$SAVED_LDFLAGS"
e0760102
VK
1317fi
1318
ef0c727b 1319if test "x$NEED_ZLIB" = "xyes"; then
1fd41bcd
VK
1320 if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
1321 HAVE_ZLIB=no
1322 else
1323 HAVE_ZLIB=yes
1324 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
1325 if test "x$HAVE_ZLIB" = "xyes"; then
1326 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
1327 fi
1328 fi
1329 if test "x$HAVE_ZLIB" = "xno"; then
1330 MODULES="zlib $MODULES"
1331 fi
ef0c727b
VK
1332fi
1333
467c489f
VK
1334if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
1335 HAVE_LIBEXPAT=no
1336else
1337 HAVE_LIBEXPAT=yes
1338 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
1339 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
1340fi
80ce37ac
VK
1341if test "x$HAVE_LIBEXPAT" = "xno"; then
1342 MODULES="libexpat $MODULES"
1bb6b449 1343fi
ef0c727b 1344
17b35ccc
VK
1345if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
1346 HAVE_LIBTRE=no
1347else
1348 HAVE_LIBTRE=yes
1349 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
1350 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
1351fi
1352if test "x$HAVE_LIBTRE" = "xno"; then
1353 MODULES="libtre $MODULES"
1354 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
a67fa146 1355
720c23d0
VK
1356 tre_version_1='0'
1357 tre_version_2='8'
1358 tre_version_3='0'
a67fa146
VK
1359 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
1360 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
1361 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
1362 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
1363 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
1364 AC_SUBST(TRE_VERSION, $tre_version)
1365
1366 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])
1367 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
17b35ccc 1368fi
ef0c727b 1369
f5393033
VK
1370if test "x$FORCE_INTERNAL_JANSSON" = "xyes"; then
1371 HAVE_JANSSON=no
1372else
1373 HAVE_JANSSON=yes
1374 AC_CHECK_HEADER(jansson.h,,HAVE_JANSSON=no)
1375 AC_CHECK_LIB(jansson, json_object, [ HAVE_JANSSON=yes ], [ HAVE_JANSSON=no ])
1376fi
1377if test "x$HAVE_JANSSON" = "xno"; then
1378 MODULES="jansson $MODULES"
1379fi
1380
4050bafb
VK
1381if test "x$DISABLE_LMSENSORS" = "xno"; then
1382 HAVE_LMSENSORS=yes
1383 AC_CHECK_HEADER(sensors/sensors.h,,HAVE_LMSENSORS=no)
1384 if test "x$HAVE_LMSENSORS" = "xyes"; then
1385 AC_CHECK_LIB(sensors, sensors_init, [ DUMMY="" ], [ HAVE_LMSENSORS=no ])
1386 fi
1387 if test "x$HAVE_LMSENSORS" = "xyes"; then
1388 SUBAGENT_DIRS="$SUBAGENT_DIRS lmsensors"
1389 fi
38bfa5da
AK
1390fi
1391
0a4194c2
AK
1392AC_CHECK_HEADER(curl/curl.h,HAVE_LIBCURL=yes,HAVE_LIBCURL=no)
1393if test "x$HAVE_LIBCURL" = "xyes"; then
2368dc85
VK
1394 AC_CHECK_LIB(curl, curl_global_init, [ HAVE_LIBCURL=yes ], [ HAVE_LIBCURL=no ])
1395 AC_CHECK_DECLS([CURLOPT_NOSIGNAL, curl_version_info],,,[
1396#ifdef HAVE_CURL_CURL_H
1397#include <curl/curl.h>
1398#endif
1399])
0a4194c2 1400fi
d9177dd1 1401
0a4194c2 1402if test "x$HAVE_LIBCURL" = "xyes"; then
c80c69bd 1403 SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
31b0f68b 1404 SMSDRV_DIRS="$SMSDRV_DIRS websms"
6fad8870 1405 HDLINK_DIRS="$HDLINK_DIRS jira"
0a4194c2
AK
1406fi
1407
d9177dd1 1408AC_CHECK_HEADER(ldap.h,HAVE_LDAP=yes,HAVE_LDAP=no)
1409if test "x$HAVE_LDAP" = "xyes"; then
1410 AC_CHECK_LIB(ldap, ldap_init, [ HAVE_LDAP=yes ], [ HAVE_LDAP=no ])
1411 if test "x$HAVE_LDAP" = "xyes"; then
1412 SERVER_LIBS="-lldap $SERVER_LIBS"
1413 AC_DEFINE(INCLUDE_LDAP, 1, Define to 1 if you have LDAP librarys and LDAP headers)
1414 fi
1415fi
1416
ef0c727b
VK
1417#--------------------------------------------------------------------
1418# Checks for data types
1419#--------------------------------------------------------------------
1420
d16cf8a5
AK
1421AC_CHECK_SIZEOF(short)
1422AC_CHECK_SIZEOF(int)
1423AC_CHECK_SIZEOF(long)
1424AC_CHECK_SIZEOF(long long)
1425
1426AC_TYPE_PID_T
d16cf8a5
AK
1427AC_TYPE_SIZE_T
1428AC_STRUCT_TIMEZONE
1429
3071f10a 1430AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
51128b42 1431AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
1432#if HAVE_SYS_TYPES_H
1433#include <sys/types.h>
1434#endif
1435#if HAVE_SYS_SOCKET_H
1436#include <sys/socket.h>
1437#endif
1438])
e0293f7f
VK
1439AC_CHECK_TYPES([struct stat64],,,[
1440#if HAVE_SYS_STAT_H
1441#include <sys/stat.h>
1442#endif
1443])
521d90e7 1444
e25cadc9 1445
ef0c727b
VK
1446#--------------------------------------------------------------------
1447# Checks for functions
1448#--------------------------------------------------------------------
d16cf8a5
AK
1449
1450AC_FUNC_ERROR_AT_LINE
d16cf8a5 1451AC_FUNC_MEMCMP
d16cf8a5
AK
1452AC_FUNC_SELECT_ARGTYPES
1453AC_FUNC_STRFTIME
1454AC_FUNC_STRTOD
1455AC_FUNC_VPRINTF
1456
80ce37ac 1457AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
c1099678 1458AC_CHECK_FUNCS([strrchr strlwr strtol strtoul strtoll strtoull setlocale])
467e30e1 1459AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
c601fc15 1460AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
17cfa4f1 1461AC_CHECK_FUNCS([fopen64 strptime timegm gethostbyname2_r])
aa24418a
VK
1462
1463AC_CHECK_DECLS([nanosleep])
be6467e9 1464
b0823d06
VK
1465# Check if strerror_r is POSIX-compliant
1466if test "$ac_cv_func_strerror_r" = "yes"; then
1467 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1468 AC_LANG_PUSH([C++])
1469 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
1470#if HAVE_STRING_H
1471#include <string.h>
1472#endif
1473#if HAVE_ERRNO_H
1474#include <errno.h>
1475#endif
b0823d06 1476 ]],[[
7f9423af
VK
1477 int e;
1478 char buffer[256];
1479 e = strerror_r(1, buffer, 256);
1480 return e;
b0823d06
VK
1481 ]])
1482 ],[
1483 AC_MSG_RESULT(yes)
1484 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1485 ],[
1486 AC_MSG_RESULT(no)
1487 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1488 ])
1489 AC_LANG_POP([C++])
1490fi
1491
be6467e9
VK
1492# Check if struct tm has tm_gmtoff member
1493AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1494AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1495#if HAVE_TIME_H
1496#include <time.h>
1497#endif
1498#if HAVE_SYS_TIME_H
1499#include <sys/time.h>
1500#endif
1501]],[[
be6467e9
VK
1502 struct tm t;
1503 return t.tm_gmtoff;
be6467e9
VK
1504]])
1505],[
1506AC_MSG_RESULT(yes)
1507AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1508],[
1509AC_MSG_RESULT(no)
1510])
d16cf8a5 1511
f91feddc 1512AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
1513AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1514
058bf6fc 1515# sockets/resolver
d00ad4c6
VK
1516if test "$BUILD_SERVER-$XMPP_SUPPORT" = "yes-yes"; then
1517 AC_CHECK_HEADERS([arpa/nameser_compat.h])
1518 AC_CHECK_FUNC(res_query, , [AC_CHECK_LIB(resolv, res_query, [], [AC_CHECK_LIB(resolv, __res_query)])])
1519fi
d16cf8a5
AK
1520AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1521AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1522AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1523
1524if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1525 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1526fi
1527
1528if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1529 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1530 LIBS="-lnsl -lsocket $LIBS"
1531 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1532 if test "$my_ac_link_result" = "no" ; then
1533 AC_MSG_RESULT([failure])
1534 AC_MSG_ERROR([unable to use gethostbyname()])
1535 else
1536 AC_MSG_RESULT([success])
1537 fi
1538fi
1539
c6491611
VK
1540# asprintf, scprintf, etc.
1541AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1542AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
1543
1544AC_MSG_CHECKING(whether snprintf returns required buffer size)
1545AC_RUN_IFELSE(
1546 [AC_LANG_PROGRAM([
1547#include <stdio.h>
1548#include <string.h>
1549 ], [
1550 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1551 ])
1552 ],
1553 [ AC_MSG_RESULT(yes)
1554 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1555 ],
1556 [ AC_MSG_RESULT(no) ],
1557 [ AC_MSG_RESULT(no) ]
1558)
1559
1560
dff54fed 1561
ef0c727b
VK
1562#--------------------------------------------------------------------
1563# Checks for macros and definitions
1564#--------------------------------------------------------------------
dff54fed 1565
ef0c727b
VK
1566AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1567#ifdef HAVE_SYS_TYPES_H
99e50bb7 1568#include <sys/types.h>
ef0c727b
VK
1569#endif
1570#if HAVE_BYTESWAP_H
1571#include <byteswap.h>
1572#endif
1573#if HAVE_NETINET_IN_H
1574#include <netinet/in.h>
1575#endif
1576#if HAVE_NET_NH_H
1577#include <net/nh.h>
1578#endif
1579])
aa24418a
VK
1580AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1581#ifdef HAVE_UNISTD_H
1582#include <unistd.h>
1583#endif
1584#ifdef HAVE_DLFCN_H
1585#include <dlfcn.h>
1586#endif
1587])
ce7565e7
VK
1588AC_CHECK_DECLS([va_copy, __va_copy],,,[
1589#ifdef HAVE_UNISTD_H
1590#include <unistd.h>
1591#endif
1592#ifdef HAVE_STDARG_H
1593#include <stdarg.h>
1594#endif
1595#ifdef HAVE_STDLIB_H
1596#include <stdlib.h>
1597#endif
1598])
dff54fed 1599
dff54fed 1600
ef0c727b 1601#--------------------------------------------------------------------
df9812a9
VK
1602# getopt
1603#--------------------------------------------------------------------
1604
1605if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
1606 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
1607else
1608 AC_CHECK_HEADERS([getopt.h])
1609 AC_CHECK_LIB(gnugetopt, getopt_long)
1610 AC_CHECK_DECLS([getopt_long],,,[
1611#if HAVE_GETOPT_H
1612#include <getopt.h>
1613#endif
1614 ])
1615fi
1616
1617
1618#--------------------------------------------------------------------
671651a1
VK
1619# Linux specific checks
1620#--------------------------------------------------------------------
1621
1622if test "x$PLATFORM" = "xLinux"; then
1623 AC_CHECK_HEADERS([sys/reboot.h],,,[[ ]])
1624 AC_CHECK_DECLS([reboot, RB_AUTOBOOT, RB_POWER_OFF, RB_HALT_SYSTEM],,,[
1625#if HAVE_SYS_REBOOT_H
1626#include <sys/reboot.h>
1627#endif
1628 ])
1629 AC_CHECK_FUNCS([reboot],,,[
1630#if HAVE_SYS_REBOOT_H
1631#include <sys/reboot.h>
1632#endif
1633 ])
1634fi
1635
1636
1637#--------------------------------------------------------------------
ef0c727b
VK
1638# AIX specific checks
1639#--------------------------------------------------------------------
d16cf8a5 1640
ef0c727b
VK
1641if test "x$PLATFORM" = "xAIX"; then
1642 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
efdaffe4 1643 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
df9812a9
VK
1644#if HAVE_PROCINFO_H
1645#include <procinfo.h>
1646#endif
1647 ])
ef0c727b
VK
1648 AC_CHECK_FUNCS([getprocs64],,,[
1649#if HAVE_PROCINFO_H
1650#include <procinfo.h>
6cd41ceb 1651#endif
ef0c727b 1652 ])
7e56bf2e
VK
1653fi
1654
cd4c8ca3 1655
ef0c727b 1656#--------------------------------------------------------------------
f47bd4ca
VK
1657# Solaris specific checks
1658#--------------------------------------------------------------------
1659
1660if test "x$PLATFORM" = "xSunOS"; then
1661 AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
1662#include <sys/atomic.h>
1663 ])
1664fi
1665
1666
1667#--------------------------------------------------------------------
ba8db57b
VK
1668# HP-UX specific checks
1669#--------------------------------------------------------------------
1670
1671if test "x$PLATFORM" = "xHP-UX"; then
3268bb77 1672 AC_CHECK_HEADERS([atomic.h sys/mib.h],,,[[ ]])
f09c2d05
VK
1673 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1674#if HAVE_NET_IF_H
1675#include <net/if.h>
1676#endif
1677 ])
1678 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1679#if HAVE_SYS_MIB_H
1680#include <sys/mib.h>
1681#endif
1682 ])
cfd95c74
VK
1683
1684 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
1685 AC_LANG_PUSH([C++])
1686 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1687#include <sys/pstat.h>
1688 ]], [[
1689pst_diskinfo d;
1690int x;
1691x = (int)d.psd_dkread;
1692x = (int)d.psd_dkwrite;
1693 ]])],
1694 [
1695 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
1696 AC_MSG_RESULT(yes)
1697 ],
1698 [
1699 AC_MSG_RESULT(no)
1700 ])
1701 AC_LANG_POP([C++])
ba8db57b
VK
1702fi
1703
1704
1705#--------------------------------------------------------------------
aa24418a
VK
1706# *BSD specific checks
1707#--------------------------------------------------------------------
1708
1709AC_CHECK_LIB(kvm, kvm_open)
1710AC_CHECK_FUNCS([kvm_getswapinfo])
1711AC_CHECK_TYPES([struct kinfo_proc2],,,[
1712#if HAVE_SYS_SYSCTL_H
1713#include <sys/sysctl.h>
1714#endif
1715])
1716
1717
28ba6824
VK
1718#--------------------------------------------------------------------
1719# FreeBSD specific checks
1720#--------------------------------------------------------------------
1721
1722if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
1723 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1724#if HAVE_SYS_TYPES_H
1725#include <sys/types.h>
1726#endif
1727#if HAVE_SYS_SOCKET_H
1728#include <sys/socket.h>
1729#endif
1730#include <net/route.h>
1731 ])
28ba6824
VK
1732fi
1733
1734
aa24418a 1735#--------------------------------------------------------------------
ea6615cf
VK
1736# OpenBSD specific checks
1737#--------------------------------------------------------------------
1738
1739if test "x$PLATFORM" = "xOpenBSD"; then
1740 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
1741 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1742#include <sys/param.h>
1743#include <sys/proc.h>
1744#include <kvm.h>
1745#include <sys/user.h>
1746 ]],[[
1747 int count;
1748 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
1749 return 0;
1750 ]])
1751 ],[
1752 AC_MSG_RESULT(yes)
1753 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1754 ],[
1755 AC_MSG_RESULT(no)
1756 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1757 ])
1758
1759 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
1760 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1761#include <sys/param.h>
1762#include <sys/proc.h>
1763#include <kvm.h>
1764#include <sys/user.h>
1765 ]],[[
1766 struct kinfo_proc p;
1767 return p.kp_proc.p_pid;
1768 ]])
1769 ],[
1770 AC_MSG_RESULT(yes)
1771 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
1772 ],[
1773 AC_MSG_RESULT(no)
1774 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
1775 ])
1776fi
1777
1778
1779#--------------------------------------------------------------------
ef0c727b
VK
1780# Check for UNICODE stuff
1781#--------------------------------------------------------------------
3e39fcde 1782
8b86c5dc 1783AC_CHECK_HEADERS([wchar.h wctype.h iconv.h])
aa24418a 1784AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
1785#if HAVE_WCHAR_H
1786#include <wchar.h>
1787#endif
1788])
f172d7b7
VK
1789AC_CHECK_SIZEOF(wchar_t,,[
1790#if HAVE_WCHAR_H
1791#include <wchar.h>
1792#endif
1793])
aa24418a 1794AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper wcserror wcserror_r])
8c2489aa
VK
1795AC_CHECK_FUNCS([wfopen wfopen64 fputws putws wopen wstat waccess wgetenv wrename wunlink])
1796AC_CHECK_FUNCS([wremove wchdir wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod])
9d20de29 1797AC_CHECK_FUNCS([vwscanf vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
dff54fed 1798
3265ba38 1799if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 1800 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 1801 [ ac_found_iconv=yes
8d131dda 1802 LIBS="$LIBS -liconv"
75c30ed4
VK
1803 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
1804 ],
1805 [
1806 AC_CHECK_LIB(iconv, iconv,
1807 [ ac_found_iconv=yes
8d131dda 1808 LIBS="$LIBS -liconv"
75c30ed4
VK
1809 ])
1810 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
1811 ])
dff54fed
VK
1812else
1813 ac_found_iconv=no
ef0c727b 1814 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 1815fi
93571e7f 1816
3bf0df9f
VK
1817AC_MSG_CHECKING(whether fgetws can be used with popen)
1818AC_RUN_IFELSE(
1819 [AC_LANG_PROGRAM([
1820#include <stdio.h>
1821#ifdef HAVE_UNISTD_H
1822#include <unistd.h>
1823#endif
1824#if HAVE_WCHAR_H
1825#include <wchar.h>
1826#endif
1827 ], [[
1828 int rc = 1;
1829 wchar_t line[4096];
1830 FILE *f = popen("echo test", "r");
1831 if(f!=NULL)
1832 {
1833 fgetws(line, 4096, f);
1834 pclose(f);
1835 rc = 0;
1836 }
1837 return rc;
1838 ]])
1839 ],
1840 [ AC_MSG_RESULT(yes)
1841 AC_DEFINE(SAFE_FGETWS_WITH_POPEN, 1, Define to 1 if fgetws can be used with popen)
1842 ],
1843 [ AC_MSG_RESULT(no) ],
1844 [ AC_MSG_RESULT(no) ]
1845)
1846
93571e7f
VK
1847AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
1848AC_RUN_IFELSE(
1849 [AC_LANG_PROGRAM([
1850#if HAVE_ICONV_H
1851#include <iconv.h>
1852#endif
1853 ], [
1854 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
1855 ])
1856 ],
1857 [ AC_MSG_RESULT(yes)
1858 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
1859 valid_ucs2_code="UCS-2-INTERNAL"
1860 ],
1861 [ AC_MSG_RESULT(no) ],
1862 [ AC_MSG_RESULT(no) ]
1863)
1864
1865AC_MSG_CHECKING(whether iconv supports UCS-2)
1866AC_RUN_IFELSE(
1867 [AC_LANG_PROGRAM([
1868#if HAVE_ICONV_H
1869#include <iconv.h>
1870#endif
1871 ], [
1872 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
1873 ])
1874 ],
1875 [ AC_MSG_RESULT(yes)
1876 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
1877 valid_ucs2_code="UCS-2"
1878 ],
1879 [ AC_MSG_RESULT(no) ],
8b86c5dc 1880 [ AC_MSG_RESULT(no) ]
93571e7f
VK
1881)
1882
1883AC_MSG_CHECKING(whether iconv supports UCS2)
1884AC_RUN_IFELSE(
1885 [AC_LANG_PROGRAM([
1886#if HAVE_ICONV_H
1887#include <iconv.h>
1888#endif
1889 ], [
1890 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
1891 ])
1892 ],
1893 [ AC_MSG_RESULT(yes)
1894 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
1895 valid_ucs2_code="UCS2"
1896 ],
1897 [ AC_MSG_RESULT(no) ],
1898 [ AC_MSG_RESULT(no) ]
1899)
1900
44bccbbc
VK
1901AC_MSG_CHECKING(whether iconv supports UCS-2BE)
1902AC_RUN_IFELSE(
1903 [AC_LANG_PROGRAM([
1904#if HAVE_ICONV_H
1905#include <iconv.h>
1906#endif
1907 ], [
1908 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
1909 ])
1910 ],
1911 [ AC_MSG_RESULT(yes)
1912 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
1913 valid_ucs2_code="UCS-2BE"
1914 ],
1915 [ AC_MSG_RESULT(no) ],
1916 [ AC_MSG_RESULT(no) ]
1917)
1918
6e17f325
VK
1919AC_MSG_CHECKING(whether iconv supports UCS-2LE)
1920AC_RUN_IFELSE(
1921 [AC_LANG_PROGRAM([
1922#if HAVE_ICONV_H
1923#include <iconv.h>
1924#endif
1925 ], [
1926 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
1927 ])
1928 ],
1929 [ AC_MSG_RESULT(yes)
1930 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
1931 valid_ucs2_code="UCS-2LE"
1932 ],
1933 [ AC_MSG_RESULT(no) ],
1934 [ AC_MSG_RESULT(no) ]
1935)
1936
4a4e1feb
VK
1937AC_MSG_CHECKING(whether iconv supports UTF-16)
1938AC_RUN_IFELSE(
1939 [AC_LANG_PROGRAM([
1940#if HAVE_ICONV_H
1941#include <iconv.h>
1942#endif
1943 ], [
1944 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
1945 ])
1946 ],
1947 [ AC_MSG_RESULT(yes)
1948 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
1949 valid_ucs2_code="UTF-16"
1950 ],
1951 [ AC_MSG_RESULT(no) ],
1952 [ AC_MSG_RESULT(no) ]
1953)
1954
8b86c5dc
VK
1955AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
1956AC_RUN_IFELSE(
1957 [AC_LANG_PROGRAM([
1958#if HAVE_ICONV_H
1959#include <iconv.h>
1960#endif
1961 ], [
1962 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
1963 ])
1964 ],
1965 [ AC_MSG_RESULT(yes)
1966 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
1967 valid_ucs4_code="UCS-4-INTERNAL"
1968 ],
1969 [ AC_MSG_RESULT(no) ],
1970 [ AC_MSG_RESULT(no) ]
1971)
1972
1973AC_MSG_CHECKING(whether iconv supports UCS-4)
1974AC_RUN_IFELSE(
1975 [AC_LANG_PROGRAM([
1976#if HAVE_ICONV_H
1977#include <iconv.h>
1978#endif
1979 ], [
1980 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
1981 ])
1982 ],
1983 [ AC_MSG_RESULT(yes)
1984 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
1985 valid_ucs4_code="UCS-4"
1986 ],
1987 [ AC_MSG_RESULT(no) ],
1988 [ AC_MSG_RESULT(no) ]
1989)
1990
1991AC_MSG_CHECKING(whether iconv supports UCS4)
1992AC_RUN_IFELSE(
1993 [AC_LANG_PROGRAM([
1994#if HAVE_ICONV_H
1995#include <iconv.h>
1996#endif
1997 ], [
1998 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
1999 ])
2000 ],
2001 [ AC_MSG_RESULT(yes)
2002 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
2003 valid_ucs4_code="UCS4"
2004 ],
2005 [ AC_MSG_RESULT(no) ],
2006 [ AC_MSG_RESULT(no) ]
2007)
2008
2009AC_MSG_CHECKING(whether iconv supports UCS-4BE)
2010AC_RUN_IFELSE(
2011 [AC_LANG_PROGRAM([
2012#if HAVE_ICONV_H
2013#include <iconv.h>
2014#endif
2015 ], [
2016 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
2017 ])
2018 ],
2019 [ AC_MSG_RESULT(yes)
2020 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
2021 valid_ucs4_code="UCS-4BE"
2022 ],
2023 [ AC_MSG_RESULT(no) ],
2024 [ AC_MSG_RESULT(no) ]
2025)
2026
6e17f325
VK
2027AC_MSG_CHECKING(whether iconv supports UCS-4LE)
2028AC_RUN_IFELSE(
2029 [AC_LANG_PROGRAM([
2030#if HAVE_ICONV_H
2031#include <iconv.h>
2032#endif
2033 ], [
2034 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
2035 ])
2036 ],
2037 [ AC_MSG_RESULT(yes)
2038 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
2039 valid_ucs4_code="UCS-4LE"
2040 ],
2041 [ AC_MSG_RESULT(no) ],
2042 [ AC_MSG_RESULT(no) ]
2043)
2044
4a4e1feb
VK
2045AC_MSG_CHECKING(whether iconv supports UTF-32)
2046AC_RUN_IFELSE(
2047 [AC_LANG_PROGRAM([
2048#if HAVE_ICONV_H
2049#include <iconv.h>
2050#endif
2051 ], [
2052 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
2053 ])
2054 ],
2055 [ AC_MSG_RESULT(yes)
2056 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
2057 valid_ucs4_code="UTF-32"
2058 ],
2059 [ AC_MSG_RESULT(no) ],
2060 [ AC_MSG_RESULT(no) ]
2061)
2062
93571e7f
VK
2063AC_MSG_CHECKING(whether iconv supports //IGNORE)
2064AC_RUN_IFELSE(
2065 [AC_LANG_PROGRAM([
2066#if HAVE_ICONV_H
2067#include <iconv.h>
2068#endif
2069 ], [
2070 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
2071 ])
2072 ],
2073 [ AC_MSG_RESULT(yes)
2074 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
2075 ],
2076 [ AC_MSG_RESULT(no) ],
2077 [ AC_MSG_RESULT(no) ]
2078)
3e39fcde 2079
19619a35
AK
2080# taken from ZSH's configure
2081# Check if iconv uses const in prototype declaration
24b1570c 2082if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 2083 AC_LANG_PUSH([C++])
19619a35 2084 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
2085 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2086#include <stdlib.h>
f6a2136d 2087#if HAVE_ICONV_H
7f9423af 2088#include <iconv.h>
f6a2136d 2089#endif
f6a2136d
VK
2090 ]],
2091 [[
3e51d371
VK
2092 char **p = NULL;
2093 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 2094 ]])],
3e51d371
VK
2095 [ac_cv_iconv_const=const],
2096 [ac_cv_iconv_const=])])
53c96e2d 2097 AC_LANG_POP([C++])
19619a35
AK
2098 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2099 [Define as const if the declaration of iconv() needs const.])
2100fi
2101
a67fa146
VK
2102if test "x$ac_cv_type_wchar_t" = "xyes"; then
2103 if test $ac_cv_sizeof_wchar_t -eq 2; then
2104 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2105 fi
8b86c5dc 2106
a67fa146
VK
2107 if test $ac_cv_sizeof_wchar_t -eq 4; then
2108 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2109 fi
2110
2111 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2112 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2113 fi
2114else
2115 if test "x$BUILD_UNICODE" = "xyes"; then
2116 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2117 fi
8b86c5dc
VK
2118fi
2119
c29360a9 2120
ef0c727b 2121#--------------------------------------------------------------------
ca0f4ea3
VK
2122# MySQL
2123#--------------------------------------------------------------------
2124
2125check_substr "$COMPONENTS" "mysql"
2126if test $? = 0; then
6fce76d8 2127 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 2128 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 2129
8d131dda
VK
2130 OLD_LIBS="$LIBS"
2131 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 2132
9c29f76e
VK
2133 AC_MSG_CHECKING(whether mysql clients can run)
2134 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2135#include <stdio.h>
2136#include <mysql.h>
2137int main(void)
2138{
2139 MYSQL *a = mysql_init(NULL);
2140 return 0;
2141}
2142 ]])],[],[
2143 AC_MSG_RESULT(no)
2144 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
2145 ],[])
ca0f4ea3 2146 AC_MSG_RESULT(yes)
6fce76d8 2147
ca0f4ea3 2148 AC_CHECK_FUNCS(mysql_real_escape_string)
8d131dda 2149 LIBS="$OLD_LIBS"
ca0f4ea3
VK
2150fi
2151
2152
2153#--------------------------------------------------------------------
58ed4897
VK
2154# PostgreSQL
2155#--------------------------------------------------------------------
2156
203458b7 2157check_substr "$COMPONENTS" "pgsql"
58ed4897
VK
2158if test $? = 0; then
2159 AC_CHECK_LIB(m, floor)
6fce76d8 2160 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"],
58ed4897 2161 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
6fce76d8
VK
2162
2163 AC_MSG_CHECKING(whether postgresql clients can run)
8d131dda
VK
2164 OLD_LIBS="$LIBS"
2165 LIBS="$LIBS $PGSQL_LIBS"
6fce76d8
VK
2166 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2167 #include <stdio.h>
2168 #include <libpq-fe.h>
2169 int main(void)
2170 {
2171 PGconn *a = PQconnectdb("");
2172 return 0;
2173 }
2174 ]])],[AC_MSG_RESULT(yes)],[
58ed4897
VK
2175 AC_MSG_RESULT(no)
2176 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
2177 ],[])
8d131dda 2178 LIBS="$OLD_LIBS"
7070538d 2179 AC_CHECK_LIB(pq, PQfformat, [ AC_DEFINE(HAVE_PQFFORMAT, 1, PQfformat not exist in 7.3) ])
58ed4897
VK
2180fi
2181
2182
2183#--------------------------------------------------------------------
9c29f76e
VK
2184# ODBC
2185#--------------------------------------------------------------------
2186
2187check_substr "$COMPONENTS" "odbc"
2188if test $? = 0; then
6fce76d8 2189 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 2190 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
2191 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2192 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
2193 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
2194 fi
9c29f76e
VK
2195fi
2196
2197
2198#--------------------------------------------------------------------
41b4790d
VK
2199# Oracle
2200#--------------------------------------------------------------------
2201
2202check_substr "$COMPONENTS" "oracle"
2203if test $? = 0; then
2204 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
7d8c91ef
VK
2205 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
2206 [
2207 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
2208 ], [-lclntsh])
2209 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
2210 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 2211 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
2212 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2213 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
2214 fi
41b4790d
VK
2215fi
2216
84277a0f
AK
2217#--------------------------------------------------------------------
2218# DB2
2219#--------------------------------------------------------------------
2220
2221check_substr "$COMPONENTS" "db2"
2222if test $? = 0; then
2223 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
2224 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
2225 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
6afe141e 2226 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2227 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
2228 fi
84277a0f 2229fi
41b4790d
VK
2230
2231#--------------------------------------------------------------------
37861c72
VK
2232# Informix
2233#--------------------------------------------------------------------
2234
2235check_substr "$COMPONENTS" "informix"
2236if test $? = 0; then
2237 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
2238 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
2239 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
2240 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2241 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
2242 fi
37861c72
VK
2243fi
2244
c3cfc039
VK
2245
2246#--------------------------------------------------------------------
50e4bc8c
VK
2247# Java
2248#--------------------------------------------------------------------
2249
2250check_substr "$COMPONENTS" "java"
2251if test $? = 0; then
2252 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
2253# AC_CHECK_LIB(jvm, SQLAllocHandle, [JAVA_LIBS="-ljvm"],
2254# [AC_MSG_ERROR(libjvm is required for Java support)])
2255fi
2256
2257
2258#--------------------------------------------------------------------
ca0f4ea3
VK
2259# Other settings
2260#--------------------------------------------------------------------
2261
a5a95ac8
VK
2262if test "x$RUNTIME_PREFIX" = "x"; then
2263 if test "x${BUILD_UNICODE}" = "xyes"; then
2264 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\""
2265 else
2266 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\""
2267 fi
b07c50cc 2268else
a5a95ac8
VK
2269 if test "x${BUILD_UNICODE}" = "xyes"; then
2270 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\\\""
2271 else
2272 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"$RUNTIME_PREFIX\\\" -DDATADIR=\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=\\\"$RUNTIME_PREFIX/lib/netxms\\\""
2273 fi
b07c50cc 2274fi
545bda2d 2275LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 2276
25ae8377
VK
2277if test "x${ENABLE_WERROR}" = "xyes"; then
2278 CPPFLAGS="$CPPFLAGS -Werror"
2279fi
2280
cbc4d191
VK
2281if test "x$PLATFORM" = "xDarwin"; then
2282 SHLIB_SUFFIX=".so"
2283else
2284 if test "x$shrext_cmds" != "x"; then
2285 SHLIB_SUFFIX="$shrext_cmds"
2286 else
2287 SHLIB_SUFFIX=".so"
2288 fi
2b479c92 2289fi
cbc4d191 2290AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$SHLIB_SUFFIX"), [Define to platform's shared library suffix])
2b479c92 2291
551ec9ca 2292AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 2293AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
f5393033 2294AM_CONDITIONAL([USE_INTERNAL_JANSSON], [test "x$HAVE_JANSSON" = "xno"])
1fd41bcd 2295AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
c1165d33
VK
2296AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
2297AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
eca43970 2298AM_CONDITIONAL([USE_ENCRYPTION], [test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"])
6dde8627 2299AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
058bf6fc 2300AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
8b86c5dc 2301
ca0f4ea3
VK
2302
2303#--------------------------------------------------------------------
ef0c727b
VK
2304# Substitute variables
2305#--------------------------------------------------------------------
82fa7c5d 2306
ef0c727b
VK
2307AC_SUBST(DB_DRIVERS)
2308AC_SUBST(MODULES)
2309AC_SUBST(SUBAGENT_DIRS)
7dda4453 2310AC_SUBST(SERVER_INCLUDE)
7c48e2aa 2311AC_SUBST(SERVER_LIBS)
ef0c727b 2312AC_SUBST(SERVER_TOOLS)
c20f8eb7 2313AC_SUBST(SMSDRV_DIRS)
6fad8870 2314AC_SUBST(HDLINK_DIRS)
ef0c727b
VK
2315AC_SUBST(TOP_LEVEL_MODULES)
2316AC_SUBST(CONTRIB_MODULES)
c2612d83 2317AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
2318AC_SUBST(STATIC_SUBAGENT_LIST)
2319AC_SUBST(SUBAGENT_LIBS)
2320AC_SUBST(BUILD_SERVER)
447350a9 2321AC_SUBST(BUILD_SDK)
6fce76d8
VK
2322AC_SUBST(MYSQL_LIBS)
2323AC_SUBST(PGSQL_LIBS)
7d8c91ef 2324AC_SUBST(ORACLE_LIBS)
6fce76d8 2325AC_SUBST(ODBC_LIBS)
84277a0f 2326AC_SUBST(DB2_LIBS)
87f1fff0 2327AC_SUBST(INFORMIX_LIBS)
11ce9a66 2328AC_SUBST(OBJECT_MODE)
9113e749 2329AC_SUBST(SQLFLAGS)
cbc4d191 2330AC_SUBST(SHLIB_SUFFIX)
d16cf8a5 2331
ef0c727b
VK
2332#--------------------------------------------------------------------
2333# Shared libs versions
d16cf8a5
AK
2334#
2335# versioning scheme: current:revision:age
2336#
2337# current
2338# The number of the current interface exported by the library. A current
2339# value of `0', means that you are calling the interface exported by this
2340# library interface 0.
2341#
2342# revision
2343# The implementation number of the most recent interface exported by this
2344# library. In this case, a revision value of `0' means that this is the
2345# first implementation of the interface.
2346# If the next release of this library exports the same interface, but has a
2347# different implementation (perhaps some bugs have been fixed), the revision
2348# number will be higher, but current number will be the same. In that case,
2349# when given a choice, the library with the highest revision will always
2350# be used by the runtime loader.
2351#
2352# age
2353# The number of previous additional interfaces supported by this library.
2354# If age were `2', then this library can be linked into executables which
2355# were built with a release of this library that exported the current
2356# interface number, current, or any of the previous two interfaces.
2357# By definition age must be less than or equal to current. At the outset,
2358# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 2359#--------------------------------------------------------------------
d16cf8a5 2360
17b35ccc 2361NETXMS_LIBRARY_VERSION=1:0:0
c7d14846 2362AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 2363
ef0c727b
VK
2364#--------------------------------------------------------------------
2365# Generate output files
2366#--------------------------------------------------------------------
d16cf8a5
AK
2367
2368AC_CONFIG_FILES([
0c3c0c39
AK
2369 Makefile
2370 contrib/Makefile
36874eca
VK
2371 contrib/backgrounds/Makefile
2372 contrib/integration/Makefile
2373 contrib/integration/HP_EVA/Makefile
bad6cc0c 2374 contrib/integration/HP_P2000/Makefile
36874eca 2375 contrib/mibs/Makefile
0c3c0c39 2376 contrib/startup/Makefile
fa66d60c 2377 contrib/startup/debian/Makefile
daaefaaf 2378 contrib/startup/gentoo/Makefile
7483d0bf 2379 contrib/startup/hp-ux/Makefile
0c3c0c39 2380 contrib/startup/redhat/Makefile
5de3893d 2381 contrib/startup/suse/Makefile
9993edf4 2382 contrib/startup/ubuntu/Makefile
6adf3219 2383 contrib/startup/solaris/Makefile
0c3c0c39 2384 doc/Makefile
a48203d2
VK
2385 doc/internal/Makefile
2386 doc/manuals/Makefile
2387 doc/misc/Makefile
0c3c0c39
AK
2388 images/Makefile
2389 include/Makefile
2390 m4/Makefile
0c3c0c39 2391 src/Makefile
9191f6ad 2392 src/agent/Makefile
6ac698ed 2393 src/agent/appagent/Makefile
9191f6ad
VK
2394 src/agent/core/Makefile
2395 src/agent/install/Makefile
a2a24e9d 2396 src/agent/libnxsd/Makefile
9191f6ad 2397 src/agent/subagents/Makefile
9191f6ad 2398 src/agent/subagents/aix/Makefile
df8b3df7 2399 src/agent/subagents/darwin/Makefile
52f5ee00
VK
2400 src/agent/subagents/db2/Makefile
2401 src/agent/subagents/dbquery/Makefile
320f19e2 2402 src/agent/subagents/devemu/Makefile
80e96a82 2403 src/agent/subagents/ecs/Makefile
9191f6ad 2404 src/agent/subagents/freebsd/Makefile
80e96a82
VK
2405 src/agent/subagents/hpux/Makefile
2406 src/agent/subagents/informix/Makefile
9191f6ad 2407 src/agent/subagents/ipso/Makefile
50e4bc8c
VK
2408 src/agent/subagents/java/Makefile
2409 src/agent/subagents/java/java/Makefile
2410 src/agent/subagents/java/java/src/Makefile
2411 src/agent/subagents/java/java/src/main/Makefile
2412 src/agent/subagents/java/java/src/main/java/Makefile
2413 src/agent/subagents/java/java/src/main/java/org/Makefile
2414 src/agent/subagents/java/java/src/main/java/org/netxms/Makefile
2415 src/agent/subagents/java/java/src/main/java/org/netxms/agent/Makefile
80e96a82 2416 src/agent/subagents/linux/Makefile
df8b3df7 2417 src/agent/subagents/lmsensors/Makefile
80e96a82
VK
2418 src/agent/subagents/logwatch/Makefile
2419 src/agent/subagents/netbsd/Makefile
df8b3df7 2420 src/agent/subagents/netsvc/Makefile
80e96a82
VK
2421 src/agent/subagents/odbcquery/Makefile
2422 src/agent/subagents/openbsd/Makefile
4d1753cd 2423 src/agent/subagents/oracle/Makefile
9191f6ad 2424 src/agent/subagents/ping/Makefile
80e96a82 2425 src/agent/subagents/portCheck/Makefile
df8b3df7 2426 src/agent/subagents/rpi/Makefile
9191f6ad 2427 src/agent/subagents/sms/Makefile
80e96a82 2428 src/agent/subagents/sunos/Makefile
9191f6ad 2429 src/agent/subagents/ups/Makefile
80e96a82
VK
2430 src/agent/subagents/winnt/Makefile
2431 src/agent/subagents/winperf/Makefile
52f5ee00 2432 src/agent/subagents/wmi/Makefile
0bd64860 2433 src/agent/tools/Makefile
6ac698ed 2434 src/agent/tools/nxappget/Makefile
0bd64860 2435 src/agent/tools/nxapush/Makefile
c2612d83 2436 src/client/Makefile
551592f4 2437 src/client/install/Makefile
c94fa5c2 2438 src/client/nxalarm/Makefile
e84701c5 2439 src/client/nxevent/Makefile
9cb6c12f 2440 src/client/nxlexer/Makefile
e84701c5 2441 src/client/nxpush/Makefile
59ffa5b7 2442 src/client/nxsms/Makefile
9cb6c12f
VK
2443 src/client/scilexer/Makefile
2444 src/client/windows/Makefile
2445 src/client/windows/nxav/Makefile
2446 src/client/windows/nxav/res/Makefile
23c8c53e
AK
2447 src/client/windows/nxcon/Makefile
2448 src/client/windows/nxcon/icons/Makefile
2449 src/client/windows/nxcon/res/Makefile
23c8c53e
AK
2450 src/client/windows/nxnotify/Makefile
2451 src/client/windows/nxnotify/res/Makefile
9cb6c12f
VK
2452 src/client/windows/nxuilib/Makefile
2453 src/client/windows/nxuilib/res/Makefile
2454 src/client/windows/nxuilib/sounds/Makefile
d1834406
VK
2455 src/db/Makefile
2456 src/db/dbdrv/Makefile
87f1fff0
VK
2457 src/db/dbdrv/db2/Makefile
2458 src/db/dbdrv/informix/Makefile
d1834406
VK
2459 src/db/dbdrv/odbc/Makefile
2460 src/db/dbdrv/mssql/Makefile
2461 src/db/dbdrv/mysql/Makefile
87f1fff0 2462 src/db/dbdrv/oracle/Makefile
d1834406
VK
2463 src/db/dbdrv/pgsql/Makefile
2464 src/db/dbdrv/sqlite/Makefile
d1834406 2465 src/db/libnxdb/Makefile
9191f6ad
VK
2466 src/install/Makefile
2467 src/install/windows/Makefile
f5393033 2468 src/jansson/Makefile
9191f6ad
VK
2469 src/libexpat/Makefile
2470 src/libexpat/libexpat/Makefile
2471 src/libnetxms/Makefile
2472 src/libnxcl/Makefile
2473 src/libnxlp/Makefile
2474 src/libnxmap/Makefile
2475 src/libnxsl/Makefile
058bf6fc 2476 src/libstrophe/Makefile
a67fa146
VK
2477 src/libtre/Makefile
2478 src/libtre/win32/Makefile
a7a03ffd 2479 src/nxcproxy/Makefile
9191f6ad 2480 src/nxscript/Makefile
0c3c0c39
AK
2481 src/server/Makefile
2482 src/server/core/Makefile
644f97f5 2483 src/server/drivers/Makefile
386f88e3 2484 src/server/drivers/airespace/Makefile
0239cfea 2485 src/server/drivers/at/Makefile
644f97f5 2486 src/server/drivers/baystack/Makefile
b1bd1fb2 2487 src/server/drivers/cat2900xl/Makefile
910846cc 2488 src/server/drivers/catalyst/Makefile
fce03ab9 2489 src/server/drivers/cisco-esw/Makefile
ae8ea5a6 2490 src/server/drivers/cisco-sb/Makefile
8bdfaed8 2491 src/server/drivers/dell-pwc/Makefile
a548def4 2492 src/server/drivers/dlink/Makefile
644f97f5 2493 src/server/drivers/ers8000/Makefile
4e592faf
VK
2494 src/server/drivers/lib/Makefile
2495 src/server/drivers/lib/avaya-ers/Makefile
b1bd1fb2 2496 src/server/drivers/lib/cisco/Makefile
a73592db 2497 src/server/drivers/mikrotik/Makefile
81ecaf38 2498 src/server/drivers/netscreen/Makefile
e10e890e 2499 src/server/drivers/ntws/Makefile
c183a9f9 2500 src/server/drivers/ping3/Makefile
9b13553b 2501 src/server/drivers/procurve/Makefile
217e4d6a 2502 src/server/drivers/symbol-ws/Makefile
8cf94ffe 2503 src/server/drivers/ubnt/Makefile
6fad8870
VK
2504 src/server/hdlink/Makefile
2505 src/server/hdlink/jira/Makefile
d770a97c
VK
2506 src/server/include/Makefile
2507 src/server/libnxsrv/Makefile
2508 src/server/netxmsd/Makefile
d8f2e39b 2509 src/server/smsdrv/Makefile
8d7f1bea 2510 src/server/smsdrv/dummy/Makefile
d8f2e39b 2511 src/server/smsdrv/generic/Makefile
91369aca 2512 src/server/smsdrv/nxagent/Makefile
aab8a8b6 2513 src/server/smsdrv/portech/Makefile
8d7f1bea 2514 src/server/smsdrv/websms/Makefile
0c3c0c39 2515 src/server/tools/Makefile
0c3c0c39
AK
2516 src/server/tools/nxaction/Makefile
2517 src/server/tools/nxadm/Makefile
9191f6ad 2518 src/server/tools/nxap/Makefile
5b0c7d0d
VK
2519 src/server/tools/nxconfig/Makefile
2520 src/server/tools/nxconfig/res/Makefile
f90d7fc5 2521 src/server/tools/nxdbmgr/Makefile
9191f6ad 2522 src/server/tools/nxget/Makefile
d24fdaf4 2523 src/server/tools/nxupload/Makefile
c5c0f362
VK
2524 src/snmp/Makefile
2525 src/snmp/libnxsnmp/Makefile
2526 src/snmp/nxmibc/Makefile
2527 src/snmp/nxsnmpget/Makefile
2528 src/snmp/nxsnmpset/Makefile
2529 src/snmp/nxsnmpwalk/Makefile
9191f6ad 2530 src/sqlite/Makefile
f65df2b1 2531 src/tools/Makefile
f65df2b1 2532 src/tools/nxdevcfg/Makefile
56e13b13 2533 src/tools/nxencpasswd/Makefile
1fd41bcd 2534 src/zlib/Makefile
9191f6ad 2535 sql/Makefile
0c3c0c39 2536 tools/Makefile
d16cf8a5
AK
2537])
2538
12249937
VK
2539AC_OUTPUT
2540
ef0c727b 2541echo "Updating libtool"
5cecf50e
AK
2542sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2543
779ce551 2544# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
5482ef16 2545if test "x$ac_compiler_gnu" = "xyes" && test "x$PLATFORM" = "xHP-UX"; then
779ce551
VK
2546 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2547fi
2548
b677ef59
VK
2549# On AIX, correct OBJECT_MODE must be set before linking
2550# To avoid manual setting by user, we add this to libtool script
2551if test "x$PLATFORM" = "xAIX"; then
2552 head -n 1 ./libtool > ./libtool.new
2553 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
2554 tail -n +2 ./libtool >> ./libtool.new
2555 mv libtool.new libtool
2556 chmod +x ./libtool
2557fi
2558
ef0c727b
VK
2559#--------------------------------------------------------------------
2560# Print summary
2561#--------------------------------------------------------------------
a7442678 2562
a7442678
AK
2563echo
2564echo
2565echo
2566echo '---------------------------------------------------------------------'
2567echo ' Configure results'
2568echo '---------------------------------------------------------------------'
2569echo
8b86c5dc 2570 echo "Prefix : ${prefix}"
cbc4d191
VK
2571 echo "Platform : ${PLATFORM}"
2572 echo "Shared library suffix : ${SHLIB_SUFFIX}"
a7442678 2573if test "x${BUILD_SERVER}" = "xyes"; then
8b86c5dc 2574 echo "Build Server : YES"
7c48e2aa 2575 echo "Server libs : ${SERVER_LIBS}"
058bf6fc
VK
2576 if test "x${XMPP_SUPPORT}" = "xyes"; then
2577 echo "XMPP support : YES"
2578 else
2579 echo "XMPP support : NO"
2580 fi
a7442678 2581else
8b86c5dc 2582 echo "Build Server : NO"
a7442678
AK
2583fi
2584if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
8b86c5dc 2585 echo "Encryption enabled : YES"
a7442678 2586else
8b86c5dc 2587 echo "Encryption enabled : NO"
a7442678
AK
2588fi
2589if test "x${DB_DRIVERS}" != "x"; then
8b86c5dc 2590 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678 2591else
8b86c5dc 2592 echo "Build DB-Drivers : NO"
a7442678
AK
2593fi
2594if test "x${BUILD_CLIENT}" = "xyes"; then
8b86c5dc 2595 echo "Build Clients : YES"
a7442678 2596else
8b86c5dc 2597 echo "Build Clients : NO"
a7442678
AK
2598fi
2599if test "x${BUILD_AGENT}" = "xyes"; then
8b86c5dc
VK
2600 echo "Build Agent : YES"
2601 echo "Subagents list : ${SUBAGENT_DIRS}"
a7442678 2602else
8b86c5dc 2603 echo "Build Agent : NO"
a7442678 2604fi
e8636669 2605if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
8b86c5dc
VK
2606 echo "Build Static Agent : YES"
2607 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
e8636669 2608else
8b86c5dc 2609 echo "Build Static Agent : NO"
e8636669 2610fi
8b86c5dc 2611if test "x${BUILD_UNICODE}" = "xyes"; then
a67fa146 2612 echo "UNICODE build : YES"
8b86c5dc 2613else
a67fa146 2614 echo "UNICODE build : NO"
8b86c5dc 2615fi
551ec9ca
VK
2616if test "x${HAVE_LIBEXPAT}" = "xno"; then
2617 echo "Use internal libexpat : YES"
1bb6b449 2618else
551ec9ca 2619 echo "Use internal libexpat : NO"
1bb6b449 2620fi
17b35ccc
VK
2621if test "x${HAVE_LIBTRE}" = "xno"; then
2622 echo "Use internal libtre : YES"
2623else
2624 echo "Use internal libtre : NO"
2625fi
f5393033
VK
2626if test "x${HAVE_JANSSON}" = "xno"; then
2627 echo "Use internal libjansson : YES"
2628else
2629 echo "Use internal libjansson : NO"
2630fi
1fd41bcd
VK
2631if test "x${NEED_ZLIB}" = "xyes"; then
2632 if test "x${HAVE_ZLIB}" = "xno"; then
2633 echo "Use internal zlib : YES"
2634 else
2635 echo "Use internal zlib : NO"
2636 fi
2637fi
cc297a70
VK
2638if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
2639 echo "Force 32bit build : YES"
2640else
2641 echo "Force 32bit build : NO"
2642fi
7d8c91ef 2643
9113e749
VK
2644echo "C compiler : ${CC}"
2645echo "C++ compiler : ${CXX}"
7d8c91ef
VK
2646echo "CPPFLAGS : ${CPPFLAGS}"
2647echo "CXXFLAGS : ${CXXFLAGS}"
2648echo "CFLAGS : ${CFLAGS}"
2649echo "LDFLAGS : ${LDFLAGS}"
8d131dda 2650echo "LIBS : ${LIBS}"
7d8c91ef 2651
6fce76d8
VK
2652if test "x${MYSQL_LIBS}" != "x"; then
2653 echo "MySQL libs : ${MYSQL_LIBS}"
2654fi
2655if test "x${PGSQL_LIBS}" != "x"; then
2656 echo "PostgreSQL libs : ${PGSQL_LIBS}"
2657fi
7d8c91ef
VK
2658if test "x${ORACLE_LIBS}" != "x"; then
2659 echo "Oracle libs : ${ORACLE_LIBS}"
2660fi
6fce76d8
VK
2661if test "x${ODBC_LIBS}" != "x"; then
2662 echo "ODBC libs : ${ODBC_LIBS}"
2663fi
84277a0f
AK
2664if test "x${DB2_LIBS}" != "x"; then
2665 echo "DB2 libs : ${DB2_LIBS}"
2666fi
37861c72
VK
2667if test "x${INFORMIX_LIBS}" != "x"; then
2668 echo "Informix libs : ${INFORMIX_LIBS}"
2669fi
ecbed20c
VK
2670
2671FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
2672echo "/* Automatically generated by configure */" > $FLAGS_CPP
d541b129
VK
2673echo "#include <nms_common.h>" >> $FLAGS_CPP
2674echo "const TCHAR *g_cppFlags = _T(\"${CPPFLAGS}\");" >> $FLAGS_CPP
2675echo "const TCHAR *g_cFlags = _T(\"${CFLAGS}\");" >> $FLAGS_CPP
2676echo "const TCHAR *g_cxxFlags = _T(\"${CXXFLAGS}\");" >> $FLAGS_CPP
2677echo "const TCHAR *g_ldFlags = _T(\"${LDFLAGS}\");" >> $FLAGS_CPP
2678echo "const TCHAR *g_libs = _T(\"${LIBS}\");" >> $FLAGS_CPP
7dda4453
VK
2679echo "const TCHAR *g_cc = _T(\"${CC}\");" >> $FLAGS_CPP
2680echo "const TCHAR *g_cxx = _T(\"${CXX}\");" >> $FLAGS_CPP
2681echo "const TCHAR *g_ld = _T(\"${LD}\");" >> $FLAGS_CPP
2682echo "const TCHAR *g_perl = _T(\"${PERL}\");" >> $FLAGS_CPP