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