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