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