client proxy implemented
[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,
e0a77f08 1131 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
ef0c727b 1132 AC_CHECK_LIB(crypto, EVP_bf_cbc,
e0a77f08 1133 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
ef0c727b 1134 AC_CHECK_LIB(crypto, EVP_idea_cbc,
e0a77f08 1135 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
ef0c727b 1136 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
e0a77f08 1137 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
d27e7413 1138 SERVER_LIBS="$SERVER_LIBS -lssl"
e0a77f08
VK
1139 if test "x$HAVE_LIBCRYPTO" = "xyes"; then
1140 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
1141# LIBS="$LIBS -Wl,-Bstatic -lcrypto -Wl,-Bdynamic"
1142 LIBS="$LIBS -lcrypto"
1143 else
1144 LIBS="$LIBS -lcrypto"
1145 fi
1146 else
1147 if test "x$REQUIRE_ENCRYPTION" = "xyes"; then
1148 AC_MSG_ERROR(libcrypto does not provide any suitable encryption algorithm)
1149 else
1150 AC_MSG_RESULT(libcrypto does not provide any suitable encryption algorithm)
1151 fi
1152 fi
ef0c727b
VK
1153 ],
1154 [
1155 if test "x$REQUIRE_ENCRYPTION" = "xyes"; then
1156 AC_MSG_ERROR(libcrypto is required for encryption support)
1157 else
1158 AC_MSG_RESULT(libcrypto is required for encryption support)
1159 fi
1160 ])
1161fi
1162
1163
1164#--------------------------------------------------------------------
0322eed7
VK
1165# Checks for header files
1166#--------------------------------------------------------------------
1167
1168AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h alloca.h])
2e98cdb4 1169AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h sys/wait.h])
0322eed7
VK
1170AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h net/nh.h sys/socket.h])
1171AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
1172AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
1173AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h])
df9812a9 1174AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
f09c2d05 1175AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
1176[[#ifdef HAVE_SYS_TYPES_H
1177# include <sys/types.h>
1178#endif
1179#ifdef HAVE_SYS_TIME_H
1180# include <sys/time.h>
1181#endif
1182#ifdef HAVE_SYS_SOCKET_H
1183# include <sys/socket.h>
1184#endif
1185]])
1186
1187
1188#--------------------------------------------------------------------
ef0c727b
VK
1189# Checks for other libs.
1190#--------------------------------------------------------------------
d16cf8a5 1191
779ce551 1192AC_CHECK_LIB(xnet, accept)
521d90e7 1193AC_CHECK_LIB(socket, if_nameindex)
87bb64a7 1194AC_CHECK_LIB(dl, dlopen)
1b3c0ef0 1195AC_CHECK_LIB(kstat, kstat_open)
d16cf8a5 1196
e0760102 1197if test "x$BUILD_SERVER" = "xyes" ; then
7c48e2aa
VK
1198 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"]))])
1199 AC_CHECK_LIB(readline, readline, [SERVER_LIBS="$SERVER_LIBS -lreadline"], [AC_CHECK_LIB(edit, readline, [SERVER_LIBS="$SERVER_LIBS -ledit"])])
1200 SAVED_LDFLAGS="$LDFLAGS"
1201 LDFLAGS="$LDFLAGS $SERVER_LIBS"
1202
0322eed7
VK
1203 AC_CHECK_FUNCS([readline])
1204
1205 # Check if passing rl_insert to rl_bind_key needs cast
1206 if test "$ac_cv_func_readline" = "yes"; then
1207 AC_LANG_PUSH([C++])
1208
1209 AC_MSG_CHECKING(for rl_insert cast)
1210
afd0c386 1211 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1212 [
1213#include <stdio.h>
1214#include <readline/readline.h>
afd0c386 1215 ],[ rl_bind_key('\t', (Function *)rl_insert); ])],
0322eed7
VK
1216 [
1217 AC_MSG_RESULT((Function *))
1218 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
1219 ],[
afd0c386 1220 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1221 [
1222#include <stdio.h>
1223#include <readline/readline.h>
afd0c386 1224 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ])],
0322eed7
VK
1225 [
1226 AC_MSG_RESULT((rl_command_func_t *))
1227 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
1228 ],[
1229 AC_MSG_RESULT(not needed)
1230 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
1231 ]
1232 )
1233 ]
1234 )
1235
1236 AC_LANG_POP([C++])
1237 fi
7c48e2aa 1238 LDFLAGS="$SAVED_LDFLAGS"
e0760102
VK
1239fi
1240
ef0c727b 1241if test "x$NEED_ZLIB" = "xyes"; then
1fd41bcd
VK
1242 if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
1243 HAVE_ZLIB=no
1244 else
1245 HAVE_ZLIB=yes
1246 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
1247 if test "x$HAVE_ZLIB" = "xyes"; then
1248 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
1249 fi
1250 fi
1251 if test "x$HAVE_ZLIB" = "xno"; then
1252 MODULES="zlib $MODULES"
1253 fi
ef0c727b
VK
1254fi
1255
467c489f
VK
1256if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
1257 HAVE_LIBEXPAT=no
1258else
1259 HAVE_LIBEXPAT=yes
1260 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
1261 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
1262fi
80ce37ac
VK
1263if test "x$HAVE_LIBEXPAT" = "xno"; then
1264 MODULES="libexpat $MODULES"
1bb6b449 1265fi
ef0c727b 1266
17b35ccc
VK
1267if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
1268 HAVE_LIBTRE=no
1269else
1270 HAVE_LIBTRE=yes
1271 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
1272 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
1273fi
1274if test "x$HAVE_LIBTRE" = "xno"; then
1275 MODULES="libtre $MODULES"
1276 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
a67fa146 1277
720c23d0
VK
1278 tre_version_1='0'
1279 tre_version_2='8'
1280 tre_version_3='0'
a67fa146
VK
1281 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
1282 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
1283 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
1284 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
1285 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
1286 AC_SUBST(TRE_VERSION, $tre_version)
1287
1288 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])
1289 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
17b35ccc 1290fi
ef0c727b 1291
4050bafb
VK
1292if test "x$DISABLE_LMSENSORS" = "xno"; then
1293 HAVE_LMSENSORS=yes
1294 AC_CHECK_HEADER(sensors/sensors.h,,HAVE_LMSENSORS=no)
1295 if test "x$HAVE_LMSENSORS" = "xyes"; then
1296 AC_CHECK_LIB(sensors, sensors_init, [ DUMMY="" ], [ HAVE_LMSENSORS=no ])
1297 fi
1298 if test "x$HAVE_LMSENSORS" = "xyes"; then
1299 SUBAGENT_DIRS="$SUBAGENT_DIRS lmsensors"
1300 fi
38bfa5da
AK
1301fi
1302
0a4194c2
AK
1303AC_CHECK_HEADER(curl/curl.h,HAVE_LIBCURL=yes,HAVE_LIBCURL=no)
1304if test "x$HAVE_LIBCURL" = "xyes"; then
2368dc85
VK
1305 AC_CHECK_LIB(curl, curl_global_init, [ HAVE_LIBCURL=yes ], [ HAVE_LIBCURL=no ])
1306 AC_CHECK_DECLS([CURLOPT_NOSIGNAL, curl_version_info],,,[
1307#ifdef HAVE_CURL_CURL_H
1308#include <curl/curl.h>
1309#endif
1310])
0a4194c2
AK
1311fi
1312if test "x$HAVE_LIBCURL" = "xyes"; then
c80c69bd 1313 SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
0a4194c2
AK
1314fi
1315
ef0c727b
VK
1316#--------------------------------------------------------------------
1317# Checks for data types
1318#--------------------------------------------------------------------
1319
d16cf8a5
AK
1320AC_CHECK_SIZEOF(short)
1321AC_CHECK_SIZEOF(int)
1322AC_CHECK_SIZEOF(long)
1323AC_CHECK_SIZEOF(long long)
1324
1325AC_TYPE_PID_T
d16cf8a5
AK
1326AC_TYPE_SIZE_T
1327AC_STRUCT_TIMEZONE
1328
3071f10a 1329AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
51128b42 1330AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
1331#if HAVE_SYS_TYPES_H
1332#include <sys/types.h>
1333#endif
1334#if HAVE_SYS_SOCKET_H
1335#include <sys/socket.h>
1336#endif
1337])
e0293f7f
VK
1338AC_CHECK_TYPES([struct stat64],,,[
1339#if HAVE_SYS_STAT_H
1340#include <sys/stat.h>
1341#endif
1342])
521d90e7 1343
e25cadc9 1344
ef0c727b
VK
1345#--------------------------------------------------------------------
1346# Checks for functions
1347#--------------------------------------------------------------------
d16cf8a5
AK
1348
1349AC_FUNC_ERROR_AT_LINE
d16cf8a5 1350AC_FUNC_MEMCMP
d16cf8a5
AK
1351AC_FUNC_SELECT_ARGTYPES
1352AC_FUNC_STRFTIME
1353AC_FUNC_STRTOD
1354AC_FUNC_VPRINTF
1355
80ce37ac 1356AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
55e62b45 1357AC_CHECK_FUNCS([strrchr strlwr strtol strtoul strtoll strtoull])
467e30e1 1358AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
c601fc15 1359AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
aa24418a
VK
1360
1361AC_CHECK_DECLS([nanosleep])
be6467e9 1362
b0823d06
VK
1363# Check if strerror_r is POSIX-compliant
1364if test "$ac_cv_func_strerror_r" = "yes"; then
1365 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1366 AC_LANG_PUSH([C++])
1367 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
1368#if HAVE_STRING_H
1369#include <string.h>
1370#endif
1371#if HAVE_ERRNO_H
1372#include <errno.h>
1373#endif
b0823d06 1374 ]],[[
7f9423af
VK
1375 int e;
1376 char buffer[256];
1377 e = strerror_r(1, buffer, 256);
1378 return e;
b0823d06
VK
1379 ]])
1380 ],[
1381 AC_MSG_RESULT(yes)
1382 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1383 ],[
1384 AC_MSG_RESULT(no)
1385 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1386 ])
1387 AC_LANG_POP([C++])
1388fi
1389
be6467e9
VK
1390# Check if timezone is a function
1391AC_MSG_CHECKING(for timezone function)
1392AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1393#if HAVE_TIME_H
1394#include <time.h>
1395#endif
1396#if HAVE_SYS_TIME_H
1397#include <sys/time.h>
1398#endif
1399]],[[
be6467e9 1400 timezone(0, 0);
be6467e9
VK
1401]])
1402],[
1403AC_MSG_RESULT(yes)
1404AC_DEFINE(HAVE_TIMEZONE,1,Define to 1 if timezone function is available)
1405],[
1406AC_MSG_RESULT(no)
445cba33
VK
1407AC_CHECK_DECLS([timezone],,,[
1408#if HAVE_TIME_H
1409#include <time.h>
1410#endif
1411#if HAVE_SYS_TIME_H
1412#include <sys/time.h>
1413#endif
1414])
be6467e9
VK
1415])
1416
1417# Check if struct tm has tm_gmtoff member
1418AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1419AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1420#if HAVE_TIME_H
1421#include <time.h>
1422#endif
1423#if HAVE_SYS_TIME_H
1424#include <sys/time.h>
1425#endif
1426]],[[
be6467e9
VK
1427 struct tm t;
1428 return t.tm_gmtoff;
be6467e9
VK
1429]])
1430],[
1431AC_MSG_RESULT(yes)
1432AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1433],[
1434AC_MSG_RESULT(no)
1435])
d16cf8a5 1436
f91feddc 1437AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
1438AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1439
d16cf8a5
AK
1440# sockets/resolver (probably for solaris)
1441AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1442AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1443AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1444
1445if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1446 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1447fi
1448
1449if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1450 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1451 LIBS="-lnsl -lsocket $LIBS"
1452 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1453 if test "$my_ac_link_result" = "no" ; then
1454 AC_MSG_RESULT([failure])
1455 AC_MSG_ERROR([unable to use gethostbyname()])
1456 else
1457 AC_MSG_RESULT([success])
1458 fi
1459fi
1460
c6491611
VK
1461# asprintf, scprintf, etc.
1462AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1463AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
1464
1465AC_MSG_CHECKING(whether snprintf returns required buffer size)
1466AC_RUN_IFELSE(
1467 [AC_LANG_PROGRAM([
1468#include <stdio.h>
1469#include <string.h>
1470 ], [
1471 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1472 ])
1473 ],
1474 [ AC_MSG_RESULT(yes)
1475 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1476 ],
1477 [ AC_MSG_RESULT(no) ],
1478 [ AC_MSG_RESULT(no) ]
1479)
1480
1481
dff54fed 1482
ef0c727b
VK
1483#--------------------------------------------------------------------
1484# Checks for macros and definitions
1485#--------------------------------------------------------------------
dff54fed 1486
ef0c727b
VK
1487AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1488#ifdef HAVE_SYS_TYPES_H
99e50bb7 1489#include <sys/types.h>
ef0c727b
VK
1490#endif
1491#if HAVE_BYTESWAP_H
1492#include <byteswap.h>
1493#endif
1494#if HAVE_NETINET_IN_H
1495#include <netinet/in.h>
1496#endif
1497#if HAVE_NET_NH_H
1498#include <net/nh.h>
1499#endif
1500])
aa24418a
VK
1501AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1502#ifdef HAVE_UNISTD_H
1503#include <unistd.h>
1504#endif
1505#ifdef HAVE_DLFCN_H
1506#include <dlfcn.h>
1507#endif
1508])
ce7565e7
VK
1509AC_CHECK_DECLS([va_copy, __va_copy],,,[
1510#ifdef HAVE_UNISTD_H
1511#include <unistd.h>
1512#endif
1513#ifdef HAVE_STDARG_H
1514#include <stdarg.h>
1515#endif
1516#ifdef HAVE_STDLIB_H
1517#include <stdlib.h>
1518#endif
1519])
dff54fed 1520
dff54fed 1521
ef0c727b 1522#--------------------------------------------------------------------
df9812a9
VK
1523# getopt
1524#--------------------------------------------------------------------
1525
1526if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
1527 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
1528else
1529 AC_CHECK_HEADERS([getopt.h])
1530 AC_CHECK_LIB(gnugetopt, getopt_long)
1531 AC_CHECK_DECLS([getopt_long],,,[
1532#if HAVE_GETOPT_H
1533#include <getopt.h>
1534#endif
1535 ])
1536fi
1537
1538
1539#--------------------------------------------------------------------
671651a1
VK
1540# Linux specific checks
1541#--------------------------------------------------------------------
1542
1543if test "x$PLATFORM" = "xLinux"; then
1544 AC_CHECK_HEADERS([sys/reboot.h],,,[[ ]])
1545 AC_CHECK_DECLS([reboot, RB_AUTOBOOT, RB_POWER_OFF, RB_HALT_SYSTEM],,,[
1546#if HAVE_SYS_REBOOT_H
1547#include <sys/reboot.h>
1548#endif
1549 ])
1550 AC_CHECK_FUNCS([reboot],,,[
1551#if HAVE_SYS_REBOOT_H
1552#include <sys/reboot.h>
1553#endif
1554 ])
1555fi
1556
1557
1558#--------------------------------------------------------------------
ef0c727b
VK
1559# AIX specific checks
1560#--------------------------------------------------------------------
d16cf8a5 1561
ef0c727b
VK
1562if test "x$PLATFORM" = "xAIX"; then
1563 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
efdaffe4 1564 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
df9812a9
VK
1565#if HAVE_PROCINFO_H
1566#include <procinfo.h>
1567#endif
1568 ])
ef0c727b
VK
1569 AC_CHECK_FUNCS([getprocs64],,,[
1570#if HAVE_PROCINFO_H
1571#include <procinfo.h>
6cd41ceb 1572#endif
ef0c727b 1573 ])
7e56bf2e
VK
1574fi
1575
cd4c8ca3 1576
ef0c727b 1577#--------------------------------------------------------------------
f47bd4ca
VK
1578# Solaris specific checks
1579#--------------------------------------------------------------------
1580
1581if test "x$PLATFORM" = "xSunOS"; then
1582 AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
1583#include <sys/atomic.h>
1584 ])
1585fi
1586
1587
1588#--------------------------------------------------------------------
ba8db57b
VK
1589# HP-UX specific checks
1590#--------------------------------------------------------------------
1591
1592if test "x$PLATFORM" = "xHP-UX"; then
3268bb77 1593 AC_CHECK_HEADERS([atomic.h sys/mib.h],,,[[ ]])
f09c2d05
VK
1594 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1595#if HAVE_NET_IF_H
1596#include <net/if.h>
1597#endif
1598 ])
1599 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1600#if HAVE_SYS_MIB_H
1601#include <sys/mib.h>
1602#endif
1603 ])
cfd95c74
VK
1604
1605 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
1606 AC_LANG_PUSH([C++])
1607 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1608#include <sys/pstat.h>
1609 ]], [[
1610pst_diskinfo d;
1611int x;
1612x = (int)d.psd_dkread;
1613x = (int)d.psd_dkwrite;
1614 ]])],
1615 [
1616 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
1617 AC_MSG_RESULT(yes)
1618 ],
1619 [
1620 AC_MSG_RESULT(no)
1621 ])
1622 AC_LANG_POP([C++])
ba8db57b
VK
1623fi
1624
1625
1626#--------------------------------------------------------------------
aa24418a
VK
1627# *BSD specific checks
1628#--------------------------------------------------------------------
1629
1630AC_CHECK_LIB(kvm, kvm_open)
1631AC_CHECK_FUNCS([kvm_getswapinfo])
1632AC_CHECK_TYPES([struct kinfo_proc2],,,[
1633#if HAVE_SYS_SYSCTL_H
1634#include <sys/sysctl.h>
1635#endif
1636])
1637
1638
28ba6824
VK
1639#--------------------------------------------------------------------
1640# FreeBSD specific checks
1641#--------------------------------------------------------------------
1642
1643if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
1644 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1645#if HAVE_SYS_TYPES_H
1646#include <sys/types.h>
1647#endif
1648#if HAVE_SYS_SOCKET_H
1649#include <sys/socket.h>
1650#endif
1651#include <net/route.h>
1652 ])
28ba6824
VK
1653fi
1654
1655
aa24418a 1656#--------------------------------------------------------------------
ea6615cf
VK
1657# OpenBSD specific checks
1658#--------------------------------------------------------------------
1659
1660if test "x$PLATFORM" = "xOpenBSD"; then
1661 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
1662 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1663#include <sys/param.h>
1664#include <sys/proc.h>
1665#include <kvm.h>
1666#include <sys/user.h>
1667 ]],[[
1668 int count;
1669 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
1670 return 0;
1671 ]])
1672 ],[
1673 AC_MSG_RESULT(yes)
1674 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1675 ],[
1676 AC_MSG_RESULT(no)
1677 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1678 ])
1679
1680 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
1681 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1682#include <sys/param.h>
1683#include <sys/proc.h>
1684#include <kvm.h>
1685#include <sys/user.h>
1686 ]],[[
1687 struct kinfo_proc p;
1688 return p.kp_proc.p_pid;
1689 ]])
1690 ],[
1691 AC_MSG_RESULT(yes)
1692 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
1693 ],[
1694 AC_MSG_RESULT(no)
1695 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
1696 ])
1697fi
1698
1699
1700#--------------------------------------------------------------------
ef0c727b
VK
1701# Check for UNICODE stuff
1702#--------------------------------------------------------------------
3e39fcde 1703
8b86c5dc 1704AC_CHECK_HEADERS([wchar.h wctype.h iconv.h])
aa24418a 1705AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
1706#if HAVE_WCHAR_H
1707#include <wchar.h>
1708#endif
1709])
f172d7b7
VK
1710AC_CHECK_SIZEOF(wchar_t,,[
1711#if HAVE_WCHAR_H
1712#include <wchar.h>
1713#endif
1714])
aa24418a 1715AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper wcserror wcserror_r])
0186b5da 1716AC_CHECK_FUNCS([wfopen fputws putws wopen wstat waccess wgetenv wrename wunlink wremove])
f3387429 1717AC_CHECK_FUNCS([wchdir wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod])
9d20de29 1718AC_CHECK_FUNCS([vwscanf vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
dff54fed 1719
3265ba38 1720if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 1721 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 1722 [ ac_found_iconv=yes
8d131dda 1723 LIBS="$LIBS -liconv"
75c30ed4
VK
1724 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
1725 ],
1726 [
1727 AC_CHECK_LIB(iconv, iconv,
1728 [ ac_found_iconv=yes
8d131dda 1729 LIBS="$LIBS -liconv"
75c30ed4
VK
1730 ])
1731 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
1732 ])
dff54fed
VK
1733else
1734 ac_found_iconv=no
ef0c727b 1735 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 1736fi
93571e7f
VK
1737
1738AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
1739AC_RUN_IFELSE(
1740 [AC_LANG_PROGRAM([
1741#if HAVE_ICONV_H
1742#include <iconv.h>
1743#endif
1744 ], [
1745 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
1746 ])
1747 ],
1748 [ AC_MSG_RESULT(yes)
1749 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
1750 valid_ucs2_code="UCS-2-INTERNAL"
1751 ],
1752 [ AC_MSG_RESULT(no) ],
1753 [ AC_MSG_RESULT(no) ]
1754)
1755
1756AC_MSG_CHECKING(whether iconv supports UCS-2)
1757AC_RUN_IFELSE(
1758 [AC_LANG_PROGRAM([
1759#if HAVE_ICONV_H
1760#include <iconv.h>
1761#endif
1762 ], [
1763 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
1764 ])
1765 ],
1766 [ AC_MSG_RESULT(yes)
1767 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
1768 valid_ucs2_code="UCS-2"
1769 ],
1770 [ AC_MSG_RESULT(no) ],
8b86c5dc 1771 [ AC_MSG_RESULT(no) ]
93571e7f
VK
1772)
1773
1774AC_MSG_CHECKING(whether iconv supports UCS2)
1775AC_RUN_IFELSE(
1776 [AC_LANG_PROGRAM([
1777#if HAVE_ICONV_H
1778#include <iconv.h>
1779#endif
1780 ], [
1781 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
1782 ])
1783 ],
1784 [ AC_MSG_RESULT(yes)
1785 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
1786 valid_ucs2_code="UCS2"
1787 ],
1788 [ AC_MSG_RESULT(no) ],
1789 [ AC_MSG_RESULT(no) ]
1790)
1791
44bccbbc
VK
1792AC_MSG_CHECKING(whether iconv supports UCS-2BE)
1793AC_RUN_IFELSE(
1794 [AC_LANG_PROGRAM([
1795#if HAVE_ICONV_H
1796#include <iconv.h>
1797#endif
1798 ], [
1799 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
1800 ])
1801 ],
1802 [ AC_MSG_RESULT(yes)
1803 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
1804 valid_ucs2_code="UCS-2BE"
1805 ],
1806 [ AC_MSG_RESULT(no) ],
1807 [ AC_MSG_RESULT(no) ]
1808)
1809
6e17f325
VK
1810AC_MSG_CHECKING(whether iconv supports UCS-2LE)
1811AC_RUN_IFELSE(
1812 [AC_LANG_PROGRAM([
1813#if HAVE_ICONV_H
1814#include <iconv.h>
1815#endif
1816 ], [
1817 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
1818 ])
1819 ],
1820 [ AC_MSG_RESULT(yes)
1821 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
1822 valid_ucs2_code="UCS-2LE"
1823 ],
1824 [ AC_MSG_RESULT(no) ],
1825 [ AC_MSG_RESULT(no) ]
1826)
1827
4a4e1feb
VK
1828AC_MSG_CHECKING(whether iconv supports UTF-16)
1829AC_RUN_IFELSE(
1830 [AC_LANG_PROGRAM([
1831#if HAVE_ICONV_H
1832#include <iconv.h>
1833#endif
1834 ], [
1835 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
1836 ])
1837 ],
1838 [ AC_MSG_RESULT(yes)
1839 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
1840 valid_ucs2_code="UTF-16"
1841 ],
1842 [ AC_MSG_RESULT(no) ],
1843 [ AC_MSG_RESULT(no) ]
1844)
1845
8b86c5dc
VK
1846AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
1847AC_RUN_IFELSE(
1848 [AC_LANG_PROGRAM([
1849#if HAVE_ICONV_H
1850#include <iconv.h>
1851#endif
1852 ], [
1853 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
1854 ])
1855 ],
1856 [ AC_MSG_RESULT(yes)
1857 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
1858 valid_ucs4_code="UCS-4-INTERNAL"
1859 ],
1860 [ AC_MSG_RESULT(no) ],
1861 [ AC_MSG_RESULT(no) ]
1862)
1863
1864AC_MSG_CHECKING(whether iconv supports UCS-4)
1865AC_RUN_IFELSE(
1866 [AC_LANG_PROGRAM([
1867#if HAVE_ICONV_H
1868#include <iconv.h>
1869#endif
1870 ], [
1871 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
1872 ])
1873 ],
1874 [ AC_MSG_RESULT(yes)
1875 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
1876 valid_ucs4_code="UCS-4"
1877 ],
1878 [ AC_MSG_RESULT(no) ],
1879 [ AC_MSG_RESULT(no) ]
1880)
1881
1882AC_MSG_CHECKING(whether iconv supports UCS4)
1883AC_RUN_IFELSE(
1884 [AC_LANG_PROGRAM([
1885#if HAVE_ICONV_H
1886#include <iconv.h>
1887#endif
1888 ], [
1889 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
1890 ])
1891 ],
1892 [ AC_MSG_RESULT(yes)
1893 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
1894 valid_ucs4_code="UCS4"
1895 ],
1896 [ AC_MSG_RESULT(no) ],
1897 [ AC_MSG_RESULT(no) ]
1898)
1899
1900AC_MSG_CHECKING(whether iconv supports UCS-4BE)
1901AC_RUN_IFELSE(
1902 [AC_LANG_PROGRAM([
1903#if HAVE_ICONV_H
1904#include <iconv.h>
1905#endif
1906 ], [
1907 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
1908 ])
1909 ],
1910 [ AC_MSG_RESULT(yes)
1911 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
1912 valid_ucs4_code="UCS-4BE"
1913 ],
1914 [ AC_MSG_RESULT(no) ],
1915 [ AC_MSG_RESULT(no) ]
1916)
1917
6e17f325
VK
1918AC_MSG_CHECKING(whether iconv supports UCS-4LE)
1919AC_RUN_IFELSE(
1920 [AC_LANG_PROGRAM([
1921#if HAVE_ICONV_H
1922#include <iconv.h>
1923#endif
1924 ], [
1925 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
1926 ])
1927 ],
1928 [ AC_MSG_RESULT(yes)
1929 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
1930 valid_ucs4_code="UCS-4LE"
1931 ],
1932 [ AC_MSG_RESULT(no) ],
1933 [ AC_MSG_RESULT(no) ]
1934)
1935
4a4e1feb
VK
1936AC_MSG_CHECKING(whether iconv supports UTF-32)
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","UTF-32")==(iconv_t)(-1);
1944 ])
1945 ],
1946 [ AC_MSG_RESULT(yes)
1947 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
1948 valid_ucs4_code="UTF-32"
1949 ],
1950 [ AC_MSG_RESULT(no) ],
1951 [ AC_MSG_RESULT(no) ]
1952)
1953
93571e7f
VK
1954AC_MSG_CHECKING(whether iconv supports //IGNORE)
1955AC_RUN_IFELSE(
1956 [AC_LANG_PROGRAM([
1957#if HAVE_ICONV_H
1958#include <iconv.h>
1959#endif
1960 ], [
1961 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
1962 ])
1963 ],
1964 [ AC_MSG_RESULT(yes)
1965 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
1966 ],
1967 [ AC_MSG_RESULT(no) ],
1968 [ AC_MSG_RESULT(no) ]
1969)
3e39fcde 1970
19619a35
AK
1971# taken from ZSH's configure
1972# Check if iconv uses const in prototype declaration
24b1570c 1973if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 1974 AC_LANG_PUSH([C++])
19619a35 1975 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
1976 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1977#include <stdlib.h>
f6a2136d 1978#if HAVE_ICONV_H
7f9423af 1979#include <iconv.h>
f6a2136d 1980#endif
f6a2136d
VK
1981 ]],
1982 [[
3e51d371
VK
1983 char **p = NULL;
1984 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 1985 ]])],
3e51d371
VK
1986 [ac_cv_iconv_const=const],
1987 [ac_cv_iconv_const=])])
53c96e2d 1988 AC_LANG_POP([C++])
19619a35
AK
1989 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
1990 [Define as const if the declaration of iconv() needs const.])
1991fi
1992
a67fa146
VK
1993if test "x$ac_cv_type_wchar_t" = "xyes"; then
1994 if test $ac_cv_sizeof_wchar_t -eq 2; then
1995 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
1996 fi
8b86c5dc 1997
a67fa146
VK
1998 if test $ac_cv_sizeof_wchar_t -eq 4; then
1999 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2000 fi
2001
2002 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2003 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2004 fi
2005else
2006 if test "x$BUILD_UNICODE" = "xyes"; then
2007 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2008 fi
8b86c5dc
VK
2009fi
2010
c29360a9 2011
ef0c727b 2012#--------------------------------------------------------------------
ca0f4ea3
VK
2013# MySQL
2014#--------------------------------------------------------------------
2015
2016check_substr "$COMPONENTS" "mysql"
2017if test $? = 0; then
6fce76d8 2018 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 2019 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 2020
8d131dda
VK
2021 OLD_LIBS="$LIBS"
2022 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 2023
9c29f76e
VK
2024 AC_MSG_CHECKING(whether mysql clients can run)
2025 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2026#include <stdio.h>
2027#include <mysql.h>
2028int main(void)
2029{
2030 MYSQL *a = mysql_init(NULL);
2031 return 0;
2032}
2033 ]])],[],[
2034 AC_MSG_RESULT(no)
2035 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
2036 ],[])
ca0f4ea3 2037 AC_MSG_RESULT(yes)
6fce76d8 2038
ca0f4ea3 2039 AC_CHECK_FUNCS(mysql_real_escape_string)
8d131dda 2040 LIBS="$OLD_LIBS"
ca0f4ea3
VK
2041fi
2042
2043
2044#--------------------------------------------------------------------
58ed4897
VK
2045# PostgreSQL
2046#--------------------------------------------------------------------
2047
203458b7 2048check_substr "$COMPONENTS" "pgsql"
58ed4897
VK
2049if test $? = 0; then
2050 AC_CHECK_LIB(m, floor)
6fce76d8 2051 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"],
58ed4897 2052 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
6fce76d8
VK
2053
2054 AC_MSG_CHECKING(whether postgresql clients can run)
8d131dda
VK
2055 OLD_LIBS="$LIBS"
2056 LIBS="$LIBS $PGSQL_LIBS"
6fce76d8
VK
2057 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2058 #include <stdio.h>
2059 #include <libpq-fe.h>
2060 int main(void)
2061 {
2062 PGconn *a = PQconnectdb("");
2063 return 0;
2064 }
2065 ]])],[AC_MSG_RESULT(yes)],[
58ed4897
VK
2066 AC_MSG_RESULT(no)
2067 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
2068 ],[])
8d131dda 2069 LIBS="$OLD_LIBS"
7070538d 2070 AC_CHECK_LIB(pq, PQfformat, [ AC_DEFINE(HAVE_PQFFORMAT, 1, PQfformat not exist in 7.3) ])
58ed4897
VK
2071fi
2072
2073
2074#--------------------------------------------------------------------
9c29f76e
VK
2075# ODBC
2076#--------------------------------------------------------------------
2077
2078check_substr "$COMPONENTS" "odbc"
2079if test $? = 0; then
6fce76d8 2080 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 2081 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
2082 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2083 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
2084 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
2085 fi
9c29f76e
VK
2086fi
2087
2088
2089#--------------------------------------------------------------------
41b4790d
VK
2090# Oracle
2091#--------------------------------------------------------------------
2092
2093check_substr "$COMPONENTS" "oracle"
2094if test $? = 0; then
2095 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
7d8c91ef
VK
2096 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
2097 [
2098 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
2099 ], [-lclntsh])
2100 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
2101 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 2102 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
2103 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2104 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
2105 fi
41b4790d
VK
2106fi
2107
84277a0f
AK
2108#--------------------------------------------------------------------
2109# DB2
2110#--------------------------------------------------------------------
2111
2112check_substr "$COMPONENTS" "db2"
2113if test $? = 0; then
2114 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
2115 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
2116 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
6afe141e 2117 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2118 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
2119 fi
84277a0f 2120fi
41b4790d
VK
2121
2122#--------------------------------------------------------------------
37861c72
VK
2123# Informix
2124#--------------------------------------------------------------------
2125
2126check_substr "$COMPONENTS" "informix"
2127if test $? = 0; then
2128 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
2129 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
2130 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
2131 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2132 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
2133 fi
37861c72
VK
2134fi
2135
c3cfc039
VK
2136
2137#--------------------------------------------------------------------
50e4bc8c
VK
2138# Java
2139#--------------------------------------------------------------------
2140
2141check_substr "$COMPONENTS" "java"
2142if test $? = 0; then
2143 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
2144# AC_CHECK_LIB(jvm, SQLAllocHandle, [JAVA_LIBS="-ljvm"],
2145# [AC_MSG_ERROR(libjvm is required for Java support)])
2146fi
2147
2148
2149#--------------------------------------------------------------------
ca0f4ea3
VK
2150# Other settings
2151#--------------------------------------------------------------------
2152
a5a95ac8
VK
2153if test "x$RUNTIME_PREFIX" = "x"; then
2154 if test "x${BUILD_UNICODE}" = "xyes"; then
2155 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\""
2156 else
2157 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\""
2158 fi
b07c50cc 2159else
a5a95ac8
VK
2160 if test "x${BUILD_UNICODE}" = "xyes"; then
2161 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\\\""
2162 else
2163 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"$RUNTIME_PREFIX\\\" -DDATADIR=\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=\\\"$RUNTIME_PREFIX/lib/netxms\\\""
2164 fi
b07c50cc 2165fi
545bda2d 2166LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 2167
25ae8377
VK
2168if test "x${ENABLE_WERROR}" = "xyes"; then
2169 CPPFLAGS="$CPPFLAGS -Werror"
2170fi
2171
2b479c92
VK
2172if test "x$shrext_cmds" != "x"; then
2173 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$shrext_cmds"), [Define to platform's shared library suffix])
2174fi
2175
551ec9ca 2176AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 2177AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
1fd41bcd 2178AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
c1165d33
VK
2179AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
2180AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
eca43970 2181AM_CONDITIONAL([USE_ENCRYPTION], [test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"])
6dde8627 2182AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
8b86c5dc 2183
ca0f4ea3
VK
2184
2185#--------------------------------------------------------------------
ef0c727b
VK
2186# Substitute variables
2187#--------------------------------------------------------------------
82fa7c5d 2188
ef0c727b
VK
2189AC_SUBST(DB_DRIVERS)
2190AC_SUBST(MODULES)
2191AC_SUBST(SUBAGENT_DIRS)
7dda4453 2192AC_SUBST(SERVER_INCLUDE)
7c48e2aa 2193AC_SUBST(SERVER_LIBS)
ef0c727b
VK
2194AC_SUBST(SERVER_TOOLS)
2195AC_SUBST(TOP_LEVEL_MODULES)
2196AC_SUBST(CONTRIB_MODULES)
c2612d83 2197AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
2198AC_SUBST(STATIC_SUBAGENT_LIST)
2199AC_SUBST(SUBAGENT_LIBS)
2200AC_SUBST(BUILD_SERVER)
447350a9 2201AC_SUBST(BUILD_SDK)
6fce76d8
VK
2202AC_SUBST(MYSQL_LIBS)
2203AC_SUBST(PGSQL_LIBS)
7d8c91ef 2204AC_SUBST(ORACLE_LIBS)
6fce76d8 2205AC_SUBST(ODBC_LIBS)
84277a0f 2206AC_SUBST(DB2_LIBS)
87f1fff0 2207AC_SUBST(INFORMIX_LIBS)
11ce9a66 2208AC_SUBST(OBJECT_MODE)
9113e749 2209AC_SUBST(SQLFLAGS)
2b479c92 2210AC_SUBST(SHLIB_SUFFIX, $shrext_cmds)
d16cf8a5 2211
ef0c727b
VK
2212#--------------------------------------------------------------------
2213# Shared libs versions
d16cf8a5
AK
2214#
2215# versioning scheme: current:revision:age
2216#
2217# current
2218# The number of the current interface exported by the library. A current
2219# value of `0', means that you are calling the interface exported by this
2220# library interface 0.
2221#
2222# revision
2223# The implementation number of the most recent interface exported by this
2224# library. In this case, a revision value of `0' means that this is the
2225# first implementation of the interface.
2226# If the next release of this library exports the same interface, but has a
2227# different implementation (perhaps some bugs have been fixed), the revision
2228# number will be higher, but current number will be the same. In that case,
2229# when given a choice, the library with the highest revision will always
2230# be used by the runtime loader.
2231#
2232# age
2233# The number of previous additional interfaces supported by this library.
2234# If age were `2', then this library can be linked into executables which
2235# were built with a release of this library that exported the current
2236# interface number, current, or any of the previous two interfaces.
2237# By definition age must be less than or equal to current. At the outset,
2238# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 2239#--------------------------------------------------------------------
d16cf8a5 2240
17b35ccc 2241NETXMS_LIBRARY_VERSION=1:0:0
c7d14846 2242AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 2243
ef0c727b
VK
2244#--------------------------------------------------------------------
2245# Generate output files
2246#--------------------------------------------------------------------
d16cf8a5
AK
2247
2248AC_CONFIG_FILES([
0c3c0c39
AK
2249 Makefile
2250 contrib/Makefile
36874eca
VK
2251 contrib/backgrounds/Makefile
2252 contrib/integration/Makefile
2253 contrib/integration/HP_EVA/Makefile
bad6cc0c 2254 contrib/integration/HP_P2000/Makefile
36874eca 2255 contrib/mibs/Makefile
0c3c0c39 2256 contrib/startup/Makefile
fa66d60c 2257 contrib/startup/debian/Makefile
daaefaaf 2258 contrib/startup/gentoo/Makefile
7483d0bf 2259 contrib/startup/hp-ux/Makefile
0c3c0c39 2260 contrib/startup/redhat/Makefile
5de3893d 2261 contrib/startup/suse/Makefile
9993edf4 2262 contrib/startup/ubuntu/Makefile
6adf3219 2263 contrib/startup/solaris/Makefile
0c3c0c39 2264 doc/Makefile
a48203d2
VK
2265 doc/internal/Makefile
2266 doc/manuals/Makefile
2267 doc/misc/Makefile
0c3c0c39
AK
2268 images/Makefile
2269 include/Makefile
2270 m4/Makefile
0c3c0c39 2271 src/Makefile
9191f6ad 2272 src/agent/Makefile
6ac698ed 2273 src/agent/appagent/Makefile
9191f6ad
VK
2274 src/agent/core/Makefile
2275 src/agent/install/Makefile
a2a24e9d 2276 src/agent/libnxsd/Makefile
9191f6ad 2277 src/agent/subagents/Makefile
9191f6ad 2278 src/agent/subagents/aix/Makefile
df8b3df7 2279 src/agent/subagents/darwin/Makefile
80e96a82 2280 src/agent/subagents/ecs/Makefile
9191f6ad 2281 src/agent/subagents/freebsd/Makefile
80e96a82
VK
2282 src/agent/subagents/hpux/Makefile
2283 src/agent/subagents/informix/Makefile
9191f6ad 2284 src/agent/subagents/ipso/Makefile
50e4bc8c
VK
2285 src/agent/subagents/java/Makefile
2286 src/agent/subagents/java/java/Makefile
2287 src/agent/subagents/java/java/src/Makefile
2288 src/agent/subagents/java/java/src/main/Makefile
2289 src/agent/subagents/java/java/src/main/java/Makefile
2290 src/agent/subagents/java/java/src/main/java/org/Makefile
2291 src/agent/subagents/java/java/src/main/java/org/netxms/Makefile
2292 src/agent/subagents/java/java/src/main/java/org/netxms/agent/Makefile
80e96a82 2293 src/agent/subagents/linux/Makefile
df8b3df7 2294 src/agent/subagents/lmsensors/Makefile
80e96a82
VK
2295 src/agent/subagents/logwatch/Makefile
2296 src/agent/subagents/netbsd/Makefile
df8b3df7 2297 src/agent/subagents/netsvc/Makefile
80e96a82
VK
2298 src/agent/subagents/odbcquery/Makefile
2299 src/agent/subagents/openbsd/Makefile
4d1753cd 2300 src/agent/subagents/oracle/Makefile
9191f6ad 2301 src/agent/subagents/ping/Makefile
80e96a82 2302 src/agent/subagents/portCheck/Makefile
df8b3df7 2303 src/agent/subagents/rpi/Makefile
9191f6ad 2304 src/agent/subagents/sms/Makefile
80e96a82 2305 src/agent/subagents/sunos/Makefile
9191f6ad 2306 src/agent/subagents/ups/Makefile
80e96a82
VK
2307 src/agent/subagents/winnt/Makefile
2308 src/agent/subagents/winperf/Makefile
6afe141e 2309 src/agent/subagents/wmi/Makefile
2310 src/agent/subagents/db2/Makefile
0bd64860 2311 src/agent/tools/Makefile
6ac698ed 2312 src/agent/tools/nxappget/Makefile
0bd64860 2313 src/agent/tools/nxapush/Makefile
c2612d83 2314 src/client/Makefile
551592f4 2315 src/client/install/Makefile
c94fa5c2 2316 src/client/nxalarm/Makefile
e84701c5 2317 src/client/nxevent/Makefile
9cb6c12f 2318 src/client/nxlexer/Makefile
e84701c5 2319 src/client/nxpush/Makefile
59ffa5b7 2320 src/client/nxsms/Makefile
9cb6c12f
VK
2321 src/client/scilexer/Makefile
2322 src/client/windows/Makefile
2323 src/client/windows/nxav/Makefile
2324 src/client/windows/nxav/res/Makefile
23c8c53e
AK
2325 src/client/windows/nxcon/Makefile
2326 src/client/windows/nxcon/icons/Makefile
2327 src/client/windows/nxcon/res/Makefile
23c8c53e
AK
2328 src/client/windows/nxnotify/Makefile
2329 src/client/windows/nxnotify/res/Makefile
9cb6c12f
VK
2330 src/client/windows/nxuilib/Makefile
2331 src/client/windows/nxuilib/res/Makefile
2332 src/client/windows/nxuilib/sounds/Makefile
d1834406
VK
2333 src/db/Makefile
2334 src/db/dbdrv/Makefile
87f1fff0
VK
2335 src/db/dbdrv/db2/Makefile
2336 src/db/dbdrv/informix/Makefile
d1834406
VK
2337 src/db/dbdrv/odbc/Makefile
2338 src/db/dbdrv/mssql/Makefile
2339 src/db/dbdrv/mysql/Makefile
87f1fff0 2340 src/db/dbdrv/oracle/Makefile
d1834406
VK
2341 src/db/dbdrv/pgsql/Makefile
2342 src/db/dbdrv/sqlite/Makefile
d1834406 2343 src/db/libnxdb/Makefile
9191f6ad
VK
2344 src/install/Makefile
2345 src/install/windows/Makefile
2346 src/libexpat/Makefile
2347 src/libexpat/libexpat/Makefile
2348 src/libnetxms/Makefile
2349 src/libnxcl/Makefile
2350 src/libnxlp/Makefile
2351 src/libnxmap/Makefile
2352 src/libnxsl/Makefile
a67fa146
VK
2353 src/libtre/Makefile
2354 src/libtre/win32/Makefile
9191f6ad 2355 src/nxscript/Makefile
0c3c0c39
AK
2356 src/server/Makefile
2357 src/server/core/Makefile
644f97f5 2358 src/server/drivers/Makefile
0239cfea 2359 src/server/drivers/at/Makefile
644f97f5 2360 src/server/drivers/baystack/Makefile
b1bd1fb2 2361 src/server/drivers/cat2900xl/Makefile
910846cc 2362 src/server/drivers/catalyst/Makefile
fce03ab9 2363 src/server/drivers/cisco-esw/Makefile
8bdfaed8 2364 src/server/drivers/dell-pwc/Makefile
a548def4 2365 src/server/drivers/dlink/Makefile
644f97f5 2366 src/server/drivers/ers8000/Makefile
4e592faf
VK
2367 src/server/drivers/lib/Makefile
2368 src/server/drivers/lib/avaya-ers/Makefile
b1bd1fb2 2369 src/server/drivers/lib/cisco/Makefile
81ecaf38 2370 src/server/drivers/netscreen/Makefile
e10e890e 2371 src/server/drivers/ntws/Makefile
c183a9f9 2372 src/server/drivers/ping3/Makefile
9b13553b 2373 src/server/drivers/procurve/Makefile
217e4d6a 2374 src/server/drivers/symbol-ws/Makefile
d770a97c
VK
2375 src/server/include/Makefile
2376 src/server/libnxsrv/Makefile
2377 src/server/netxmsd/Makefile
d8f2e39b
VK
2378 src/server/smsdrv/Makefile
2379 src/server/smsdrv/generic/Makefile
91369aca 2380 src/server/smsdrv/nxagent/Makefile
aab8a8b6 2381 src/server/smsdrv/portech/Makefile
80a30c53 2382 src/server/smsdrv/dummy/Makefile
0c3c0c39 2383 src/server/tools/Makefile
0c3c0c39
AK
2384 src/server/tools/nxaction/Makefile
2385 src/server/tools/nxadm/Makefile
9191f6ad 2386 src/server/tools/nxap/Makefile
5b0c7d0d
VK
2387 src/server/tools/nxconfig/Makefile
2388 src/server/tools/nxconfig/res/Makefile
f90d7fc5 2389 src/server/tools/nxdbmgr/Makefile
9191f6ad 2390 src/server/tools/nxget/Makefile
d24fdaf4 2391 src/server/tools/nxupload/Makefile
c5c0f362
VK
2392 src/snmp/Makefile
2393 src/snmp/libnxsnmp/Makefile
2394 src/snmp/nxmibc/Makefile
2395 src/snmp/nxsnmpget/Makefile
2396 src/snmp/nxsnmpset/Makefile
2397 src/snmp/nxsnmpwalk/Makefile
9191f6ad 2398 src/sqlite/Makefile
f65df2b1 2399 src/tools/Makefile
f65df2b1 2400 src/tools/nxdevcfg/Makefile
56e13b13 2401 src/tools/nxencpasswd/Makefile
1fd41bcd 2402 src/zlib/Makefile
9191f6ad 2403 sql/Makefile
0c3c0c39 2404 tools/Makefile
d16cf8a5
AK
2405])
2406
12249937
VK
2407AC_OUTPUT
2408
ef0c727b 2409echo "Updating libtool"
5cecf50e
AK
2410sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2411
779ce551 2412# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
5482ef16 2413if test "x$ac_compiler_gnu" = "xyes" && test "x$PLATFORM" = "xHP-UX"; then
779ce551
VK
2414 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2415fi
2416
b677ef59
VK
2417# On AIX, correct OBJECT_MODE must be set before linking
2418# To avoid manual setting by user, we add this to libtool script
2419if test "x$PLATFORM" = "xAIX"; then
2420 head -n 1 ./libtool > ./libtool.new
2421 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
2422 tail -n +2 ./libtool >> ./libtool.new
2423 mv libtool.new libtool
2424 chmod +x ./libtool
2425fi
2426
ef0c727b
VK
2427#--------------------------------------------------------------------
2428# Print summary
2429#--------------------------------------------------------------------
a7442678 2430
a7442678
AK
2431echo
2432echo
2433echo
2434echo '---------------------------------------------------------------------'
2435echo ' Configure results'
2436echo '---------------------------------------------------------------------'
2437echo
8b86c5dc 2438 echo "Prefix : ${prefix}"
a7442678 2439if test "x${BUILD_SERVER}" = "xyes"; then
8b86c5dc 2440 echo "Build Server : YES"
7c48e2aa 2441 echo "Server libs : ${SERVER_LIBS}"
a7442678 2442else
8b86c5dc 2443 echo "Build Server : NO"
a7442678
AK
2444fi
2445if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
8b86c5dc 2446 echo "Encryption enabled : YES"
a7442678 2447else
8b86c5dc 2448 echo "Encryption enabled : NO"
a7442678
AK
2449fi
2450if test "x${DB_DRIVERS}" != "x"; then
8b86c5dc 2451 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678 2452else
8b86c5dc 2453 echo "Build DB-Drivers : NO"
a7442678
AK
2454fi
2455if test "x${BUILD_CLIENT}" = "xyes"; then
8b86c5dc 2456 echo "Build Clients : YES"
a7442678 2457else
8b86c5dc 2458 echo "Build Clients : NO"
a7442678
AK
2459fi
2460if test "x${BUILD_AGENT}" = "xyes"; then
8b86c5dc
VK
2461 echo "Build Agent : YES"
2462 echo "Subagents list : ${SUBAGENT_DIRS}"
a7442678 2463else
8b86c5dc 2464 echo "Build Agent : NO"
a7442678 2465fi
e8636669 2466if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
8b86c5dc
VK
2467 echo "Build Static Agent : YES"
2468 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
e8636669 2469else
8b86c5dc 2470 echo "Build Static Agent : NO"
e8636669 2471fi
8b86c5dc 2472if test "x${BUILD_UNICODE}" = "xyes"; then
a67fa146 2473 echo "UNICODE build : YES"
8b86c5dc 2474else
a67fa146 2475 echo "UNICODE build : NO"
8b86c5dc 2476fi
551ec9ca
VK
2477if test "x${HAVE_LIBEXPAT}" = "xno"; then
2478 echo "Use internal libexpat : YES"
1bb6b449 2479else
551ec9ca 2480 echo "Use internal libexpat : NO"
1bb6b449 2481fi
17b35ccc
VK
2482if test "x${HAVE_LIBTRE}" = "xno"; then
2483 echo "Use internal libtre : YES"
2484else
2485 echo "Use internal libtre : NO"
2486fi
1fd41bcd
VK
2487if test "x${NEED_ZLIB}" = "xyes"; then
2488 if test "x${HAVE_ZLIB}" = "xno"; then
2489 echo "Use internal zlib : YES"
2490 else
2491 echo "Use internal zlib : NO"
2492 fi
2493fi
cc297a70
VK
2494if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
2495 echo "Force 32bit build : YES"
2496else
2497 echo "Force 32bit build : NO"
2498fi
7d8c91ef 2499
9113e749
VK
2500echo "C compiler : ${CC}"
2501echo "C++ compiler : ${CXX}"
7d8c91ef
VK
2502echo "CPPFLAGS : ${CPPFLAGS}"
2503echo "CXXFLAGS : ${CXXFLAGS}"
2504echo "CFLAGS : ${CFLAGS}"
2505echo "LDFLAGS : ${LDFLAGS}"
8d131dda 2506echo "LIBS : ${LIBS}"
7d8c91ef 2507
6fce76d8
VK
2508if test "x${MYSQL_LIBS}" != "x"; then
2509 echo "MySQL libs : ${MYSQL_LIBS}"
2510fi
2511if test "x${PGSQL_LIBS}" != "x"; then
2512 echo "PostgreSQL libs : ${PGSQL_LIBS}"
2513fi
7d8c91ef
VK
2514if test "x${ORACLE_LIBS}" != "x"; then
2515 echo "Oracle libs : ${ORACLE_LIBS}"
2516fi
6fce76d8
VK
2517if test "x${ODBC_LIBS}" != "x"; then
2518 echo "ODBC libs : ${ODBC_LIBS}"
2519fi
84277a0f
AK
2520if test "x${DB2_LIBS}" != "x"; then
2521 echo "DB2 libs : ${DB2_LIBS}"
2522fi
37861c72
VK
2523if test "x${INFORMIX_LIBS}" != "x"; then
2524 echo "Informix libs : ${INFORMIX_LIBS}"
2525fi
ecbed20c
VK
2526
2527FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
2528echo "/* Automatically generated by configure */" > $FLAGS_CPP
d541b129
VK
2529echo "#include <nms_common.h>" >> $FLAGS_CPP
2530echo "const TCHAR *g_cppFlags = _T(\"${CPPFLAGS}\");" >> $FLAGS_CPP
2531echo "const TCHAR *g_cFlags = _T(\"${CFLAGS}\");" >> $FLAGS_CPP
2532echo "const TCHAR *g_cxxFlags = _T(\"${CXXFLAGS}\");" >> $FLAGS_CPP
2533echo "const TCHAR *g_ldFlags = _T(\"${LDFLAGS}\");" >> $FLAGS_CPP
2534echo "const TCHAR *g_libs = _T(\"${LIBS}\");" >> $FLAGS_CPP
7dda4453
VK
2535echo "const TCHAR *g_cc = _T(\"${CC}\");" >> $FLAGS_CPP
2536echo "const TCHAR *g_cxx = _T(\"${CXX}\");" >> $FLAGS_CPP
2537echo "const TCHAR *g_ld = _T(\"${LD}\");" >> $FLAGS_CPP
2538echo "const TCHAR *g_perl = _T(\"${PERL}\");" >> $FLAGS_CPP