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