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