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