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