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