Fixed size of possible range for y axis for charts
[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
906 AC_MSG_CHECKING(whether C compiler accepts +DD32)
4d37b0c5 907 OLD_CPPFLAGS="$CPPFLAGS"
cfd95c74
VK
908 CPPFLAGS="+DD32 $CPPFLAGS"
909 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
910 [
911 LDFLAGS="+DD32 $LDFLAGS"
912 AC_MSG_RESULT(yes)
913 ],
914 [
4d37b0c5
VK
915 CPPFLAGS="$OLD_CPPFLAGS"
916 AC_MSG_RESULT(no)
cfd95c74 917 ])
4d37b0c5 918 else
cfd95c74
VK
919 AC_MSG_CHECKING(whether C compiler accepts +DD64)
920 OLD_CPPFLAGS="$CPPFLAGS"
921 CPPFLAGS="+DD64 $CPPFLAGS"
922 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
923 [
924 LDFLAGS="+DD64 $LDFLAGS"
925 AC_MSG_RESULT(yes)
926 ],
927 [
928 CPPFLAGS="$OLD_CPPFLAGS"
929 AC_MSG_RESULT(no)
930 ])
4d37b0c5 931 fi
ef0c727b
VK
932fi
933
df9812a9 934if test "x$CXX" = "xxlC_r" ; then
d1cb61cf 935 SQLFLAGS="-qnoppline"
9b99f1c0
VK
936 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
937 AC_MSG_CHECKING(whether C compiler accepts -q32)
938 OLD_CPPFLAGS="$CPPFLAGS"
939 CPPFLAGS="-q32 $CPPFLAGS"
940 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
941 [
942 LDFLAGS="-q32 $LDFLAGS"
df9812a9 943 OBJECT_MODE=32
9b99f1c0
VK
944 AC_MSG_RESULT(yes)
945 ],
946 [
947 CPPFLAGS="$OLD_CPPFLAGS"
948 AC_MSG_RESULT(no)
949 ])
950 else
951 AC_MSG_CHECKING(whether C compiler accepts -q64)
952 OLD_CPPFLAGS="$CPPFLAGS"
953 CPPFLAGS="-q64 $CPPFLAGS"
954 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
955 [
956 LDFLAGS="-q64 $LDFLAGS"
df9812a9 957 OBJECT_MODE=64
9b99f1c0
VK
958 AC_MSG_RESULT(yes)
959 ],
960 [
961 CPPFLAGS="$OLD_CPPFLAGS"
962 AC_MSG_RESULT(no)
963 ])
964 fi
965fi
966
9113e749
VK
967if test "x$CXX" = "xCC" ; then
968 SQLFLAGS="-Qn"
969 CPPFLAGS="$CPPFLAGS -mt"
970
971 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
972 AC_MSG_CHECKING(whether C compiler accepts -m32)
f5e5296e
VK
973 count=`$CC -flags | grep '^\-m32 ' | wc -l`
974 if test $count -eq 1; then
975 AC_MSG_RESULT(yes)
976 CPPFLAGS="$CPPFLAGS -m32"
977 LDFLAGS="-m32 $LDFLAGS"
978 else
979 AC_MSG_RESULT(no)
980 fi
9113e749 981 else
c3900dbb 982 TEST_XARCH="no"
9113e749 983 AC_MSG_CHECKING(whether C compiler accepts -m64)
f5e5296e
VK
984 count=`$CC -flags | grep '^\-m64 ' | wc -l`
985 if test $count -eq 1; then
986 AC_MSG_RESULT(yes)
987 CPPFLAGS="$CPPFLAGS -m64"
988 LDFLAGS="-m64 $LDFLAGS"
989 else
990 AC_MSG_RESULT(no)
991 TEST_XARCH="yes"
992 fi
c3900dbb
VK
993 if test "x$TEST_XARCH" = "xyes"; then
994 if test "x$CPUTYPE" = "xsparc"; then
995 ARCH="-xarch=v9"
996 else
997 ARCH="-xarch=amd64"
998 fi
999 AC_MSG_CHECKING(whether C compiler accepts $ARCH)
1000 OLD_CPPFLAGS="$CPPFLAGS"
1001 CPPFLAGS="$CPPFLAGS $ARCH"
1002 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1003 [
1004 LDFLAGS="$ARCH $LDFLAGS"
1005 AC_MSG_RESULT(yes)
1006 ],
1007 [
1008 CPPFLAGS="$OLD_CPPFLAGS"
1009 AC_MSG_RESULT(no)
1010 ])
1011 fi
9113e749
VK
1012 fi
1013fi
1014
edb018d7
VK
1015
1016#--------------------------------------------------------------------
1017# Initialize libtool
1018#--------------------------------------------------------------------
1019
1020if test "x$STATIC_BUILD" = "xyes"; then
1021 enable_shared=no
1022 enable_static=yes
1023else
1024 enable_shared=yes
e99eba92
VK
1025 if test "x$BUILD_SDK" = "xyes"; then
1026 enable_static=yes
1027 else
1028 enable_static=no
1029 fi
edb018d7 1030fi
1ef5e57a
VK
1031
1032if test "x$LTINIT_CC" != "x"; then
1033 SAVED_CC="$CC"
1034 CC="$LTINIT_CC"
1035fi
1036if test "x$LTINIT_CXX" != "x"; then
1037 SAVED_CXX="$CXX"
1038 CXX="$LTINIT_CXX"
1039fi
1040
ff12e2f1 1041LT_PREREQ([2.2])
1ef5e57a
VK
1042LT_INIT([dlopen])
1043
1044if test "x$SAVED_CC" != "x"; then
1045 CC="$SAVED_CC"
1046fi
1047if test "x$SAVED_CXX" != "x"; then
1048 CXX="$SAVED_CXX"
1049fi
edb018d7
VK
1050
1051
cfd95c74
VK
1052#--------------------------------------------------------------------
1053# Additional include and library directories
1054#--------------------------------------------------------------------
ef0c727b 1055
cfd95c74
VK
1056if test "x$CXX" != "xaCC"; then
1057 if test -d /usr/local/include; then
5482ef16 1058 if test "x$ac_compiler_gnu" = "xyes"; then
cfd95c74
VK
1059 AC_MSG_CHECKING(whether -I/usr/local/include needed)
1060 OLD_CPPFLAGS="$CPPFLAGS"
1061 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
2adc2d49 1062 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
cfd95c74
VK
1063 [
1064 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
1065 AC_MSG_RESULT(yes)
1066 ],
1067 [
1068 CPPFLAGS="$OLD_CPPFLAGS"
1069 AC_MSG_RESULT(no)
1070 ]
1071 )
1072 else
1073 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
1074 fi
1075 fi
1076
1077 if test -d /usr/kerberos/include; then
1078 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1079 fi
ef0c727b 1080
cfd95c74
VK
1081 if test -d /usr/local/lib; then
1082 LDFLAGS="$LDFLAGS -L/usr/local/lib"
1083 fi
1084fi
ef0c727b
VK
1085
1086#--------------------------------------------------------------------
1087# Check for threads library - either POSIX or GNU
1088#--------------------------------------------------------------------
1089
1090if test "x$USE_PTH" = "xyes"; then
1091 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
1092else
1093 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
1094
1095 if test "x$CXX" = "xaCC"; then
1096 PTHREAD_LIBS=""
1097 else
1098 PTHREAD_LIBS="error"
1099 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
1100 AC_EGREP_CPP(yes,
1101 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
1102 yes
1103 #endif
1104 ], AC_MSG_RESULT(yes)
fecf6a2b 1105 PTHREAD_LIBS="-pthread",
ef0c727b
VK
1106 AC_MSG_RESULT(no))
1107 if test "x$PTHREAD_LIBS" = "xerror"; then
1108 AC_CHECK_LIB(pthread, pthread_attr_init,
1109 PTHREAD_LIBS="-lpthread")
1110 fi
f725c1b7 1111 # On HP-UX (at least 11.00) pthread library contains
b041c587 1112 # __pthread_attr_init_system instead of pthread_attr_init
f725c1b7 1113 if test "x$PTHREAD_LIBS" = "xerror"; then
b041c587 1114 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
f725c1b7
VK
1115 PTHREAD_LIBS="-lpthread")
1116 fi
ef0c727b
VK
1117 if test "x$PTHREAD_LIBS" = "xerror"; then
1118 AC_CHECK_LIB(pthreads, pthread_attr_init,
1119 PTHREAD_LIBS="-lpthreads")
1120 fi
1121 if test "x$PTHREAD_LIBS" = "xerror"; then
1122 AC_CHECK_FUNC(pthread_attr_init,
1123 PTHREAD_LIBS="")
1124 fi
1125 fi
1126
1127 if test "x$PTHREAD_LIBS" = "xerror"; then
1128 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
1129 fi
8d131dda 1130 LIBS="$LIBS $PTHREAD_LIBS"
ef0c727b
VK
1131
1132 # Extensions to posix threads
1133 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 1134#include <pthread.h>
ef0c727b
VK
1135 ])
1136 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
1137
1138 # Check for recursive mutexes
39086394
VK
1139 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
1140 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
1141#include <pthread.h>
1142#if HAVE_PTHREAD_NP_H
1143#include <pthread_np.h>
1144#endif
ef0c727b
VK
1145 ])
1146
1147 # Check for read/write locks
1148 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
1149 # additional defines
1150 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
1151 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
1152 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
afd0c386
VK
1153 [AC_COMPILE_IFELSE([
1154 AC_LANG_PROGRAM([
9c29f76e
VK
1155#include <sys/types.h>
1156#include <pthread.h>
afd0c386
VK
1157 ],
1158 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b 1159 ac_cv_struct_pthread_rw=yes, [
afd0c386
VK
1160 AC_COMPILE_IFELSE([
1161 AC_LANG_PROGRAM([
9c29f76e
VK
1162#define _XOPEN_SOURCE 500
1163#include <sys/types.h>
1164#include <pthread.h>
afd0c386
VK
1165 ],
1166 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b
VK
1167 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
1168 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1169 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
1170 fi
1171 ])])
1172 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1173 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
1174 fi
1175 fi
1176
1177fi
1178
1179
1180#--------------------------------------------------------------------
1181# Checks for OpenSSL
1182#--------------------------------------------------------------------
1183
1184if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
1185 AC_CHECK_LIB(crypto, RSA_new,
1186 [
1187 AC_DEFINE(WITH_OPENSSL,,[with openssl])
1188 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
e0a77f08 1189 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
ef0c727b 1190 AC_CHECK_LIB(crypto, EVP_bf_cbc,
e0a77f08 1191 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
ef0c727b 1192 AC_CHECK_LIB(crypto, EVP_idea_cbc,
e0a77f08 1193 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
ef0c727b 1194 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
e0a77f08 1195 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
d27e7413 1196 SERVER_LIBS="$SERVER_LIBS -lssl"
e0a77f08
VK
1197 if test "x$HAVE_LIBCRYPTO" = "xyes"; then
1198 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
1199# LIBS="$LIBS -Wl,-Bstatic -lcrypto -Wl,-Bdynamic"
1200 LIBS="$LIBS -lcrypto"
1201 else
1202 LIBS="$LIBS -lcrypto"
1203 fi
1204 else
058bf6fc 1205 AC_MSG_ERROR(libcrypto does not provide any suitable encryption algorithm)
e0a77f08 1206 fi
ef0c727b
VK
1207 ],
1208 [
058bf6fc 1209 AC_MSG_ERROR(libcrypto is required for encryption support)
ef0c727b
VK
1210 ])
1211fi
1212
1213
1214#--------------------------------------------------------------------
0322eed7
VK
1215# Checks for header files
1216#--------------------------------------------------------------------
1217
1218AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h alloca.h])
2e98cdb4 1219AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h sys/wait.h])
e9c8eb1d 1220AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h netinet/tcp.h net/nh.h sys/socket.h])
0322eed7
VK
1221AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
1222AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
c1099678 1223AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h locale.h])
df9812a9 1224AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
f09c2d05 1225AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
1226[[#ifdef HAVE_SYS_TYPES_H
1227# include <sys/types.h>
1228#endif
1229#ifdef HAVE_SYS_TIME_H
1230# include <sys/time.h>
1231#endif
1232#ifdef HAVE_SYS_SOCKET_H
1233# include <sys/socket.h>
1234#endif
1235]])
1236
1237
1238#--------------------------------------------------------------------
ef0c727b
VK
1239# Checks for other libs.
1240#--------------------------------------------------------------------
d16cf8a5 1241
779ce551 1242AC_CHECK_LIB(xnet, accept)
521d90e7 1243AC_CHECK_LIB(socket, if_nameindex)
87bb64a7 1244AC_CHECK_LIB(dl, dlopen)
1b3c0ef0 1245AC_CHECK_LIB(kstat, kstat_open)
d16cf8a5 1246
e0760102 1247if test "x$BUILD_SERVER" = "xyes" ; then
7c48e2aa
VK
1248 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"]))])
1249 AC_CHECK_LIB(readline, readline, [SERVER_LIBS="$SERVER_LIBS -lreadline"], [AC_CHECK_LIB(edit, readline, [SERVER_LIBS="$SERVER_LIBS -ledit"])])
1250 SAVED_LDFLAGS="$LDFLAGS"
1251 LDFLAGS="$LDFLAGS $SERVER_LIBS"
1252
0322eed7
VK
1253 AC_CHECK_FUNCS([readline])
1254
1255 # Check if passing rl_insert to rl_bind_key needs cast
1256 if test "$ac_cv_func_readline" = "yes"; then
1257 AC_LANG_PUSH([C++])
1258
1259 AC_MSG_CHECKING(for rl_insert cast)
1260
afd0c386 1261 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1262 [
1263#include <stdio.h>
1264#include <readline/readline.h>
afd0c386 1265 ],[ rl_bind_key('\t', (Function *)rl_insert); ])],
0322eed7
VK
1266 [
1267 AC_MSG_RESULT((Function *))
1268 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
1269 ],[
afd0c386 1270 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1271 [
1272#include <stdio.h>
1273#include <readline/readline.h>
afd0c386 1274 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ])],
0322eed7
VK
1275 [
1276 AC_MSG_RESULT((rl_command_func_t *))
1277 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
1278 ],[
1279 AC_MSG_RESULT(not needed)
1280 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
1281 ]
1282 )
1283 ]
1284 )
1285
1286 AC_LANG_POP([C++])
1287 fi
7c48e2aa 1288 LDFLAGS="$SAVED_LDFLAGS"
e0760102
VK
1289fi
1290
ef0c727b 1291if test "x$NEED_ZLIB" = "xyes"; then
1fd41bcd
VK
1292 if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
1293 HAVE_ZLIB=no
1294 else
1295 HAVE_ZLIB=yes
1296 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
1297 if test "x$HAVE_ZLIB" = "xyes"; then
1298 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
1299 fi
1300 fi
1301 if test "x$HAVE_ZLIB" = "xno"; then
1302 MODULES="zlib $MODULES"
1303 fi
ef0c727b
VK
1304fi
1305
467c489f
VK
1306if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
1307 HAVE_LIBEXPAT=no
1308else
1309 HAVE_LIBEXPAT=yes
1310 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
1311 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
1312fi
80ce37ac
VK
1313if test "x$HAVE_LIBEXPAT" = "xno"; then
1314 MODULES="libexpat $MODULES"
1bb6b449 1315fi
ef0c727b 1316
17b35ccc
VK
1317if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
1318 HAVE_LIBTRE=no
1319else
1320 HAVE_LIBTRE=yes
1321 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
1322 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
1323fi
1324if test "x$HAVE_LIBTRE" = "xno"; then
1325 MODULES="libtre $MODULES"
1326 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
a67fa146 1327
720c23d0
VK
1328 tre_version_1='0'
1329 tre_version_2='8'
1330 tre_version_3='0'
a67fa146
VK
1331 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
1332 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
1333 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
1334 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
1335 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
1336 AC_SUBST(TRE_VERSION, $tre_version)
1337
1338 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])
1339 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
17b35ccc 1340fi
ef0c727b 1341
4050bafb
VK
1342if test "x$DISABLE_LMSENSORS" = "xno"; then
1343 HAVE_LMSENSORS=yes
1344 AC_CHECK_HEADER(sensors/sensors.h,,HAVE_LMSENSORS=no)
1345 if test "x$HAVE_LMSENSORS" = "xyes"; then
1346 AC_CHECK_LIB(sensors, sensors_init, [ DUMMY="" ], [ HAVE_LMSENSORS=no ])
1347 fi
1348 if test "x$HAVE_LMSENSORS" = "xyes"; then
1349 SUBAGENT_DIRS="$SUBAGENT_DIRS lmsensors"
1350 fi
38bfa5da
AK
1351fi
1352
0a4194c2
AK
1353AC_CHECK_HEADER(curl/curl.h,HAVE_LIBCURL=yes,HAVE_LIBCURL=no)
1354if test "x$HAVE_LIBCURL" = "xyes"; then
2368dc85
VK
1355 AC_CHECK_LIB(curl, curl_global_init, [ HAVE_LIBCURL=yes ], [ HAVE_LIBCURL=no ])
1356 AC_CHECK_DECLS([CURLOPT_NOSIGNAL, curl_version_info],,,[
1357#ifdef HAVE_CURL_CURL_H
1358#include <curl/curl.h>
1359#endif
1360])
0a4194c2
AK
1361fi
1362if test "x$HAVE_LIBCURL" = "xyes"; then
c80c69bd 1363 SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
0a4194c2
AK
1364fi
1365
ef0c727b
VK
1366#--------------------------------------------------------------------
1367# Checks for data types
1368#--------------------------------------------------------------------
1369
d16cf8a5
AK
1370AC_CHECK_SIZEOF(short)
1371AC_CHECK_SIZEOF(int)
1372AC_CHECK_SIZEOF(long)
1373AC_CHECK_SIZEOF(long long)
1374
1375AC_TYPE_PID_T
d16cf8a5
AK
1376AC_TYPE_SIZE_T
1377AC_STRUCT_TIMEZONE
1378
3071f10a 1379AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
51128b42 1380AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
1381#if HAVE_SYS_TYPES_H
1382#include <sys/types.h>
1383#endif
1384#if HAVE_SYS_SOCKET_H
1385#include <sys/socket.h>
1386#endif
1387])
e0293f7f
VK
1388AC_CHECK_TYPES([struct stat64],,,[
1389#if HAVE_SYS_STAT_H
1390#include <sys/stat.h>
1391#endif
1392])
521d90e7 1393
e25cadc9 1394
ef0c727b
VK
1395#--------------------------------------------------------------------
1396# Checks for functions
1397#--------------------------------------------------------------------
d16cf8a5
AK
1398
1399AC_FUNC_ERROR_AT_LINE
d16cf8a5 1400AC_FUNC_MEMCMP
d16cf8a5
AK
1401AC_FUNC_SELECT_ARGTYPES
1402AC_FUNC_STRFTIME
1403AC_FUNC_STRTOD
1404AC_FUNC_VPRINTF
1405
80ce37ac 1406AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
c1099678 1407AC_CHECK_FUNCS([strrchr strlwr strtol strtoul strtoll strtoull setlocale])
467e30e1 1408AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
c601fc15 1409AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
aa24418a
VK
1410
1411AC_CHECK_DECLS([nanosleep])
be6467e9 1412
b0823d06
VK
1413# Check if strerror_r is POSIX-compliant
1414if test "$ac_cv_func_strerror_r" = "yes"; then
1415 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1416 AC_LANG_PUSH([C++])
1417 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
1418#if HAVE_STRING_H
1419#include <string.h>
1420#endif
1421#if HAVE_ERRNO_H
1422#include <errno.h>
1423#endif
b0823d06 1424 ]],[[
7f9423af
VK
1425 int e;
1426 char buffer[256];
1427 e = strerror_r(1, buffer, 256);
1428 return e;
b0823d06
VK
1429 ]])
1430 ],[
1431 AC_MSG_RESULT(yes)
1432 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1433 ],[
1434 AC_MSG_RESULT(no)
1435 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1436 ])
1437 AC_LANG_POP([C++])
1438fi
1439
be6467e9
VK
1440# Check if timezone is a function
1441AC_MSG_CHECKING(for timezone function)
1442AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1443#if HAVE_TIME_H
1444#include <time.h>
1445#endif
1446#if HAVE_SYS_TIME_H
1447#include <sys/time.h>
1448#endif
1449]],[[
be6467e9 1450 timezone(0, 0);
be6467e9
VK
1451]])
1452],[
1453AC_MSG_RESULT(yes)
1454AC_DEFINE(HAVE_TIMEZONE,1,Define to 1 if timezone function is available)
1455],[
1456AC_MSG_RESULT(no)
445cba33
VK
1457AC_CHECK_DECLS([timezone],,,[
1458#if HAVE_TIME_H
1459#include <time.h>
1460#endif
1461#if HAVE_SYS_TIME_H
1462#include <sys/time.h>
1463#endif
1464])
be6467e9
VK
1465])
1466
1467# Check if struct tm has tm_gmtoff member
1468AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1469AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1470#if HAVE_TIME_H
1471#include <time.h>
1472#endif
1473#if HAVE_SYS_TIME_H
1474#include <sys/time.h>
1475#endif
1476]],[[
be6467e9
VK
1477 struct tm t;
1478 return t.tm_gmtoff;
be6467e9
VK
1479]])
1480],[
1481AC_MSG_RESULT(yes)
1482AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1483],[
1484AC_MSG_RESULT(no)
1485])
d16cf8a5 1486
f91feddc 1487AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
1488AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1489
058bf6fc 1490# sockets/resolver
d00ad4c6
VK
1491if test "$BUILD_SERVER-$XMPP_SUPPORT" = "yes-yes"; then
1492 AC_CHECK_HEADERS([arpa/nameser_compat.h])
1493 AC_CHECK_FUNC(res_query, , [AC_CHECK_LIB(resolv, res_query, [], [AC_CHECK_LIB(resolv, __res_query)])])
1494fi
d16cf8a5
AK
1495AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1496AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1497AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1498
1499if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1500 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1501fi
1502
1503if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1504 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1505 LIBS="-lnsl -lsocket $LIBS"
1506 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1507 if test "$my_ac_link_result" = "no" ; then
1508 AC_MSG_RESULT([failure])
1509 AC_MSG_ERROR([unable to use gethostbyname()])
1510 else
1511 AC_MSG_RESULT([success])
1512 fi
1513fi
1514
c6491611
VK
1515# asprintf, scprintf, etc.
1516AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1517AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
1518
1519AC_MSG_CHECKING(whether snprintf returns required buffer size)
1520AC_RUN_IFELSE(
1521 [AC_LANG_PROGRAM([
1522#include <stdio.h>
1523#include <string.h>
1524 ], [
1525 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1526 ])
1527 ],
1528 [ AC_MSG_RESULT(yes)
1529 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1530 ],
1531 [ AC_MSG_RESULT(no) ],
1532 [ AC_MSG_RESULT(no) ]
1533)
1534
1535
dff54fed 1536
ef0c727b
VK
1537#--------------------------------------------------------------------
1538# Checks for macros and definitions
1539#--------------------------------------------------------------------
dff54fed 1540
ef0c727b
VK
1541AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1542#ifdef HAVE_SYS_TYPES_H
99e50bb7 1543#include <sys/types.h>
ef0c727b
VK
1544#endif
1545#if HAVE_BYTESWAP_H
1546#include <byteswap.h>
1547#endif
1548#if HAVE_NETINET_IN_H
1549#include <netinet/in.h>
1550#endif
1551#if HAVE_NET_NH_H
1552#include <net/nh.h>
1553#endif
1554])
aa24418a
VK
1555AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1556#ifdef HAVE_UNISTD_H
1557#include <unistd.h>
1558#endif
1559#ifdef HAVE_DLFCN_H
1560#include <dlfcn.h>
1561#endif
1562])
ce7565e7
VK
1563AC_CHECK_DECLS([va_copy, __va_copy],,,[
1564#ifdef HAVE_UNISTD_H
1565#include <unistd.h>
1566#endif
1567#ifdef HAVE_STDARG_H
1568#include <stdarg.h>
1569#endif
1570#ifdef HAVE_STDLIB_H
1571#include <stdlib.h>
1572#endif
1573])
dff54fed 1574
dff54fed 1575
ef0c727b 1576#--------------------------------------------------------------------
df9812a9
VK
1577# getopt
1578#--------------------------------------------------------------------
1579
1580if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
1581 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
1582else
1583 AC_CHECK_HEADERS([getopt.h])
1584 AC_CHECK_LIB(gnugetopt, getopt_long)
1585 AC_CHECK_DECLS([getopt_long],,,[
1586#if HAVE_GETOPT_H
1587#include <getopt.h>
1588#endif
1589 ])
1590fi
1591
1592
1593#--------------------------------------------------------------------
671651a1
VK
1594# Linux specific checks
1595#--------------------------------------------------------------------
1596
1597if test "x$PLATFORM" = "xLinux"; then
1598 AC_CHECK_HEADERS([sys/reboot.h],,,[[ ]])
1599 AC_CHECK_DECLS([reboot, RB_AUTOBOOT, RB_POWER_OFF, RB_HALT_SYSTEM],,,[
1600#if HAVE_SYS_REBOOT_H
1601#include <sys/reboot.h>
1602#endif
1603 ])
1604 AC_CHECK_FUNCS([reboot],,,[
1605#if HAVE_SYS_REBOOT_H
1606#include <sys/reboot.h>
1607#endif
1608 ])
1609fi
1610
1611
1612#--------------------------------------------------------------------
ef0c727b
VK
1613# AIX specific checks
1614#--------------------------------------------------------------------
d16cf8a5 1615
ef0c727b
VK
1616if test "x$PLATFORM" = "xAIX"; then
1617 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
efdaffe4 1618 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
df9812a9
VK
1619#if HAVE_PROCINFO_H
1620#include <procinfo.h>
1621#endif
1622 ])
ef0c727b
VK
1623 AC_CHECK_FUNCS([getprocs64],,,[
1624#if HAVE_PROCINFO_H
1625#include <procinfo.h>
6cd41ceb 1626#endif
ef0c727b 1627 ])
7e56bf2e
VK
1628fi
1629
cd4c8ca3 1630
ef0c727b 1631#--------------------------------------------------------------------
f47bd4ca
VK
1632# Solaris specific checks
1633#--------------------------------------------------------------------
1634
1635if test "x$PLATFORM" = "xSunOS"; then
1636 AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
1637#include <sys/atomic.h>
1638 ])
1639fi
1640
1641
1642#--------------------------------------------------------------------
ba8db57b
VK
1643# HP-UX specific checks
1644#--------------------------------------------------------------------
1645
1646if test "x$PLATFORM" = "xHP-UX"; then
3268bb77 1647 AC_CHECK_HEADERS([atomic.h sys/mib.h],,,[[ ]])
f09c2d05
VK
1648 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1649#if HAVE_NET_IF_H
1650#include <net/if.h>
1651#endif
1652 ])
1653 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1654#if HAVE_SYS_MIB_H
1655#include <sys/mib.h>
1656#endif
1657 ])
cfd95c74
VK
1658
1659 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
1660 AC_LANG_PUSH([C++])
1661 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1662#include <sys/pstat.h>
1663 ]], [[
1664pst_diskinfo d;
1665int x;
1666x = (int)d.psd_dkread;
1667x = (int)d.psd_dkwrite;
1668 ]])],
1669 [
1670 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
1671 AC_MSG_RESULT(yes)
1672 ],
1673 [
1674 AC_MSG_RESULT(no)
1675 ])
1676 AC_LANG_POP([C++])
ba8db57b
VK
1677fi
1678
1679
1680#--------------------------------------------------------------------
aa24418a
VK
1681# *BSD specific checks
1682#--------------------------------------------------------------------
1683
1684AC_CHECK_LIB(kvm, kvm_open)
1685AC_CHECK_FUNCS([kvm_getswapinfo])
1686AC_CHECK_TYPES([struct kinfo_proc2],,,[
1687#if HAVE_SYS_SYSCTL_H
1688#include <sys/sysctl.h>
1689#endif
1690])
1691
1692
28ba6824
VK
1693#--------------------------------------------------------------------
1694# FreeBSD specific checks
1695#--------------------------------------------------------------------
1696
1697if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
1698 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1699#if HAVE_SYS_TYPES_H
1700#include <sys/types.h>
1701#endif
1702#if HAVE_SYS_SOCKET_H
1703#include <sys/socket.h>
1704#endif
1705#include <net/route.h>
1706 ])
28ba6824
VK
1707fi
1708
1709
aa24418a 1710#--------------------------------------------------------------------
ea6615cf
VK
1711# OpenBSD specific checks
1712#--------------------------------------------------------------------
1713
1714if test "x$PLATFORM" = "xOpenBSD"; then
1715 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
1716 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1717#include <sys/param.h>
1718#include <sys/proc.h>
1719#include <kvm.h>
1720#include <sys/user.h>
1721 ]],[[
1722 int count;
1723 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
1724 return 0;
1725 ]])
1726 ],[
1727 AC_MSG_RESULT(yes)
1728 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1729 ],[
1730 AC_MSG_RESULT(no)
1731 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1732 ])
1733
1734 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
1735 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1736#include <sys/param.h>
1737#include <sys/proc.h>
1738#include <kvm.h>
1739#include <sys/user.h>
1740 ]],[[
1741 struct kinfo_proc p;
1742 return p.kp_proc.p_pid;
1743 ]])
1744 ],[
1745 AC_MSG_RESULT(yes)
1746 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
1747 ],[
1748 AC_MSG_RESULT(no)
1749 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
1750 ])
1751fi
1752
1753
1754#--------------------------------------------------------------------
ef0c727b
VK
1755# Check for UNICODE stuff
1756#--------------------------------------------------------------------
3e39fcde 1757
8b86c5dc 1758AC_CHECK_HEADERS([wchar.h wctype.h iconv.h])
aa24418a 1759AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
1760#if HAVE_WCHAR_H
1761#include <wchar.h>
1762#endif
1763])
f172d7b7
VK
1764AC_CHECK_SIZEOF(wchar_t,,[
1765#if HAVE_WCHAR_H
1766#include <wchar.h>
1767#endif
1768])
aa24418a 1769AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper wcserror wcserror_r])
0186b5da 1770AC_CHECK_FUNCS([wfopen fputws putws wopen wstat waccess wgetenv wrename wunlink wremove])
f3387429 1771AC_CHECK_FUNCS([wchdir wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod])
9d20de29 1772AC_CHECK_FUNCS([vwscanf vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
dff54fed 1773
3265ba38 1774if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 1775 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 1776 [ ac_found_iconv=yes
8d131dda 1777 LIBS="$LIBS -liconv"
75c30ed4
VK
1778 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
1779 ],
1780 [
1781 AC_CHECK_LIB(iconv, iconv,
1782 [ ac_found_iconv=yes
8d131dda 1783 LIBS="$LIBS -liconv"
75c30ed4
VK
1784 ])
1785 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
1786 ])
dff54fed
VK
1787else
1788 ac_found_iconv=no
ef0c727b 1789 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 1790fi
93571e7f 1791
3bf0df9f
VK
1792AC_MSG_CHECKING(whether fgetws can be used with popen)
1793AC_RUN_IFELSE(
1794 [AC_LANG_PROGRAM([
1795#include <stdio.h>
1796#ifdef HAVE_UNISTD_H
1797#include <unistd.h>
1798#endif
1799#if HAVE_WCHAR_H
1800#include <wchar.h>
1801#endif
1802 ], [[
1803 int rc = 1;
1804 wchar_t line[4096];
1805 FILE *f = popen("echo test", "r");
1806 if(f!=NULL)
1807 {
1808 fgetws(line, 4096, f);
1809 pclose(f);
1810 rc = 0;
1811 }
1812 return rc;
1813 ]])
1814 ],
1815 [ AC_MSG_RESULT(yes)
1816 AC_DEFINE(SAFE_FGETWS_WITH_POPEN, 1, Define to 1 if fgetws can be used with popen)
1817 ],
1818 [ AC_MSG_RESULT(no) ],
1819 [ AC_MSG_RESULT(no) ]
1820)
1821
93571e7f
VK
1822AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
1823AC_RUN_IFELSE(
1824 [AC_LANG_PROGRAM([
1825#if HAVE_ICONV_H
1826#include <iconv.h>
1827#endif
1828 ], [
1829 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
1830 ])
1831 ],
1832 [ AC_MSG_RESULT(yes)
1833 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
1834 valid_ucs2_code="UCS-2-INTERNAL"
1835 ],
1836 [ AC_MSG_RESULT(no) ],
1837 [ AC_MSG_RESULT(no) ]
1838)
1839
1840AC_MSG_CHECKING(whether iconv supports UCS-2)
1841AC_RUN_IFELSE(
1842 [AC_LANG_PROGRAM([
1843#if HAVE_ICONV_H
1844#include <iconv.h>
1845#endif
1846 ], [
1847 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
1848 ])
1849 ],
1850 [ AC_MSG_RESULT(yes)
1851 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
1852 valid_ucs2_code="UCS-2"
1853 ],
1854 [ AC_MSG_RESULT(no) ],
8b86c5dc 1855 [ AC_MSG_RESULT(no) ]
93571e7f
VK
1856)
1857
1858AC_MSG_CHECKING(whether iconv supports UCS2)
1859AC_RUN_IFELSE(
1860 [AC_LANG_PROGRAM([
1861#if HAVE_ICONV_H
1862#include <iconv.h>
1863#endif
1864 ], [
1865 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
1866 ])
1867 ],
1868 [ AC_MSG_RESULT(yes)
1869 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
1870 valid_ucs2_code="UCS2"
1871 ],
1872 [ AC_MSG_RESULT(no) ],
1873 [ AC_MSG_RESULT(no) ]
1874)
1875
44bccbbc
VK
1876AC_MSG_CHECKING(whether iconv supports UCS-2BE)
1877AC_RUN_IFELSE(
1878 [AC_LANG_PROGRAM([
1879#if HAVE_ICONV_H
1880#include <iconv.h>
1881#endif
1882 ], [
1883 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
1884 ])
1885 ],
1886 [ AC_MSG_RESULT(yes)
1887 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
1888 valid_ucs2_code="UCS-2BE"
1889 ],
1890 [ AC_MSG_RESULT(no) ],
1891 [ AC_MSG_RESULT(no) ]
1892)
1893
6e17f325
VK
1894AC_MSG_CHECKING(whether iconv supports UCS-2LE)
1895AC_RUN_IFELSE(
1896 [AC_LANG_PROGRAM([
1897#if HAVE_ICONV_H
1898#include <iconv.h>
1899#endif
1900 ], [
1901 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
1902 ])
1903 ],
1904 [ AC_MSG_RESULT(yes)
1905 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
1906 valid_ucs2_code="UCS-2LE"
1907 ],
1908 [ AC_MSG_RESULT(no) ],
1909 [ AC_MSG_RESULT(no) ]
1910)
1911
4a4e1feb
VK
1912AC_MSG_CHECKING(whether iconv supports UTF-16)
1913AC_RUN_IFELSE(
1914 [AC_LANG_PROGRAM([
1915#if HAVE_ICONV_H
1916#include <iconv.h>
1917#endif
1918 ], [
1919 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
1920 ])
1921 ],
1922 [ AC_MSG_RESULT(yes)
1923 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
1924 valid_ucs2_code="UTF-16"
1925 ],
1926 [ AC_MSG_RESULT(no) ],
1927 [ AC_MSG_RESULT(no) ]
1928)
1929
8b86c5dc
VK
1930AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
1931AC_RUN_IFELSE(
1932 [AC_LANG_PROGRAM([
1933#if HAVE_ICONV_H
1934#include <iconv.h>
1935#endif
1936 ], [
1937 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
1938 ])
1939 ],
1940 [ AC_MSG_RESULT(yes)
1941 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
1942 valid_ucs4_code="UCS-4-INTERNAL"
1943 ],
1944 [ AC_MSG_RESULT(no) ],
1945 [ AC_MSG_RESULT(no) ]
1946)
1947
1948AC_MSG_CHECKING(whether iconv supports UCS-4)
1949AC_RUN_IFELSE(
1950 [AC_LANG_PROGRAM([
1951#if HAVE_ICONV_H
1952#include <iconv.h>
1953#endif
1954 ], [
1955 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
1956 ])
1957 ],
1958 [ AC_MSG_RESULT(yes)
1959 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
1960 valid_ucs4_code="UCS-4"
1961 ],
1962 [ AC_MSG_RESULT(no) ],
1963 [ AC_MSG_RESULT(no) ]
1964)
1965
1966AC_MSG_CHECKING(whether iconv supports UCS4)
1967AC_RUN_IFELSE(
1968 [AC_LANG_PROGRAM([
1969#if HAVE_ICONV_H
1970#include <iconv.h>
1971#endif
1972 ], [
1973 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
1974 ])
1975 ],
1976 [ AC_MSG_RESULT(yes)
1977 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
1978 valid_ucs4_code="UCS4"
1979 ],
1980 [ AC_MSG_RESULT(no) ],
1981 [ AC_MSG_RESULT(no) ]
1982)
1983
1984AC_MSG_CHECKING(whether iconv supports UCS-4BE)
1985AC_RUN_IFELSE(
1986 [AC_LANG_PROGRAM([
1987#if HAVE_ICONV_H
1988#include <iconv.h>
1989#endif
1990 ], [
1991 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
1992 ])
1993 ],
1994 [ AC_MSG_RESULT(yes)
1995 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
1996 valid_ucs4_code="UCS-4BE"
1997 ],
1998 [ AC_MSG_RESULT(no) ],
1999 [ AC_MSG_RESULT(no) ]
2000)
2001
6e17f325
VK
2002AC_MSG_CHECKING(whether iconv supports UCS-4LE)
2003AC_RUN_IFELSE(
2004 [AC_LANG_PROGRAM([
2005#if HAVE_ICONV_H
2006#include <iconv.h>
2007#endif
2008 ], [
2009 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
2010 ])
2011 ],
2012 [ AC_MSG_RESULT(yes)
2013 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
2014 valid_ucs4_code="UCS-4LE"
2015 ],
2016 [ AC_MSG_RESULT(no) ],
2017 [ AC_MSG_RESULT(no) ]
2018)
2019
4a4e1feb
VK
2020AC_MSG_CHECKING(whether iconv supports UTF-32)
2021AC_RUN_IFELSE(
2022 [AC_LANG_PROGRAM([
2023#if HAVE_ICONV_H
2024#include <iconv.h>
2025#endif
2026 ], [
2027 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
2028 ])
2029 ],
2030 [ AC_MSG_RESULT(yes)
2031 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
2032 valid_ucs4_code="UTF-32"
2033 ],
2034 [ AC_MSG_RESULT(no) ],
2035 [ AC_MSG_RESULT(no) ]
2036)
2037
93571e7f
VK
2038AC_MSG_CHECKING(whether iconv supports //IGNORE)
2039AC_RUN_IFELSE(
2040 [AC_LANG_PROGRAM([
2041#if HAVE_ICONV_H
2042#include <iconv.h>
2043#endif
2044 ], [
2045 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
2046 ])
2047 ],
2048 [ AC_MSG_RESULT(yes)
2049 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
2050 ],
2051 [ AC_MSG_RESULT(no) ],
2052 [ AC_MSG_RESULT(no) ]
2053)
3e39fcde 2054
19619a35
AK
2055# taken from ZSH's configure
2056# Check if iconv uses const in prototype declaration
24b1570c 2057if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 2058 AC_LANG_PUSH([C++])
19619a35 2059 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
2060 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2061#include <stdlib.h>
f6a2136d 2062#if HAVE_ICONV_H
7f9423af 2063#include <iconv.h>
f6a2136d 2064#endif
f6a2136d
VK
2065 ]],
2066 [[
3e51d371
VK
2067 char **p = NULL;
2068 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 2069 ]])],
3e51d371
VK
2070 [ac_cv_iconv_const=const],
2071 [ac_cv_iconv_const=])])
53c96e2d 2072 AC_LANG_POP([C++])
19619a35
AK
2073 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2074 [Define as const if the declaration of iconv() needs const.])
2075fi
2076
a67fa146
VK
2077if test "x$ac_cv_type_wchar_t" = "xyes"; then
2078 if test $ac_cv_sizeof_wchar_t -eq 2; then
2079 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2080 fi
8b86c5dc 2081
a67fa146
VK
2082 if test $ac_cv_sizeof_wchar_t -eq 4; then
2083 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2084 fi
2085
2086 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2087 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2088 fi
2089else
2090 if test "x$BUILD_UNICODE" = "xyes"; then
2091 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2092 fi
8b86c5dc
VK
2093fi
2094
c29360a9 2095
ef0c727b 2096#--------------------------------------------------------------------
ca0f4ea3
VK
2097# MySQL
2098#--------------------------------------------------------------------
2099
2100check_substr "$COMPONENTS" "mysql"
2101if test $? = 0; then
6fce76d8 2102 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 2103 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 2104
8d131dda
VK
2105 OLD_LIBS="$LIBS"
2106 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 2107
9c29f76e
VK
2108 AC_MSG_CHECKING(whether mysql clients can run)
2109 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2110#include <stdio.h>
2111#include <mysql.h>
2112int main(void)
2113{
2114 MYSQL *a = mysql_init(NULL);
2115 return 0;
2116}
2117 ]])],[],[
2118 AC_MSG_RESULT(no)
2119 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
2120 ],[])
ca0f4ea3 2121 AC_MSG_RESULT(yes)
6fce76d8 2122
ca0f4ea3 2123 AC_CHECK_FUNCS(mysql_real_escape_string)
8d131dda 2124 LIBS="$OLD_LIBS"
ca0f4ea3
VK
2125fi
2126
2127
2128#--------------------------------------------------------------------
58ed4897
VK
2129# PostgreSQL
2130#--------------------------------------------------------------------
2131
203458b7 2132check_substr "$COMPONENTS" "pgsql"
58ed4897
VK
2133if test $? = 0; then
2134 AC_CHECK_LIB(m, floor)
6fce76d8 2135 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"],
58ed4897 2136 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
6fce76d8
VK
2137
2138 AC_MSG_CHECKING(whether postgresql clients can run)
8d131dda
VK
2139 OLD_LIBS="$LIBS"
2140 LIBS="$LIBS $PGSQL_LIBS"
6fce76d8
VK
2141 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2142 #include <stdio.h>
2143 #include <libpq-fe.h>
2144 int main(void)
2145 {
2146 PGconn *a = PQconnectdb("");
2147 return 0;
2148 }
2149 ]])],[AC_MSG_RESULT(yes)],[
58ed4897
VK
2150 AC_MSG_RESULT(no)
2151 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
2152 ],[])
8d131dda 2153 LIBS="$OLD_LIBS"
7070538d 2154 AC_CHECK_LIB(pq, PQfformat, [ AC_DEFINE(HAVE_PQFFORMAT, 1, PQfformat not exist in 7.3) ])
58ed4897
VK
2155fi
2156
2157
2158#--------------------------------------------------------------------
9c29f76e
VK
2159# ODBC
2160#--------------------------------------------------------------------
2161
2162check_substr "$COMPONENTS" "odbc"
2163if test $? = 0; then
6fce76d8 2164 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 2165 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
2166 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2167 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
2168 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
2169 fi
9c29f76e
VK
2170fi
2171
2172
2173#--------------------------------------------------------------------
41b4790d
VK
2174# Oracle
2175#--------------------------------------------------------------------
2176
2177check_substr "$COMPONENTS" "oracle"
2178if test $? = 0; then
2179 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
7d8c91ef
VK
2180 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
2181 [
2182 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
2183 ], [-lclntsh])
2184 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
2185 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 2186 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
2187 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2188 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
2189 fi
41b4790d
VK
2190fi
2191
84277a0f
AK
2192#--------------------------------------------------------------------
2193# DB2
2194#--------------------------------------------------------------------
2195
2196check_substr "$COMPONENTS" "db2"
2197if test $? = 0; then
2198 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
2199 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
2200 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
6afe141e 2201 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2202 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
2203 fi
84277a0f 2204fi
41b4790d
VK
2205
2206#--------------------------------------------------------------------
37861c72
VK
2207# Informix
2208#--------------------------------------------------------------------
2209
2210check_substr "$COMPONENTS" "informix"
2211if test $? = 0; then
2212 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
2213 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
2214 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
2215 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2216 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
2217 fi
37861c72
VK
2218fi
2219
c3cfc039
VK
2220
2221#--------------------------------------------------------------------
50e4bc8c
VK
2222# Java
2223#--------------------------------------------------------------------
2224
2225check_substr "$COMPONENTS" "java"
2226if test $? = 0; then
2227 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
2228# AC_CHECK_LIB(jvm, SQLAllocHandle, [JAVA_LIBS="-ljvm"],
2229# [AC_MSG_ERROR(libjvm is required for Java support)])
2230fi
2231
2232
2233#--------------------------------------------------------------------
ca0f4ea3
VK
2234# Other settings
2235#--------------------------------------------------------------------
2236
a5a95ac8
VK
2237if test "x$RUNTIME_PREFIX" = "x"; then
2238 if test "x${BUILD_UNICODE}" = "xyes"; then
2239 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\""
2240 else
2241 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\""
2242 fi
b07c50cc 2243else
a5a95ac8
VK
2244 if test "x${BUILD_UNICODE}" = "xyes"; then
2245 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\\\""
2246 else
2247 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"$RUNTIME_PREFIX\\\" -DDATADIR=\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=\\\"$RUNTIME_PREFIX/lib/netxms\\\""
2248 fi
b07c50cc 2249fi
545bda2d 2250LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 2251
25ae8377
VK
2252if test "x${ENABLE_WERROR}" = "xyes"; then
2253 CPPFLAGS="$CPPFLAGS -Werror"
2254fi
2255
cbc4d191
VK
2256if test "x$PLATFORM" = "xDarwin"; then
2257 SHLIB_SUFFIX=".so"
2258else
2259 if test "x$shrext_cmds" != "x"; then
2260 SHLIB_SUFFIX="$shrext_cmds"
2261 else
2262 SHLIB_SUFFIX=".so"
2263 fi
2b479c92 2264fi
cbc4d191 2265AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$SHLIB_SUFFIX"), [Define to platform's shared library suffix])
2b479c92 2266
551ec9ca 2267AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 2268AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
1fd41bcd 2269AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
c1165d33
VK
2270AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
2271AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
eca43970 2272AM_CONDITIONAL([USE_ENCRYPTION], [test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"])
6dde8627 2273AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
058bf6fc 2274AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
8b86c5dc 2275
ca0f4ea3
VK
2276
2277#--------------------------------------------------------------------
ef0c727b
VK
2278# Substitute variables
2279#--------------------------------------------------------------------
82fa7c5d 2280
ef0c727b
VK
2281AC_SUBST(DB_DRIVERS)
2282AC_SUBST(MODULES)
2283AC_SUBST(SUBAGENT_DIRS)
7dda4453 2284AC_SUBST(SERVER_INCLUDE)
7c48e2aa 2285AC_SUBST(SERVER_LIBS)
ef0c727b
VK
2286AC_SUBST(SERVER_TOOLS)
2287AC_SUBST(TOP_LEVEL_MODULES)
2288AC_SUBST(CONTRIB_MODULES)
c2612d83 2289AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
2290AC_SUBST(STATIC_SUBAGENT_LIST)
2291AC_SUBST(SUBAGENT_LIBS)
2292AC_SUBST(BUILD_SERVER)
447350a9 2293AC_SUBST(BUILD_SDK)
6fce76d8
VK
2294AC_SUBST(MYSQL_LIBS)
2295AC_SUBST(PGSQL_LIBS)
7d8c91ef 2296AC_SUBST(ORACLE_LIBS)
6fce76d8 2297AC_SUBST(ODBC_LIBS)
84277a0f 2298AC_SUBST(DB2_LIBS)
87f1fff0 2299AC_SUBST(INFORMIX_LIBS)
11ce9a66 2300AC_SUBST(OBJECT_MODE)
9113e749 2301AC_SUBST(SQLFLAGS)
cbc4d191 2302AC_SUBST(SHLIB_SUFFIX)
d16cf8a5 2303
ef0c727b
VK
2304#--------------------------------------------------------------------
2305# Shared libs versions
d16cf8a5
AK
2306#
2307# versioning scheme: current:revision:age
2308#
2309# current
2310# The number of the current interface exported by the library. A current
2311# value of `0', means that you are calling the interface exported by this
2312# library interface 0.
2313#
2314# revision
2315# The implementation number of the most recent interface exported by this
2316# library. In this case, a revision value of `0' means that this is the
2317# first implementation of the interface.
2318# If the next release of this library exports the same interface, but has a
2319# different implementation (perhaps some bugs have been fixed), the revision
2320# number will be higher, but current number will be the same. In that case,
2321# when given a choice, the library with the highest revision will always
2322# be used by the runtime loader.
2323#
2324# age
2325# The number of previous additional interfaces supported by this library.
2326# If age were `2', then this library can be linked into executables which
2327# were built with a release of this library that exported the current
2328# interface number, current, or any of the previous two interfaces.
2329# By definition age must be less than or equal to current. At the outset,
2330# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 2331#--------------------------------------------------------------------
d16cf8a5 2332
17b35ccc 2333NETXMS_LIBRARY_VERSION=1:0:0
c7d14846 2334AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 2335
ef0c727b
VK
2336#--------------------------------------------------------------------
2337# Generate output files
2338#--------------------------------------------------------------------
d16cf8a5
AK
2339
2340AC_CONFIG_FILES([
0c3c0c39
AK
2341 Makefile
2342 contrib/Makefile
36874eca
VK
2343 contrib/backgrounds/Makefile
2344 contrib/integration/Makefile
2345 contrib/integration/HP_EVA/Makefile
bad6cc0c 2346 contrib/integration/HP_P2000/Makefile
36874eca 2347 contrib/mibs/Makefile
0c3c0c39 2348 contrib/startup/Makefile
fa66d60c 2349 contrib/startup/debian/Makefile
daaefaaf 2350 contrib/startup/gentoo/Makefile
7483d0bf 2351 contrib/startup/hp-ux/Makefile
0c3c0c39 2352 contrib/startup/redhat/Makefile
5de3893d 2353 contrib/startup/suse/Makefile
9993edf4 2354 contrib/startup/ubuntu/Makefile
6adf3219 2355 contrib/startup/solaris/Makefile
0c3c0c39 2356 doc/Makefile
a48203d2
VK
2357 doc/internal/Makefile
2358 doc/manuals/Makefile
2359 doc/misc/Makefile
0c3c0c39
AK
2360 images/Makefile
2361 include/Makefile
2362 m4/Makefile
0c3c0c39 2363 src/Makefile
9191f6ad 2364 src/agent/Makefile
6ac698ed 2365 src/agent/appagent/Makefile
9191f6ad
VK
2366 src/agent/core/Makefile
2367 src/agent/install/Makefile
a2a24e9d 2368 src/agent/libnxsd/Makefile
9191f6ad 2369 src/agent/subagents/Makefile
9191f6ad 2370 src/agent/subagents/aix/Makefile
df8b3df7 2371 src/agent/subagents/darwin/Makefile
52f5ee00
VK
2372 src/agent/subagents/db2/Makefile
2373 src/agent/subagents/dbquery/Makefile
80e96a82 2374 src/agent/subagents/ecs/Makefile
9191f6ad 2375 src/agent/subagents/freebsd/Makefile
80e96a82
VK
2376 src/agent/subagents/hpux/Makefile
2377 src/agent/subagents/informix/Makefile
9191f6ad 2378 src/agent/subagents/ipso/Makefile
50e4bc8c
VK
2379 src/agent/subagents/java/Makefile
2380 src/agent/subagents/java/java/Makefile
2381 src/agent/subagents/java/java/src/Makefile
2382 src/agent/subagents/java/java/src/main/Makefile
2383 src/agent/subagents/java/java/src/main/java/Makefile
2384 src/agent/subagents/java/java/src/main/java/org/Makefile
2385 src/agent/subagents/java/java/src/main/java/org/netxms/Makefile
2386 src/agent/subagents/java/java/src/main/java/org/netxms/agent/Makefile
80e96a82 2387 src/agent/subagents/linux/Makefile
df8b3df7 2388 src/agent/subagents/lmsensors/Makefile
80e96a82
VK
2389 src/agent/subagents/logwatch/Makefile
2390 src/agent/subagents/netbsd/Makefile
df8b3df7 2391 src/agent/subagents/netsvc/Makefile
80e96a82
VK
2392 src/agent/subagents/odbcquery/Makefile
2393 src/agent/subagents/openbsd/Makefile
4d1753cd 2394 src/agent/subagents/oracle/Makefile
9191f6ad 2395 src/agent/subagents/ping/Makefile
80e96a82 2396 src/agent/subagents/portCheck/Makefile
df8b3df7 2397 src/agent/subagents/rpi/Makefile
9191f6ad 2398 src/agent/subagents/sms/Makefile
80e96a82 2399 src/agent/subagents/sunos/Makefile
9191f6ad 2400 src/agent/subagents/ups/Makefile
80e96a82
VK
2401 src/agent/subagents/winnt/Makefile
2402 src/agent/subagents/winperf/Makefile
52f5ee00 2403 src/agent/subagents/wmi/Makefile
0bd64860 2404 src/agent/tools/Makefile
6ac698ed 2405 src/agent/tools/nxappget/Makefile
0bd64860 2406 src/agent/tools/nxapush/Makefile
c2612d83 2407 src/client/Makefile
551592f4 2408 src/client/install/Makefile
c94fa5c2 2409 src/client/nxalarm/Makefile
e84701c5 2410 src/client/nxevent/Makefile
9cb6c12f 2411 src/client/nxlexer/Makefile
e84701c5 2412 src/client/nxpush/Makefile
59ffa5b7 2413 src/client/nxsms/Makefile
9cb6c12f
VK
2414 src/client/scilexer/Makefile
2415 src/client/windows/Makefile
2416 src/client/windows/nxav/Makefile
2417 src/client/windows/nxav/res/Makefile
23c8c53e
AK
2418 src/client/windows/nxcon/Makefile
2419 src/client/windows/nxcon/icons/Makefile
2420 src/client/windows/nxcon/res/Makefile
23c8c53e
AK
2421 src/client/windows/nxnotify/Makefile
2422 src/client/windows/nxnotify/res/Makefile
9cb6c12f
VK
2423 src/client/windows/nxuilib/Makefile
2424 src/client/windows/nxuilib/res/Makefile
2425 src/client/windows/nxuilib/sounds/Makefile
d1834406
VK
2426 src/db/Makefile
2427 src/db/dbdrv/Makefile
87f1fff0
VK
2428 src/db/dbdrv/db2/Makefile
2429 src/db/dbdrv/informix/Makefile
d1834406
VK
2430 src/db/dbdrv/odbc/Makefile
2431 src/db/dbdrv/mssql/Makefile
2432 src/db/dbdrv/mysql/Makefile
87f1fff0 2433 src/db/dbdrv/oracle/Makefile
d1834406
VK
2434 src/db/dbdrv/pgsql/Makefile
2435 src/db/dbdrv/sqlite/Makefile
d1834406 2436 src/db/libnxdb/Makefile
9191f6ad
VK
2437 src/install/Makefile
2438 src/install/windows/Makefile
2439 src/libexpat/Makefile
2440 src/libexpat/libexpat/Makefile
2441 src/libnetxms/Makefile
2442 src/libnxcl/Makefile
2443 src/libnxlp/Makefile
2444 src/libnxmap/Makefile
2445 src/libnxsl/Makefile
058bf6fc 2446 src/libstrophe/Makefile
a67fa146
VK
2447 src/libtre/Makefile
2448 src/libtre/win32/Makefile
a7a03ffd 2449 src/nxcproxy/Makefile
9191f6ad 2450 src/nxscript/Makefile
0c3c0c39
AK
2451 src/server/Makefile
2452 src/server/core/Makefile
644f97f5 2453 src/server/drivers/Makefile
0239cfea 2454 src/server/drivers/at/Makefile
644f97f5 2455 src/server/drivers/baystack/Makefile
b1bd1fb2 2456 src/server/drivers/cat2900xl/Makefile
910846cc 2457 src/server/drivers/catalyst/Makefile
fce03ab9 2458 src/server/drivers/cisco-esw/Makefile
8bdfaed8 2459 src/server/drivers/dell-pwc/Makefile
a548def4 2460 src/server/drivers/dlink/Makefile
644f97f5 2461 src/server/drivers/ers8000/Makefile
4e592faf
VK
2462 src/server/drivers/lib/Makefile
2463 src/server/drivers/lib/avaya-ers/Makefile
b1bd1fb2 2464 src/server/drivers/lib/cisco/Makefile
81ecaf38 2465 src/server/drivers/netscreen/Makefile
e10e890e 2466 src/server/drivers/ntws/Makefile
c183a9f9 2467 src/server/drivers/ping3/Makefile
9b13553b 2468 src/server/drivers/procurve/Makefile
217e4d6a 2469 src/server/drivers/symbol-ws/Makefile
d770a97c
VK
2470 src/server/include/Makefile
2471 src/server/libnxsrv/Makefile
2472 src/server/netxmsd/Makefile
d8f2e39b
VK
2473 src/server/smsdrv/Makefile
2474 src/server/smsdrv/generic/Makefile
91369aca 2475 src/server/smsdrv/nxagent/Makefile
aab8a8b6 2476 src/server/smsdrv/portech/Makefile
80a30c53 2477 src/server/smsdrv/dummy/Makefile
0c3c0c39 2478 src/server/tools/Makefile
0c3c0c39
AK
2479 src/server/tools/nxaction/Makefile
2480 src/server/tools/nxadm/Makefile
9191f6ad 2481 src/server/tools/nxap/Makefile
5b0c7d0d
VK
2482 src/server/tools/nxconfig/Makefile
2483 src/server/tools/nxconfig/res/Makefile
f90d7fc5 2484 src/server/tools/nxdbmgr/Makefile
9191f6ad 2485 src/server/tools/nxget/Makefile
d24fdaf4 2486 src/server/tools/nxupload/Makefile
c5c0f362
VK
2487 src/snmp/Makefile
2488 src/snmp/libnxsnmp/Makefile
2489 src/snmp/nxmibc/Makefile
2490 src/snmp/nxsnmpget/Makefile
2491 src/snmp/nxsnmpset/Makefile
2492 src/snmp/nxsnmpwalk/Makefile
9191f6ad 2493 src/sqlite/Makefile
f65df2b1 2494 src/tools/Makefile
f65df2b1 2495 src/tools/nxdevcfg/Makefile
56e13b13 2496 src/tools/nxencpasswd/Makefile
1fd41bcd 2497 src/zlib/Makefile
9191f6ad 2498 sql/Makefile
0c3c0c39 2499 tools/Makefile
d16cf8a5
AK
2500])
2501
12249937
VK
2502AC_OUTPUT
2503
ef0c727b 2504echo "Updating libtool"
5cecf50e
AK
2505sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2506
779ce551 2507# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
5482ef16 2508if test "x$ac_compiler_gnu" = "xyes" && test "x$PLATFORM" = "xHP-UX"; then
779ce551
VK
2509 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2510fi
2511
b677ef59
VK
2512# On AIX, correct OBJECT_MODE must be set before linking
2513# To avoid manual setting by user, we add this to libtool script
2514if test "x$PLATFORM" = "xAIX"; then
2515 head -n 1 ./libtool > ./libtool.new
2516 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
2517 tail -n +2 ./libtool >> ./libtool.new
2518 mv libtool.new libtool
2519 chmod +x ./libtool
2520fi
2521
ef0c727b
VK
2522#--------------------------------------------------------------------
2523# Print summary
2524#--------------------------------------------------------------------
a7442678 2525
a7442678
AK
2526echo
2527echo
2528echo
2529echo '---------------------------------------------------------------------'
2530echo ' Configure results'
2531echo '---------------------------------------------------------------------'
2532echo
8b86c5dc 2533 echo "Prefix : ${prefix}"
cbc4d191
VK
2534 echo "Platform : ${PLATFORM}"
2535 echo "Shared library suffix : ${SHLIB_SUFFIX}"
a7442678 2536if test "x${BUILD_SERVER}" = "xyes"; then
8b86c5dc 2537 echo "Build Server : YES"
7c48e2aa 2538 echo "Server libs : ${SERVER_LIBS}"
058bf6fc
VK
2539 if test "x${XMPP_SUPPORT}" = "xyes"; then
2540 echo "XMPP support : YES"
2541 else
2542 echo "XMPP support : NO"
2543 fi
a7442678 2544else
8b86c5dc 2545 echo "Build Server : NO"
a7442678
AK
2546fi
2547if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
8b86c5dc 2548 echo "Encryption enabled : YES"
a7442678 2549else
8b86c5dc 2550 echo "Encryption enabled : NO"
a7442678
AK
2551fi
2552if test "x${DB_DRIVERS}" != "x"; then
8b86c5dc 2553 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678 2554else
8b86c5dc 2555 echo "Build DB-Drivers : NO"
a7442678
AK
2556fi
2557if test "x${BUILD_CLIENT}" = "xyes"; then
8b86c5dc 2558 echo "Build Clients : YES"
a7442678 2559else
8b86c5dc 2560 echo "Build Clients : NO"
a7442678
AK
2561fi
2562if test "x${BUILD_AGENT}" = "xyes"; then
8b86c5dc
VK
2563 echo "Build Agent : YES"
2564 echo "Subagents list : ${SUBAGENT_DIRS}"
a7442678 2565else
8b86c5dc 2566 echo "Build Agent : NO"
a7442678 2567fi
e8636669 2568if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
8b86c5dc
VK
2569 echo "Build Static Agent : YES"
2570 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
e8636669 2571else
8b86c5dc 2572 echo "Build Static Agent : NO"
e8636669 2573fi
8b86c5dc 2574if test "x${BUILD_UNICODE}" = "xyes"; then
a67fa146 2575 echo "UNICODE build : YES"
8b86c5dc 2576else
a67fa146 2577 echo "UNICODE build : NO"
8b86c5dc 2578fi
551ec9ca
VK
2579if test "x${HAVE_LIBEXPAT}" = "xno"; then
2580 echo "Use internal libexpat : YES"
1bb6b449 2581else
551ec9ca 2582 echo "Use internal libexpat : NO"
1bb6b449 2583fi
17b35ccc
VK
2584if test "x${HAVE_LIBTRE}" = "xno"; then
2585 echo "Use internal libtre : YES"
2586else
2587 echo "Use internal libtre : NO"
2588fi
1fd41bcd
VK
2589if test "x${NEED_ZLIB}" = "xyes"; then
2590 if test "x${HAVE_ZLIB}" = "xno"; then
2591 echo "Use internal zlib : YES"
2592 else
2593 echo "Use internal zlib : NO"
2594 fi
2595fi
cc297a70
VK
2596if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
2597 echo "Force 32bit build : YES"
2598else
2599 echo "Force 32bit build : NO"
2600fi
7d8c91ef 2601
9113e749
VK
2602echo "C compiler : ${CC}"
2603echo "C++ compiler : ${CXX}"
7d8c91ef
VK
2604echo "CPPFLAGS : ${CPPFLAGS}"
2605echo "CXXFLAGS : ${CXXFLAGS}"
2606echo "CFLAGS : ${CFLAGS}"
2607echo "LDFLAGS : ${LDFLAGS}"
8d131dda 2608echo "LIBS : ${LIBS}"
7d8c91ef 2609
6fce76d8
VK
2610if test "x${MYSQL_LIBS}" != "x"; then
2611 echo "MySQL libs : ${MYSQL_LIBS}"
2612fi
2613if test "x${PGSQL_LIBS}" != "x"; then
2614 echo "PostgreSQL libs : ${PGSQL_LIBS}"
2615fi
7d8c91ef
VK
2616if test "x${ORACLE_LIBS}" != "x"; then
2617 echo "Oracle libs : ${ORACLE_LIBS}"
2618fi
6fce76d8
VK
2619if test "x${ODBC_LIBS}" != "x"; then
2620 echo "ODBC libs : ${ODBC_LIBS}"
2621fi
84277a0f
AK
2622if test "x${DB2_LIBS}" != "x"; then
2623 echo "DB2 libs : ${DB2_LIBS}"
2624fi
37861c72
VK
2625if test "x${INFORMIX_LIBS}" != "x"; then
2626 echo "Informix libs : ${INFORMIX_LIBS}"
2627fi
ecbed20c
VK
2628
2629FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
2630echo "/* Automatically generated by configure */" > $FLAGS_CPP
d541b129
VK
2631echo "#include <nms_common.h>" >> $FLAGS_CPP
2632echo "const TCHAR *g_cppFlags = _T(\"${CPPFLAGS}\");" >> $FLAGS_CPP
2633echo "const TCHAR *g_cFlags = _T(\"${CFLAGS}\");" >> $FLAGS_CPP
2634echo "const TCHAR *g_cxxFlags = _T(\"${CXXFLAGS}\");" >> $FLAGS_CPP
2635echo "const TCHAR *g_ldFlags = _T(\"${LDFLAGS}\");" >> $FLAGS_CPP
2636echo "const TCHAR *g_libs = _T(\"${LIBS}\");" >> $FLAGS_CPP
7dda4453
VK
2637echo "const TCHAR *g_cc = _T(\"${CC}\");" >> $FLAGS_CPP
2638echo "const TCHAR *g_cxx = _T(\"${CXX}\");" >> $FLAGS_CPP
2639echo "const TCHAR *g_ld = _T(\"${LD}\");" >> $FLAGS_CPP
2640echo "const TCHAR *g_perl = _T(\"${PERL}\");" >> $FLAGS_CPP