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