1 # Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([noweb/gschem.nw])
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 # --disable-stroke : turn off stroke support
23 [ --disable-stroke Disable stroke support (don't use LibStroke at all)], [ if test $enableval = "no"; then
27 # --disable-gdgeda : turn off libgdgeda support
29 [ --disable-gdgeda Disable libgdgeda support (don't use libgdgeda at all)], [ if test $enableval = "no"; then
33 # Change default location for rc files
34 AC_ARG_WITH(rcdir, [ --with-rcdir=path Change where the system-*rc files are installed], [opt_rcdir=$withval])
36 # Allow the user to specify where there libstroke library lives
37 AC_ARG_WITH(stroke, [ --with-stroke=DIR Tell configure where to find libstroke], [opt_stroke=$withval])
40 # Command line flags end
41 #########################################################################
43 #########################################################################
45 # Misc win32 / mingw checks and variables start
48 # Figure out if we are building on win32 and what environment.
50 *cygwin* ) AC_MSG_ERROR([Building gEDA/gaf under cygwin is not supported]) ;;
51 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
54 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
66 # Misc win32 / mingw checks and variables end
67 #########################################################################
69 # Checks for programs.
71 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
75 ############################################################################
76 # Check for guile start
77 # Do a very basic guile test, as the bulk of the flags will come from
82 # Manually search for guile-config. This is provided by GUILE_PROGS, but
83 # guile-1.4 does not have GUILE_PROGS, so we have to do it manually.
84 AC_PATH_PROG(GUILE_CONFIG,guile-config)
85 if test "$GUILE_CONFIG" = "" ; then
86 AC_MSG_ERROR([guile-config required but not found])
88 AC_SUBST(GUILE_CONFIG)
90 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
94 ############################################################################
96 ############################################################################
97 # Check for mics things start
99 # Checking for rint in math library
100 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
102 # Checking for dynamic lib
103 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
105 # Check for mics things start
106 ############################################################################
108 ############################################################################
109 # Check for X11 start
112 if test "$MINGW" = "no"
117 X_EXTRA_LIBS="$X_EXTRA_LIBS"
118 X_LDFLAGS="$X_LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11 -lm"
121 AC_MSG_CHECKING([if hardcoding of the X11 runtime library path is desired])
122 AC_ARG_ENABLE([rpath],
123 [ --enable-rpath Enable hardcoding the X11 runtime library path [default=disabled]],
125 if test "X$enable_rpath" = "Xno" ; then
138 if test "X$_use_rpath" = "Xyes" ; then
139 # Try to figure out if we need -Rpath for finding X11 libs
140 # at runtime. Why autoconf doesn't already do this, I don't
143 for p in $X_LDFLAGS ; do
146 xlib_path="$xlib_path $p"
152 LIBS="$LIBS $X_LDFLAGS"
154 for fl in "-Wl,-rpath " "-Wl,--rpath " "-rpath " "--rpath " "-Wl,-R" "-R" "-R " ; do
155 xlib_rpath=`echo $xlib_path | sed "s/-L/$fl/g"`
156 LIBS="$_save_LIBS $X_LIBS $xlib_rpath"
157 AC_MSG_CHECKING([if the compiler accepts ${fl}path for runtime libraries])
158 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
162 test -n "$rpath" && break
164 if test -n "$rpath"; then
165 X_LDFLAGS="$X_LDFLAGS $xlib_rpath"
174 ############################################################################
176 ############################################################################
177 # Check for gtk+ 2.2 start
180 # Check for pkg-config
181 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
182 if test $PKG_CONFIG = no; then
183 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
186 PKG_CHECK_MODULES(GTK22, gtk+-2.0 >= 2.2.0, GTK22="yes", no_GTK22="yes")
188 # This next bit of code figures out what gtk we need to use.
189 if test "$GTK22" = "yes"
192 AC_DEFINE(HAS_GTK22, 1, [If gtk+ 2.2.x has been installed, define this])
193 GTK_CFLAGS=$GTK22_CFLAGS
195 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
198 PKG_CHECK_MODULES(GLIB22, glib-2.0 >= 2.2.0, GLIB22="yes", no_GLIB22="yes")
199 if test "$GLIB22" != "yes"
201 AC_MSG_ERROR([Cannot find glib 2.2.x, install it and rerun ./configure.])
203 GLIB_CFLAGS=$GLIB22_CFLAGS
204 GLIB_LIBS=$GLIB22_LIBS
205 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
211 if test "$GTK_VERSION" = ""
213 AC_MSG_ERROR([Cannot find gtk+ 2.2.x or later, please install gtk+.])
217 # Check for gtk+ 2.2 end
218 ############################################################################
220 ############################################################################
221 # Check for libgeda start
223 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $VERSION, LIBGEDA="yes",
226 if test "$LIBGEDA" = "yes"
228 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
230 AC_MSG_ERROR([Cannot find libgeda (or libgeda.pc), please install libgeda])
234 # Check for libgeda end
235 ############################################################################
237 ############################################################################
238 # Check for libgdgeda start
239 # Do some very simple tests, as we just need to know if libgeda was
240 # built with libgdgeda support.
243 haslibgdgeda=`echo $LIBGEDA_LIBS | grep gdgeda`
244 if test "$haslibgdgeda" != ""; then
245 # Check disable-gdgeda command line flag value
246 if test "$no_gdgeda" = "yes"; then
247 echo found libgdgeda, but disabling gdgeda support
250 AC_DEFINE(HAS_LIBGDGEDA, 1, [Define if you have libgdgeda installed])
258 # Check for libgdgeda end
259 ############################################################################
262 ############################################################################
263 # Check for libstroke start
266 # user specified --with-stroke
267 if eval "test x$opt_stroke != x"; then
268 LIBSTROKE_LIBS="-L$opt_stroke/lib"
269 LIBSTROKE_CFLAGS="-I$opt_stroke/include"
272 # only check if the user has not disable strokes
273 if test "$no_stroke" != "yes"; then
274 save_cppflags="$CPPFLAGS"
275 save_ldflags="$LDFLAGS"
276 CPPFLAGS="$CPPFLAGS $LIBSTROKE_CFLAGS"
277 LDFLAGS="$LDFLAGS $LIBSTROKE_LIBS"
278 AC_CHECK_LIB(stroke, stroke_init, LIBSTROKE="yes", LIBSTROKE="no")
279 CPPFLAGS="$save_cppflags"
280 LDFLAGS="$save_ldflags"
283 if test "$LIBSTROKE" = "yes"; then
284 AC_DEFINE(HAS_LIBSTROKE, 1, [Define if you have libstroke installed])
285 if eval "test x$opt_stroke = x"; then
286 LIBSTROKE_LIBS="-lstroke"
289 LIBSTROKE_LIBS="$LIBSTROKE_LIBS -lstroke"
290 # LIBSTROKE_CFLAGS set above
294 if test "$no_stroke" = "yes"; then
296 echo "** Disabling libstroke by request **"
304 # Check for libstroke end
305 ############################################################################
307 ############################################################################
308 # Check for notangle, noweave, texi2html, indent start
311 # Tangling is required if there is no C source files in the src/
312 # directory. Therefore they need to be extracted from the documented
313 # sources in noweb/ either with notangle or notangle_guile.
315 # notangle is the utility that comes with the noweb package.
316 # notangle_guile is a script that act the same as notangle
317 # but only require a guile interpreter with built-in module regex
320 # search for notangle
321 AC_PATH_PROG(NOTANGLE, notangle, no, ${PATH})
322 cfiles=`\ls -1 src/libgeda.c 2> /dev/null`
325 if test "$NOTANGLE" = "no" -a "$exit_status" = "1"; then
327 # notangle not found, and no C sources in src
328 # need notangle_guile
329 echo "** Cannot find notangle (part of noweb) : using notangle_guile instead **"
331 # find the guile interpreter
332 AC_PATH_PROG(GUILEINTERP, guile, no, ${PATH})
333 if test "$GUILEINTERP" = "no"; then
334 AC_MSG_ERROR([guile interpreter is required])
337 # check (ice-9 getopt-long) module in guile
338 AC_MSG_CHECKING([for getopt-long module in guile])
339 guilegetopt=`$GUILEINTERP -c '(use-modules (ice-9 getopt-long))' 2> /dev/null`
341 if test "$exit_status" = "1"; then
343 echo "no support for getopt-long module in guile interpreter"
344 AC_MSG_ERROR([this module is required by notangle_guile but is not available in the interpreter])
348 # check (ice-9 regex) module in guile
349 AC_MSG_CHECKING([for regex module in guile])
350 guileregex=`$GUILEINTERP -c '(use-modules (ice-9 regex))' 2> /dev/null`
352 if test ! "$exit_status" = "0"; then
354 echo "no support for regex module in guile interpreter"
355 AC_MSG_ERROR([this module is required by notangle_guile but is not available in the interpreter])
359 # set NOTANGLE and NOTANGLEROOT to use notangle_guile
360 # as the result of the previous tests
361 # - NOTANGLE is the relative pathname to script from the source dir
362 # - NOTANGLEROOT is the option to give the root code chunk name
363 # - NOTANGLEFLAGS are other flags to notangle_guile
364 NOTANGLE="../scripts/notangle_guile"
365 NOTANGLEROOT="--rootname="
368 echo "-- notangle_guile should work fine on this system --"
372 # NOTANGLE has been set by AC_PATH_PROG above
378 # Weaving is extracting the documentation from the noweb files.
379 # The noweb package provides noweave to weave these files.
381 # The documentation is here written in Texinfo. A backend is
382 # provided in scripts to format the code chunks in Texinfo.
384 # The noweave program is therefore required to produce the
385 # documentation but building documentation is optionnal.
389 AC_PATH_PROG(NOWEAVE, noweave, no, ${PATH})
391 # the noweb texinfo backend is based on awk. If awk is not available,
392 # the backend will not work, and therefore it disables the
393 # documentation creation.
396 if test "$NOWEAVE" = "no" -o "$AWK" = "no"; then
397 # noweave is not available on the system
398 echo "** Cannot find noweave (part of noweb)! **"
399 echo "** Documentation creation disabled **"
402 # prevent from weaving the nw files
403 # but does not prevent from processing gschemdoc
406 # noweave is available on the system.
407 # now checking if the tools for Texinfo files processing
409 # The docs can be either processed to produce dvi, html or info
410 # with texi2dvi, texi2html or makeinfo respectively
411 # Note : these tests on makeinfo and texi2dvi are no more
412 # needed as automake makes them for us
414 # enable the weaving of the nw files to get documentation
418 # depending on variable builddoc, weaving is performed or not
419 # using conditionnal in docs/Makefile.in
420 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
422 # search for texi2html
423 # it looks like automake does not take care of html doc creation
424 AC_PATH_PROG(TEXI2HTML, texi2html, no, ${PATH})
426 if test "$TEXI2HTML" = "no"; then
427 echo "** Cannot find texi2html **"
428 echo "** HTML file creation disabled **"
433 AC_PATH_PROG(INDENT, indent, no, ${PATH})
435 if ! test "$INDENT" = "no"; then
436 indentversion=`$INDENT --version | grep GNU`
441 if test "$INDENT" = "no" -o "$indentversion"x = x; then
442 AC_PATH_PROG(GINDENT, gindent, no, ${PATH})
443 if test "$GINDENT" = "no"; then
444 echo "** Cannot find GNU indent or gindent, C code formatting disabled **"
452 # Check for notangle, noweave, texi2html, indent end
453 #########################################################################
455 #########################################################################
456 # Check for groff start
460 AC_PATH_PROG(GROFF, groff, no, ${PATH})
461 if test $GROFF = "no"; then
462 echo "Cannot find groff, some documentation will not be created."
466 # Check for groff end
467 #########################################################################
469 #########################################################################
470 # Checks for header files start
475 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
476 stdarg.h assert.h fcntl.h errno.h sys/param.h)
478 # Checks for typedefs, structures, and compiler characteristics.
481 # Checks for library functions.
483 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
485 AC_MSG_CHECKING([for optarg in unistd.h])
487 [#include <unistd.h>],
488 [ char *string = optarg; int i = optind; ],
491 AC_MSG_RESULT($optarg_found)
493 if test $optarg_found = yes; then
494 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
498 # Checks for header files end
499 #########################################################################
501 #########################################################################
504 # ------------- dmalloc -------------------
507 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
508 AC_ARG_ENABLE([dmalloc],
509 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
511 if test "X$enable_dmalloc" != "Xno" ; then
513 AC_CHECK_HEADER(dmalloc.h,,
514 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
515 AC_CHECK_LIB(dmalloc,main,,
516 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
517 DMALLOC_LIBS="-ldmalloc"
529 # ------------- ElectricFence -------------------
530 dnl ElectricFence checks
532 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
533 AC_ARG_ENABLE([efence],
534 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
536 if test "X$enable_efence" != "Xno" ; then
538 AC_CHECK_LIB(efence,main,,
539 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
550 #########################################################################
551 #########################################################################
552 # gEDA/gaf specific setup start
556 GEDADATADIR=$datadir/$DATADIR
558 if eval "test x$opt_rcdir = x"; then
559 # path was not specified with --with-rcdir
560 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
561 GEDARCDIR=$GEDADATADIR
563 # path WAS specified with --with-rcdir
564 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
565 GEDARCDIR="$opt_rcdir"
568 # Expand the prefix variable
569 # I don't like the way this is done, but it works (I hope).
570 if eval "test x$prefix = xNONE"; then
571 dprefix=$ac_default_prefix
576 gedatopdir=$dprefix/share/$DATADIR
577 expandgedadatadir=`echo $gedatopdir`
579 gedadocdir=$dprefix/share/doc/geda-doc
580 # --with-docdir : tells where to store documentation if not default
582 [ --with-docdir Where to store documentation if not default.],
584 expandgedadocdir=`echo $gedadocdir`
585 GEDADOCDIR=$expandgedadocdir
588 # this has to be expanded ( no ${prefix} ) --
589 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
590 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Currently running version of gEDA/gaf])
593 # gEDA/gaf specify things which need to setup
594 #########################################################################
596 # Initialized gettext
598 AM_GNU_GETTEXT_VERSION(0.12.1)
600 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
601 GSCHEM_CFLAGS="$LIBSTROKE_CFLAGS $LIBGEDA_CFLAGS"
602 GSCHEM_LDFLAGS="$LIBSTROKE_LIBS $LIBGEDA_LIBS $GTK_LIBS $X_LDFLAGS $DMALLOC_LIBS"
604 # Makefile.in variable substitution
605 AC_SUBST(GSCHEM_CFLAGS)
606 AC_SUBST(GSCHEM_LDFLAGS)
607 AC_SUBST(GEDADATADIR)
610 AC_SUBST(OTHERPATHSEP)
612 AC_SUBST(NOTANGLEROOT)
613 AC_SUBST(NOTANGLEFLAGS)
614 AC_SUBST(GUILEINTERP)
619 # Create all the necessary derived files
620 AC_CONFIG_FILES([Makefile
636 scripts/notangle_guile ])
638 AC_CONFIG_COMMANDS([geda_totexi-chmod],[[chmod +x scripts/geda_totexi]],[[]])
639 AC_CONFIG_COMMANDS([notangle_guile-chmod],[[chmod +x scripts/notangle_guile]],[[]])
643 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
644 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
645 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
648 ** Configuration summary for $PACKAGE $VERSION:
650 GTK+ library version: $GTK_VERSION
651 GUILE library version: $GUILE_VERSION
652 libgeda library version: $LIBGEDA_VERSION
653 libstroke library: $LIBSTROKE
654 libdgeda library: $LIBGDGEDA
656 data directory: $expandedGEDADATADIR
657 rc directory: $expandedGEDARCDIR
658 documentation directory: $expandedGEDADOCDIR
659 dmalloc debugging: $with_dmalloc
660 ElectricFence debugging: $with_efence