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