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