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