1 # Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/gnetlist.c])
8 echo Configuring $PACKAGE version $VERSION
11 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
12 AM_CONFIG_HEADER([config.h])
14 # Initialize maintainer mode
18 #########################################################################
19 # Command line flags start
21 # Change default location for rc files
22 AC_ARG_WITH(rcdir, [ --with-rcdir=path Change where the system-*rc files are installed], [opt_rcdir=$withval])
24 AC_MSG_CHECKING([For the default pcb installation data directory])
25 AC_ARG_WITH(pcb-datadir,
26 [ --with-pcb-datadir=path
27 Change the default location for an installed pcb. This is used
28 to set the default search path for pcb newlib libraries.
29 [[default=${datadir}]]],
30 [PCBDATADIR=$withval],
31 [PCBDATADIR="${datadir}"]
33 AC_MSG_RESULT([${PCBDATADIR}])
36 # Change default location for pcb's m4 library directory
37 AC_MSG_CHECKING([For the default pcb m4 directory])
39 [ --with-pcbm4dir=path Change where the PCB m4 files are installed [[default=${PCBDATADIR}/pcb/m4]]],
41 [PCBM4DIR="${PCBDATADIR}/pcb/m4"]
43 AC_MSG_RESULT([${PCBM4DIR}])
46 # Change default location for pcb's newlib library directory
47 AC_ARG_WITH(pcb-newlib-path,
48 [ --with-pcb-newlib-path=path Change the default search path for PCB newlib libraries [[default=${datadir}/pcb/pcblib-newlib:${datadir}/pcb/newlib:]]],
49 [PCBLIBPATH=$withval],
50 [PCBLIBPATH="${datadir}/pcb/pcblib-newlib:${datadir}/pcb/newlib"]
54 # Change default location for pcb's m4 site configuration directory
55 AC_ARG_WITH(pcbconfdir,
56 [ --with-pcbconfdir=path Change where the PCB site config files are installed [[default=${sysconfdir}/pcb]]],
57 [PCBCONFDIR=$withval],
58 [PCBCONFDIR="${sysconfdir}/pcb"]
62 ## Added by SDB 3.3.2006
63 # Check for getopt_long
64 dnl check GNU getopt() - thanks libcmml!
66 AC_CHECK_FUNC([getopt_long], [HAVE_GETOPT_LONG="yes"])
67 if test "x$HAVE_GETOPT_LONG" != xyes ; then
68 dnl FreeBSD has a gnugetopt library
69 AC_CHECK_LIB([gnugetopt], [getopt_long], [HAVE_GETOPT_LONG="yes"])
70 if test "x$HAVE_GETOPT_LONG" = xyes ; then
71 GETOPT_LONG_LIBS="-lgnugetopt"
72 AC_SUBST(GETOPT_LONG_LIBS)
75 if test "x$HAVE_GETOPT_LONG" != "xyes"; then
77 AC_SUBST(GETOPT_LONG_LIBS)
82 # Command line flags end
83 #########################################################################
85 # Checks for programs.
87 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
90 AC_PATH_PROGS(AWK, nawk gawk mawk awk, )
91 AC_PATH_PROGS(M4, gm4 m4, m4)
93 ##############################################################3
97 AC_MSG_CHECKING([For a working C99 __func__])
98 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
99 [[const char *foo = __func__;]])],
100 [ac_cv_cpp_func=yes],
101 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
102 [[const char *foo = __FUNCTION__;]])],
103 [ac_cv_cpp_func=__FUNCTION__],
104 [ac_cv_cpp_func="\"no\""])]
107 if test "X$ac_cv_cpp_func" = "X__FUNCTION__"; then
108 AC_MSG_RESULT([__FUNCTION__])
109 elif test "x$ac_cv_cpp_func" = "xyes" ; then
110 AC_MSG_RESULT([__func__])
114 if test "X$ac_cv_cpp_func" != "Xyes" ; then
115 AC_DEFINE_UNQUOTED([__func__], [$ac_cv_cpp_func], [Define to be a __func__ replacement])
119 ##############################################################3
121 #########################################################################
123 # Misc win32 / mingw checks and variables start
126 # Figure out if we are building on win32 and what environment.
128 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
131 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
143 # Misc win32 / mingw checks and variables end
144 #########################################################################
146 ############################################################################
147 # Check for mics things start
149 # Checking for rint in math library
150 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
152 # Checking for dynamic lib
153 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
155 # Check for mics things start
156 ############################################################################
158 ############################################################################
159 # Check for gtk+ 2.4 start
162 # Check for pkg-config
163 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
164 if test $PKG_CONFIG = no; then
165 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
168 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
170 # This next bit of code figures out what gtk we need to use.
171 if test "$GTK24" = "yes"
174 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
175 GTK_CFLAGS=$GTK24_CFLAGS
177 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
180 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
181 if test "$GLIB24" != "yes"
183 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
185 GLIB_CFLAGS=$GLIB24_CFLAGS
186 GLIB_LIBS=$GLIB24_LIBS
187 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
193 if test "$GTK_VERSION" = ""
195 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
199 # Check for gtk+ 2.4 end
200 ############################################################################
202 ############################################################################
203 # Check for libgeda start
205 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $VERSION, LIBGEDA="yes",
208 if test "$LIBGEDA" = "yes"
210 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
212 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
216 # Check for libgeda end
217 ############################################################################
219 #########################################################################
220 # Checks for header files start
225 AC_CHECK_HEADERS(unistd.h string.h strings.h stdlib.h \
226 stdarg.h assert.h fcntl.h errno.h getopt.h)
228 # Checks for typedefs, structures, and compiler characteristics.
231 # Checks for library functions.
233 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
235 AC_MSG_CHECKING([for optarg in unistd.h])
237 [#include <unistd.h>],
238 [ char *string = optarg; int i = optind; ],
241 AC_MSG_RESULT($optarg_found)
243 if test $optarg_found = yes; then
244 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
248 # Checks for header files start
249 #########################################################################
251 #########################################################################
254 # ------------- dmalloc -------------------
257 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
258 AC_ARG_ENABLE([dmalloc],
259 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
261 if test "X$enable_dmalloc" != "Xno" ; then
263 AC_CHECK_HEADER(dmalloc.h,,
264 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
265 AC_CHECK_LIB(dmalloc,main,,
266 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
267 DMALLOC_LIBS="-ldmalloc"
279 # ------------- ElectricFence -------------------
280 dnl ElectricFence checks
282 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
283 AC_ARG_ENABLE([efence],
284 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
286 if test "X$enable_efence" != "Xno" ; then
288 AC_CHECK_LIB(efence,main,,
289 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
300 #########################################################################
301 #########################################################################
302 # Check for groff start
306 AC_PATH_PROG(GROFF, groff, no, ${PATH})
307 if test $GROFF = "no"; then
308 echo "Cannot find groff, some documentation will not be created."
312 # Check for groff end
313 #########################################################################
315 #########################################################################
316 # gEDA/gaf specify setup start
320 GEDADATADIR=$datadir/$DATADIR
322 if eval "test x$opt_rcdir = x"; then
323 # path not was specified with --with-rcdir
324 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
325 GEDARCDIR=$GEDADATADIR
327 # path WAS specified with --with-rcdir
328 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
329 GEDARCDIR="$opt_rcdir"
332 # Expand the prefix variable
333 # I don't like the way this is done, but it works (I hope).
334 if eval "test x$prefix = xNONE"; then
335 dprefix=$ac_default_prefix
340 gedatopdir=$dprefix/share/$DATADIR
341 expandgedadatadir=`echo $gedatopdir`
343 gedadocdir=$dprefix/share/doc/geda-doc
344 # --with-docdir : tells where to store documentation if not default
346 [ --with-docdir Where to store documentation if not default.],
348 expandgedadocdir=`echo $gedadocdir`
349 GEDADOCDIR=$expandgedadocdir
352 # this has to be expanded ( no ${prefix} ) --
353 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
354 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Currently running version of gEDA/gaf])
357 # gEDA/gaf specify things which need to setup
358 #########################################################################
360 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
361 GNETLIST_CFLAGS="$LIBGEDA_CFLAGS"
362 GNETLIST_LDFLAGS="$LIBGEDA_LIBS $DMALLOC_LIBS"
364 # Makefile.in variable substitution
365 AC_SUBST(GNETLIST_CFLAGS)
366 AC_SUBST(GNETLIST_LDFLAGS)
368 AC_SUBST(GEDADATADIR)
370 AC_SUBST(OTHERPATHSEP)
372 # Create all the necessary derived files
373 AC_CONFIG_FILES([Makefile
379 tests/hierarchy/Makefile
383 examples/vams/Makefile
384 examples/vams/sch/Makefile
385 examples/vams/sym/Makefile
386 examples/vams/vhdl/Makefile
387 examples/vams/vhdl/basic-vhdl/Makefile
388 examples/vams/vhdl/new-vhdl/Makefile
389 examples/switcap/Makefile
394 lib/system-gnetlistrc ])
395 AC_CONFIG_COMMANDS([sw2asc-chmod],[[chmod +x scripts/sw2asc]],[[]])
399 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
400 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
401 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
402 expandedPCBM4DIR=`eval "echo $PCBM4DIR"`
405 ** Configuration summary for $PACKAGE $VERSION:
407 GTK+ library version: $GTK_VERSION
408 libgeda library version: $LIBGEDA_VERSION
410 data directory: $expandedGEDADATADIR
411 rc directory: $expandedGEDARCDIR
412 documentation directory: $expandedGEDADOCDIR
413 default PCB m4 directory: $expandedPCBM4DIR
414 dmalloc debugging: $with_dmalloc
415 Electric Fence debugging: $with_efence