1 # Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/gnetlist.c])
9 echo Configuring $PACKAGE version $DOTTED_VERSION.$DATE_VERSION
12 AM_INIT_AUTOMAKE($PACKAGE, $DOTTED_VERSION, no-define)
13 AM_CONFIG_HEADER([config.h])
15 #########################################################################
16 # Command line flags start
18 # Change default location for rc files
19 AC_ARG_WITH(rcdir, [ --with-rcdir=path Change where the system-*rc files are installed], [opt_rcdir=$withval])
21 AC_MSG_CHECKING([For the default pcb installation data directory])
22 AC_ARG_WITH(pcb-datadir,
23 [ --with-pcb-datadir=path
24 Change the default location for an installed pcb. This is used
25 to set the default search path for pcb newlib libraries.
26 [[default=${datadir}]]],
27 [PCBDATADIR=$withval],
28 [PCBDATADIR="${datadir}"]
30 AC_MSG_RESULT([${PCBDATADIR}])
33 # Change default location for pcb's m4 library directory
34 AC_MSG_CHECKING([For the default pcb m4 directory])
36 [ --with-pcbm4dir=path Change where the PCB m4 files are installed [[default=${PCBDATADIR}/pcb/m4]]],
38 [PCBM4DIR="${PCBDATADIR}/pcb/m4"]
40 AC_MSG_RESULT([${PCBM4DIR}])
43 # Change default location for pcb's newlib library directory
44 AC_ARG_WITH(pcb-newlib-path,
45 [ --with-pcb-newlib-path=path Change the default search path for PCB newlib libraries [[default=${datadir}/pcb/pcblib-newlib:${datadir}/pcb/newlib:]]],
46 [PCBLIBPATH=$withval],
47 [PCBLIBPATH="${datadir}/pcb/pcblib-newlib:${datadir}/pcb/newlib"]
51 # Change default location for pcb's m4 site configuration directory
52 AC_ARG_WITH(pcbconfdir,
53 [ --with-pcbconfdir=path Change where the PCB site config files are installed [[default=${sysconfdir}/pcb]]],
54 [PCBCONFDIR=$withval],
55 [PCBCONFDIR="${sysconfdir}/pcb"]
59 ## Added by SDB 3.3.2006
60 # Check for getopt_long
61 dnl check GNU getopt() - thanks libcmml!
64 AC_CHECK_FUNC([getopt_long], [HAVE_GETOPT_LONG="yes"])
65 if test "x$HAVE_GETOPT_LONG" != xyes ; then
66 dnl FreeBSD has a gnugetopt library
67 AC_CHECK_LIB([gnugetopt], [getopt_long], [HAVE_GETOPT_LONG="yes"])
68 if test "x$HAVE_GETOPT_LONG" = xyes ; then
69 GETOPT_LONG_LIBS="-lgnugetopt"
72 if test "x$HAVE_GETOPT_LONG" = xyes ; then
73 AC_DEFINE(HAVE_GETOPT_LONG, [], [Define to 1 if you have the 'getopt_long' function])
75 AC_SUBST(GETOPT_LONG_LIBS)
76 AC_SUBST(HAVE_GETOPT_LONG)
79 # Command line flags end
80 #########################################################################
82 # Checks for programs.
84 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
87 AC_PATH_PROGS(AWK, nawk gawk mawk awk, )
88 AC_PATH_PROGS(M4, gm4 m4, m4)
90 ##############################################################3
94 AC_MSG_CHECKING([For a working C99 __func__])
95 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
96 [[const char *foo = __func__;]])],
98 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
99 [[const char *foo = __FUNCTION__;]])],
100 [ac_cv_cpp_func=__FUNCTION__],
101 [ac_cv_cpp_func="\"no\""])]
104 if test "X$ac_cv_cpp_func" = "X__FUNCTION__"; then
105 AC_MSG_RESULT([__FUNCTION__])
106 elif test "x$ac_cv_cpp_func" = "xyes" ; then
107 AC_MSG_RESULT([__func__])
111 if test "X$ac_cv_cpp_func" != "Xyes" ; then
112 AC_DEFINE_UNQUOTED([__func__], [$ac_cv_cpp_func], [Define to be a __func__ replacement])
116 ##############################################################3
118 #########################################################################
120 # Misc win32 / mingw checks and variables start
123 # Figure out if we are building on win32 and what environment.
125 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
128 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
140 # Misc win32 / mingw checks and variables end
141 #########################################################################
144 ############################################################################
145 # Check for guile start
148 # Check Guile version
151 guile_need_version="$guile_need_major[].$guile_need_minor.0"
153 AC_MSG_CHECKING([Guile version >= $guile_need_version])
154 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
156 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
157 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
158 AC_MSG_RESULT($GUILE_VERSION)
160 if test $guile_need_major -gt $guile_major \
161 || test $guile_need_minor -gt $guile_minor; then
162 AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
165 # Guile 1.6 compatability
167 AC_CHECK_DECLS([scm_is_string, scm_is_integer, scm_to_int,
168 scm_from_int, scm_is_true, scm_is_false,
169 scm_from_locale_string, scm_to_locale_string],,,
170 [#include <libguile.h>])
172 AH_VERBATIM(SCM_IS_STRING, [#if !HAVE_DECL_SCM_IS_STRING
173 # define scm_is_string(x) SCM_STRINGP(x)
175 AH_VERBATIM(SCM_IS_INTEGER, [#if !HAVE_DECL_SCM_IS_INTEGER
176 # define scm_is_integer(x) SCM_INUMP(x)
178 AH_VERBATIM(SCM_TO_INT, [#if !HAVE_DECL_SCM_TO_INT
179 # define scm_to_int(x) SCM_INUM(x)
181 AH_VERBATIM(SCM_FROM_INT, [#if !HAVE_DECL_SCM_FROM_INT
182 # define scm_from_int(x) SCM_MAKINUM(x)
184 AH_VERBATIM(SCM_IS_TRUE, [#if !HAVE_DECL_SCM_IS_TRUE
185 # define scm_is_true(x) SCM_NFALSEP(x)
187 AH_VERBATIM(SCM_IS_FALSE, [#if !HAVE_DECL_SCM_IS_FALSE
188 # define scm_is_false(x) SCM_FALSEP(x)
190 AH_VERBATIM(SCM_FROM_LOCALE_STRING, [#if !HAVE_DECL_SCM_FROM_LOCALE_STRING
191 # define scm_from_locale_string(x) scm_makfrom0str(x)
193 AH_VERBATIM(SCM_TO_LOCALE_STRING, [#if !HAVE_DECL_SCM_TO_LOCALE_STRING
194 # define scm_to_locale_string(x) strdup(SCM_STRING_CHARS(x))
198 # Check for guile end
199 ############################################################################
201 ############################################################################
202 # Check for mics things start
204 # Checking for rint in math library
205 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
207 # Checking for dynamic lib
208 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
210 # Check for mics things start
211 ############################################################################
213 ############################################################################
214 # Check for gtk+ 2.4 start
217 # Check for pkg-config
218 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
219 if test $PKG_CONFIG = no; then
220 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
223 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
225 # This next bit of code figures out what gtk we need to use.
226 if test "$GTK24" = "yes"
229 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
230 GTK_CFLAGS=$GTK24_CFLAGS
232 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
235 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
236 if test "$GLIB24" != "yes"
238 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
240 GLIB_CFLAGS=$GLIB24_CFLAGS
241 GLIB_LIBS=$GLIB24_LIBS
242 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
248 if test "$GTK_VERSION" = ""
250 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
254 # Check for gtk+ 2.4 end
255 ############################################################################
257 ############################################################################
258 # Check for libgeda start
260 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes",
263 if test "$LIBGEDA" = "yes"
265 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
267 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
271 # Check for libgeda end
272 ############################################################################
274 #########################################################################
275 # Checks for header files start
280 AC_CHECK_HEADERS(unistd.h string.h strings.h stdlib.h \
281 stdarg.h assert.h fcntl.h errno.h getopt.h)
283 # Checks for typedefs, structures, and compiler characteristics.
286 # Checks for library functions.
288 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
290 AC_MSG_CHECKING([for optarg in unistd.h])
292 [#include <unistd.h>],
293 [ char *string = optarg; int i = optind; ],
296 AC_MSG_RESULT($optarg_found)
298 if test $optarg_found = yes; then
299 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
303 # Checks for header files start
304 #########################################################################
306 #########################################################################
309 # ------------- dmalloc -------------------
312 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
313 AC_ARG_ENABLE([dmalloc],
314 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
316 if test "X$enable_dmalloc" != "Xno" ; then
318 AC_CHECK_HEADER(dmalloc.h,,
319 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
320 AC_CHECK_LIB(dmalloc,main,,
321 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
322 DMALLOC_LIBS="-ldmalloc"
334 # ------------- ElectricFence -------------------
335 dnl ElectricFence checks
337 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
338 AC_ARG_ENABLE([efence],
339 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
341 if test "X$enable_efence" != "Xno" ; then
343 AC_CHECK_LIB(efence,main,,
344 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
355 #########################################################################
356 #########################################################################
357 # Check for groff start
361 AC_PATH_PROG(GROFF, groff, no, ${PATH})
362 if test $GROFF = "no"; then
363 echo "Cannot find groff, some documentation will not be created."
367 # Check for groff end
368 #########################################################################
370 #########################################################################
371 # gEDA/gaf specify setup start
375 GEDADATADIR=$datadir/$DATADIR
377 if eval "test x$opt_rcdir = x"; then
378 # path not was specified with --with-rcdir
379 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
380 GEDARCDIR=$GEDADATADIR
382 # path WAS specified with --with-rcdir
383 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
384 GEDARCDIR="$opt_rcdir"
387 # Expand the prefix variable
388 # I don't like the way this is done, but it works (I hope).
389 if eval "test x$prefix = xNONE"; then
390 dprefix=$ac_default_prefix
395 gedatopdir=$dprefix/share/$DATADIR
396 expandgedadatadir=`echo $gedatopdir`
398 gedadocdir=$dprefix/share/doc/geda-doc
399 # --with-docdir : tells where to store documentation if not default
401 [ --with-docdir Where to store documentation if not default.],
403 expandgedadocdir=`echo $gedadocdir`
404 GEDADOCDIR=$expandgedadocdir
407 # this has to be expanded ( no ${prefix} ) --
408 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
409 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
410 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
411 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
414 # gEDA/gaf specify things which need to setup
415 #########################################################################
417 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
418 GNETLIST_CFLAGS="$LIBGEDA_CFLAGS"
419 GNETLIST_LDFLAGS="$LIBGEDA_LIBS $DMALLOC_LIBS"
421 # Makefile.in variable substitution
422 AC_SUBST(DATE_VERSION)
423 AC_SUBST(DOTTED_VERSION)
424 AC_SUBST(GNETLIST_CFLAGS)
425 AC_SUBST(GNETLIST_LDFLAGS)
427 AC_SUBST(GEDADATADIR)
429 AC_SUBST(OTHERPATHSEP)
431 # Create all the necessary derived files
432 AC_CONFIG_FILES([Makefile
438 tests/hierarchy/Makefile
440 tests/spice-sdb/Makefile
441 tests/spice-sdb/inputs/Makefile
442 tests/spice-sdb/inputs/sym/Makefile
443 tests/spice-sdb/inputs/models/Makefile
444 tests/spice-sdb/outputs/Makefile
447 examples/vams/Makefile
448 examples/vams/sch/Makefile
449 examples/vams/sym/Makefile
450 examples/vams/vhdl/Makefile
451 examples/vams/vhdl/basic-vhdl/Makefile
452 examples/vams/vhdl/new-vhdl/Makefile
453 examples/switcap/Makefile
458 lib/system-gnetlistrc ])
459 AC_CONFIG_COMMANDS([sw2asc-chmod],[[chmod +x scripts/sw2asc]],[[]])
463 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
464 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
465 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
466 expandedPCBM4DIR=`eval "echo $PCBM4DIR"`
469 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
471 GTK+ library version: $GTK_VERSION
472 libgeda library version: $LIBGEDA_VERSION
474 data directory: $expandedGEDADATADIR
475 rc directory: $expandedGEDARCDIR
476 documentation directory: $expandedGEDADOCDIR
477 default PCB m4 directory: $expandedPCBM4DIR
478 dmalloc debugging: $with_dmalloc
479 Electric Fence debugging: $with_efence