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 #########################################################################
143 ############################################################################
144 # Check for mics things start
146 # Checking for rint in math library
147 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
149 # Checking for dynamic lib
150 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
152 # Check for mics things start
153 ############################################################################
155 ############################################################################
156 # Check for gtk+ 2.4 start
159 # Check for pkg-config
160 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
161 if test $PKG_CONFIG = no; then
162 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
165 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
167 # This next bit of code figures out what gtk we need to use.
168 if test "$GTK24" = "yes"
171 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
172 GTK_CFLAGS=$GTK24_CFLAGS
174 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
177 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
178 if test "$GLIB24" != "yes"
180 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
182 GLIB_CFLAGS=$GLIB24_CFLAGS
183 GLIB_LIBS=$GLIB24_LIBS
184 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
190 if test "$GTK_VERSION" = ""
192 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
196 # Check for gtk+ 2.4 end
197 ############################################################################
199 ############################################################################
200 # Check for libgeda start
202 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes",
205 if test "$LIBGEDA" = "yes"
207 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
209 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
213 # Check for libgeda end
214 ############################################################################
216 #########################################################################
217 # Checks for header files start
222 AC_CHECK_HEADERS(unistd.h string.h strings.h stdlib.h \
223 stdarg.h assert.h fcntl.h errno.h getopt.h)
225 # Checks for typedefs, structures, and compiler characteristics.
228 # Checks for library functions.
230 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
232 AC_MSG_CHECKING([for optarg in unistd.h])
234 [#include <unistd.h>],
235 [ char *string = optarg; int i = optind; ],
238 AC_MSG_RESULT($optarg_found)
240 if test $optarg_found = yes; then
241 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
245 # Checks for header files start
246 #########################################################################
248 #########################################################################
251 # ------------- dmalloc -------------------
254 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
255 AC_ARG_ENABLE([dmalloc],
256 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
258 if test "X$enable_dmalloc" != "Xno" ; then
260 AC_CHECK_HEADER(dmalloc.h,,
261 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
262 AC_CHECK_LIB(dmalloc,main,,
263 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
264 DMALLOC_LIBS="-ldmalloc"
276 # ------------- ElectricFence -------------------
277 dnl ElectricFence checks
279 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
280 AC_ARG_ENABLE([efence],
281 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
283 if test "X$enable_efence" != "Xno" ; then
285 AC_CHECK_LIB(efence,main,,
286 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
297 #########################################################################
298 #########################################################################
299 # Check for groff start
303 AC_PATH_PROG(GROFF, groff, no, ${PATH})
304 if test $GROFF = "no"; then
305 echo "Cannot find groff, some documentation will not be created."
309 # Check for groff end
310 #########################################################################
312 #########################################################################
313 # gEDA/gaf specify setup start
317 GEDADATADIR=$datadir/$DATADIR
319 if eval "test x$opt_rcdir = x"; then
320 # path not was specified with --with-rcdir
321 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
322 GEDARCDIR=$GEDADATADIR
324 # path WAS specified with --with-rcdir
325 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
326 GEDARCDIR="$opt_rcdir"
329 # Expand the prefix variable
330 # I don't like the way this is done, but it works (I hope).
331 if eval "test x$prefix = xNONE"; then
332 dprefix=$ac_default_prefix
337 gedatopdir=$dprefix/share/$DATADIR
338 expandgedadatadir=`echo $gedatopdir`
340 gedadocdir=$dprefix/share/doc/geda-doc
341 # --with-docdir : tells where to store documentation if not default
343 [ --with-docdir Where to store documentation if not default.],
345 expandgedadocdir=`echo $gedadocdir`
346 GEDADOCDIR=$expandgedadocdir
349 # this has to be expanded ( no ${prefix} ) --
350 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
351 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
352 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
353 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
356 # gEDA/gaf specify things which need to setup
357 #########################################################################
359 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
360 GNETLIST_CFLAGS="$LIBGEDA_CFLAGS"
361 GNETLIST_LDFLAGS="$LIBGEDA_LIBS $DMALLOC_LIBS"
363 # Makefile.in variable substitution
364 AC_SUBST(DATE_VERSION)
365 AC_SUBST(DOTTED_VERSION)
366 AC_SUBST(GNETLIST_CFLAGS)
367 AC_SUBST(GNETLIST_LDFLAGS)
369 AC_SUBST(GEDADATADIR)
371 AC_SUBST(OTHERPATHSEP)
373 # Create all the necessary derived files
374 AC_CONFIG_FILES([Makefile
380 tests/hierarchy/Makefile
382 tests/spice-sdb/Makefile
383 tests/spice-sdb/inputs/Makefile
384 tests/spice-sdb/inputs/sym/Makefile
385 tests/spice-sdb/inputs/models/Makefile
386 tests/spice-sdb/outputs/Makefile
389 examples/vams/Makefile
390 examples/vams/sch/Makefile
391 examples/vams/sym/Makefile
392 examples/vams/vhdl/Makefile
393 examples/vams/vhdl/basic-vhdl/Makefile
394 examples/vams/vhdl/new-vhdl/Makefile
395 examples/switcap/Makefile
400 lib/system-gnetlistrc ])
401 AC_CONFIG_COMMANDS([sw2asc-chmod],[[chmod +x scripts/sw2asc]],[[]])
405 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
406 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
407 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
408 expandedPCBM4DIR=`eval "echo $PCBM4DIR"`
411 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
413 GTK+ library version: $GTK_VERSION
414 libgeda library version: $LIBGEDA_VERSION
416 data directory: $expandedGEDADATADIR
417 rc directory: $expandedGEDARCDIR
418 documentation directory: $expandedGEDADOCDIR
419 default PCB m4 directory: $expandedPCBM4DIR
420 dmalloc debugging: $with_dmalloc
421 Electric Fence debugging: $with_efence