1#
2# configure.in --
3#
4#      Process this file with autoconf to produce a configure script.
5#
6# Copyright (c) 1999-2008 Frank Strauss, Technical University of Braunschweig.
7#
8# See the file "COPYING" for information on usage and redistribution
9# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10#
11# @(#) $Id: configure.in 8090 2008-04-18 12:56:29Z strauss $
12#
13
14AC_INIT(tools/smilint.c)
15
16LIBSMI_MAJOR=0
17LIBSMI_MINOR=4
18LIBSMI_PATCHLEVEL=8
19LIBTOOL_VERSION=2
20LIBTOOL_REVISION=27
21LIBTOOL_AGE=0
22
23VERSION_STRING="$LIBSMI_MAJOR.$LIBSMI_MINOR.$LIBSMI_PATCHLEVEL"
24VERSION_LIBTOOL="$LIBTOOL_VERSION:$LIBTOOL_REVISION:$LIBTOOL_AGE"
25
26AM_INIT_AUTOMAKE(libsmi,$VERSION_STRING)
27AM_CONFIG_HEADER(config.h)
28
29AC_DEFINE([MAX_LEX_DEPTH], 30,
30[The maximum module import recursion depth.])
31
32AC_DEFINE([DEFAULT_ERRORLEVEL], 3,
33[The default error level at libsmi initialization.])
34
35AC_ARG_WITH(cflags,
36[  --with-cflags=FLAGS     use FLAGS for CFLAGS],
37CFLAGS="$withval")
38
39AC_PROG_CC
40AC_ARG_WITH(cc,
41[  --with-cc=CC            use CC as the C compiler],
42CC="$withval")
43
44AC_MSG_CHECKING([for additional required compiler flags])
45AC_TRY_RUN([#include <stdio.h>
46  main() {
47  #ifdef __SUNPRO_C
48        exit(0);
49  #else
50        exit(1);
51  #endif
52  }
53], ADDCFLAGS="-DYY_USE_PROTOS", ADDCFLAGS="", ADDCFLAGS="")
54echo $ADDCFLAGS
55CFLAGS="$CFLAGS $ADDCFLAGS"
56
57AC_CHECK_FUNCS(strtoll strtoull strtoq strtouq)
58
59AC_CHECK_FUNCS(timegm)
60
61AC_CHECK_FUNCS(vsnprintf snprintf asprintf asnprintf vasprintf vasnprintf)
62
63AC_CHECK_HEADERS(pwd.h unistd.h regex.h stdint.h limits.h)
64
65# In case regex is not in libc
66AC_CHECK_LIB(c,regexec,LDFLAGS="$LDFLAGS",
67[
68    AC_CHECK_LIB(rxspencer,regexec,LDFLAGS="$LDFLAGS -lrxspencer",
69    [
70        AC_CHECK_LIB(regex,regexec,LDFLAGS="$LDFLAGS -lregex")
71    ])
72])
73
74if test "x$prefix" = "xNONE" ; then
75  prefix=/usr/local
76fi
77
78AC_ARG_WITH(mibdir,
79[  --with-mibdir=DIR       use DIR to install libsmi MIB modules [DATADIR/mibs]],
80mibdir="$withval", mibdir="$prefix/share/mibs")
81
82AC_ARG_WITH(pibdir,
83[  --with-pibdir=DIR       use DIR to install libsmi PIB modules [DATADIR/pibs]],
84pibdir="$withval", pibdir="$prefix/share/pibs")
85
86AC_ARG_WITH(smipath,
87[  --with-smipath=DIR:DIR  default DIRs to search for MIB/PIB modules [MIBDIR...]],
88smipath="$withval", smipath="$mibdir/ietf:$mibdir/iana:$mibdir/irtf:$mibdir/site:$mibdir/tubs:$pibdir/ietf:$pibdir/site:$pibdir/tubs")
89
90AC_DEFINE_UNQUOTED([DEFAULT_SMIPATH], "$smipath",
91[The default search path to lookup SMI module files.])
92
93AC_ARG_WITH(pathseparator,
94[  --with-pathseparator=C  use C as the path separator [: on UNIX, ; on WIN32]],
95pathseparator="$withval", pathseparator="")
96
97AC_ARG_WITH(dirseparator,
98[  --with-dirseparator=C   use C as the dir separator [/ on UNIX, \\ on WIN32]],
99dirseparator="$withval", dirseparator="")
100
101AC_MSG_CHECKING([for path separator character])
102if test "$pathseparator" = "" ; then
103  AC_TRY_RUN([#include <stdio.h>
104    main() {
105    #ifdef _WIN32
106	  exit(0);
107    #else
108	  exit(1);
109    #endif
110    }
111  ], pathseparator=";", pathseparator=":", pathseparator=":")
112fi
113echo $pathseparator
114
115AC_MSG_CHECKING([for dir separator character])
116if test "$dirseparator" = "" ; then
117  AC_TRY_RUN([#include <stdio.h>
118    main() {
119    #ifdef _WIN32
120	  exit(0);
121    #else
122	  exit(1);
123    #endif
124    }
125  ], dirseparator="\\\\", dirseparator="/", dirseparator="/")
126fi
127echo $dirseparator
128
129AC_DEFINE_UNQUOTED([PATH_SEPARATOR], '$pathseparator',
130[The default path separator character.])
131
132AC_DEFINE_UNQUOTED([DIR_SEPARATOR], '$dirseparator',
133[The default path separator character.])
134
135
136AC_MSG_CHECKING([for 64 bit types])
137#
138# Note that int64_min is defined as -9223372036854775807LL and NOT as
139# -9223372036854775808LL. gcc (version 2.95.4 and others) complains with
140# "warning: decimal constant is so large that it is unsigned"
141# if used with the (correct) value -9223372036854775808LL.
142#
143AC_TRY_RUN([#include <stdio.h>
144      main() {
145	  long long ll;
146	  unsigned long long ull;
147	  exit(0);
148      }
149    ],
150    uint64_type="unsigned long long"; int64_type="long long";
151    uint64_format="%llu"; int64_format="%lld";
152    uint64_max="18446744073709551615ULL";
153    int64_min="-9223372036854775807LL"; int64_max="9223372036854775807LL"
154    ,
155    uint64_type="unsigned long"; int64_type="long";
156    uint64_format="%lu"; int64_format="%ld";
157    uint64_max="4294967295";
158    int64_min="-2147483648"; int64_max="2147483647"
159    ,
160    uint64_type="unsigned long long"; int64_type="long long";
161    uint64_format="%llu"; int64_format="%lld";
162    uint64_max="18446744073709551615ULL";
163    int64_min="-9223372036854775807LL"; int64_max="9223372036854775807LL"
164)
165echo $int64_type/$int64_format, etc.
166
167UINT64_TYPE=$uint64_type
168INT64_TYPE=$int64_type
169AC_DEFINE_UNQUOTED([UINT64_FORMAT], "$uint64_format",
170[The unsigned 64 bit integer format conversion specification string.])
171AC_DEFINE_UNQUOTED([INT64_FORMAT], "$int64_format",
172[The signed 64 bit integer format conversion specification string.])
173AC_DEFINE_UNQUOTED([LIBSMI_UINT64_MAX], $uint64_max,
174[The unsigned 64 bit integer maximum value.])
175AC_DEFINE_UNQUOTED([LIBSMI_INT64_MIN], $int64_min,
176[The unsigned 64 bit integer minimum value.])
177AC_DEFINE_UNQUOTED([LIBSMI_INT64_MAX], $int64_max,
178[The signed 64 bit integer maximum value.])
179
180
181AC_ARG_ENABLE(dmalloc,
182[  --enable-dmalloc        enable dmalloc debugging (www.dmalloc.com)],
183LIBS="$LIBS -ldmalloc"
184AC_DEFINE([HAVE_DMALLOC_H], 1, ""))
185
186AC_DEFINE(BACKEND_SMI, 1, "")
187AC_ARG_ENABLE(smi,
188[  --disable-smi           disable SMIv1/v2 parser support],
189AC_DEFINE(BACKEND_SMI, 1, ""))
190
191AC_ARG_ENABLE(sming,
192[  --enable-sming          enable SMIng parser support],
193AC_DEFINE(BACKEND_SMING, 0, ""))
194
195AC_PATH_PROG(FLEX, "flex")
196if test -z "${FLEX}" ; then
197  echo "NOTE: We will not be able to build scanner C code from flex sources."
198fi
199
200AC_PATH_PROG(BISON, "bison")
201if test -z "${BISON}" ; then
202  echo "NOTE: We will not be able to build parser C code from bison sources."
203fi
204
205AC_PATH_PROG(BASH, "bash")
206AC_PATH_PROG(SH, "sh")
207AC_PATH_PROG(AWK, awk)
208AC_PATH_PROG(WGET, wget)
209
210AC_PATH_PROGS(DIFF, gdiff diff)
211$DIFF --version >/dev/null 2>&1
212if test $? -eq 0 ; then
213	DIFF="$DIFF --ignore-matching-lines='generated by smidump' --ignore-matching-lines='\$Id.*\$' --ignore-matching-lines='@author.*smidump'"
214fi
215
216AC_EXEEXT
217AC_PROG_INSTALL
218AC_PROG_MAKE_SET
219AM_PROG_LIBTOOL
220AC_SUBST(LIBTOOL_DEPS)
221
222AC_DEFINE_UNQUOTED([DEFAULT_GLOBALCONFIG], "${sysconfdir}/smi.conf",
223[The full pathname of the global configuration file.])
224
225AC_DEFINE([DEFAULT_USERCONFIG], ".smirc",
226[The basename of the per-user configuration file searched in $HOME.])
227
228if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then
229  STATIC=-static
230else
231  STATIC=
232fi
233AC_SUBST(STATIC)
234
235AC_SUBST(LIBSMI_MAJOR)
236AC_SUBST(LIBSMI_MINOR)
237AC_SUBST(LIBSMI_PATCHLEVEL)
238AC_SUBST(LIBTOOL_VERSION)
239AC_SUBST(LIBTOOL_REVISION)
240AC_SUBST(LIBTOOL_AGE)
241AC_SUBST(VERSION_STRING)
242AC_SUBST(VERSION_LIBTOOL)
243AC_SUBST(UINT64_TYPE)
244AC_SUBST(INT64_TYPE)
245
246AC_SUBST(EXEEXT)
247AC_SUBST(BASH)
248AC_SUBST(SH)
249AC_SUBST(AWK)
250AC_SUBST(WGET)
251AC_SUBST(DIFF)
252AC_SUBST(CC)
253AC_SUBST(CFLAGS)
254AC_SUBST(srcdir)
255AC_SUBST(mibdir)
256AC_SUBST(pibdir)
257AC_SUBST(smipath)
258
259AC_OUTPUT([
260Makefile
261lib/Makefile
262tools/Makefile
263mibs/Makefile
264mibs/iana/Makefile
265mibs/ietf/Makefile
266mibs/irtf/Makefile
267mibs/tubs/Makefile
268mibs/site/Makefile
269pibs/Makefile
270pibs/ietf/Makefile
271pibs/tubs/Makefile
272pibs/site/Makefile
273test/Makefile
274test/mibs/Makefile
275test/smidiff/Makefile
276test/dumps/Makefile
277test/dumps/corba/Makefile
278test/dumps/imports/Makefile
279test/dumps/jax/Makefile
280test/dumps/netsnmp/Makefile
281test/dumps/mosy/Makefile
282test/dumps/orig-smiv2/Makefile
283test/dumps/smilint-smiv2/Makefile
284test/dumps/sming/Makefile
285test/dumps/smiv1/Makefile
286test/dumps/smiv2/Makefile
287test/dumps/smiv2-smiv2/Makefile
288test/dumps/tree/Makefile
289test/dumps/types/Makefile
290test/dumps/identifiers/Makefile
291test/dumps/metrics/Makefile
292test/dumps/xml/Makefile
293test/dumps/cm/Makefile
294test/dumps/python/Makefile
295test/dumps/yang/Makefile
296doc/Makefile
297lib/smi.h
298lib/libsmi.3
299lib/smi_macro.3
300lib/smi_module.3
301lib/smi_node.3
302lib/smi_type.3
303lib/smi_config.3
304lib/smi_render.3
305lib/smi_util.3
306lib/smi_class.3
307lib/smi_attribute.3
308lib/smi_event.3
309lib/smi_identity.3
310tools/smistrip
311tools/smicache
312tools/smiquery.1
313tools/smilint.1
314tools/smidump.1
315tools/smidiff.1
316tools/smistrip.1
317tools/smicache.1
318tools/smixlate.1
319tools/mib2svg.cgi
320test/parser.test
321test/smidump-corba.test
322test/smidump-jax.test
323test/smidump-netsnmp.test
324test/smidump-imports.test
325test/smidump-mosy.test
326test/smidump-orig-smiv2.test
327test/smidump-sming.test
328test/smidump-yang.test
329test/smidump-smiv1.test
330test/smidump-smiv2-smiv2.test
331test/smidump-smiv2.test
332test/smidump-tree.test
333test/smidump-types.test
334test/smidump-identifiers.test
335test/smidump-metrics.test
336test/smidump-xml.test
337test/smidump-cm.test
338test/smidump-python.test
339test/smilint-smiv2.test
340test/smidiff.test
341libsmi.pc
342win/config.h],
343chmod a+x test/*.test
344)
345