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