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