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