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
136 # Misc win32 / mingw checks and variables end
137 #########################################################################
140 ############################################################################
141 # Check for guile start
144 # Check Guile version
147 guile_need_version="$guile_need_major[].$guile_need_minor.0"
149 AC_MSG_CHECKING([Guile version >= $guile_need_version])
150 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
152 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
153 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
154 AC_MSG_RESULT($GUILE_VERSION)
156 if test "$guile_need_major" -gt "$guile_major" \
157 || (test "$guile_need_major" -eq "$guile_major" \
158 && test "$guile_need_minor" -gt "$guile_minor"); then
159 AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
162 # Guile 1.6 compatability
164 CFLAGS_temp_save="$CFLAGS"
165 CFLAGS="$CFLAGS $GUILE_CFLAGS"
166 AC_CHECK_DECLS([scm_is_string, scm_is_integer, scm_to_int,
167 scm_from_int, scm_is_true, scm_is_false,
168 scm_from_locale_string, scm_to_locale_string],,,
169 [#include <libguile.h>])
170 CFLAGS="$CFLAGS_temp_save"
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 # Create all the necessary derived files
430 AC_CONFIG_FILES([Makefile
436 tests/hierarchy/Makefile
437 tests/hierarchy2/Makefile
439 tests/common/Makefile
440 tests/common/outputs/osmond/Makefile
441 tests/common/outputs/pcbpins/Makefile
442 tests/common/outputs/redac/Makefile
443 tests/common/outputs/switcap/Makefile
444 tests/common/outputs/futurenet2/Makefile
445 tests/common/outputs/mathematica/Makefile
446 tests/common/outputs/bom/Makefile
447 tests/common/outputs/verilog/Makefile
448 tests/common/outputs/cascade/Makefile
449 tests/common/outputs/partslist1/Makefile
450 tests/common/outputs/drc2/Makefile
451 tests/common/outputs/geda/Makefile
452 tests/common/outputs/gossip/Makefile
453 tests/common/outputs/systemc/Makefile
454 tests/common/outputs/pads/Makefile
455 tests/common/outputs/vams/Makefile
456 tests/common/outputs/Makefile
457 tests/common/outputs/partslist2/Makefile
458 tests/common/outputs/PCBboard/Makefile
459 tests/common/outputs/bae/Makefile
460 tests/common/outputs/vipec/Makefile
461 tests/common/outputs/eagle/Makefile
462 tests/common/outputs/protelII/Makefile
463 tests/common/outputs/PCB/Makefile
464 tests/common/outputs/gsch2pcb/Makefile
465 tests/common/outputs/vhdl/Makefile
466 tests/common/outputs/calay/Makefile
467 tests/common/outputs/tango/Makefile
468 tests/common/outputs/spice-sdb/Makefile
469 tests/common/outputs/maxascii/Makefile
470 tests/common/outputs/bom2/Makefile
471 tests/common/outputs/drc/Makefile
472 tests/common/outputs/partslist3/Makefile
473 tests/common/outputs/allegro/Makefile
474 tests/common/inputs/models/Makefile
475 tests/common/inputs/Makefile
476 tests/common/inputs/sym/Makefile
479 examples/vams/Makefile
480 examples/vams/sch/Makefile
481 examples/vams/sym/Makefile
482 examples/vams/vhdl/Makefile
483 examples/vams/vhdl/basic-vhdl/Makefile
484 examples/vams/vhdl/new-vhdl/Makefile
485 examples/switcap/Makefile
490 lib/system-gnetlistrc ])
491 AC_CONFIG_COMMANDS([sw2asc-chmod],[[chmod +x scripts/sw2asc]],[[]])
495 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
496 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
497 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
498 expandedPCBM4DIR=`eval "echo $PCBM4DIR"`
501 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
503 GTK+ library version: $GTK_VERSION
504 libgeda library version: $LIBGEDA_VERSION
506 data directory: $expandedGEDADATADIR
507 rc directory: $expandedGEDARCDIR
508 documentation directory: $expandedGEDADOCDIR
509 default PCB m4 directory: $expandedPCBM4DIR
510 dmalloc debugging: $with_dmalloc
511 Electric Fence debugging: $with_efence