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 # Force a specific version of gtk+
37 AC_ARG_WITH(gtk12, [ --with-gtk12 Force the use of gtk+ 1.2.x], [opt_gtkver=1.2])
39 # Allow the user to specify where there libstroke library lives
40 AC_ARG_WITH(stroke, [ --with-stroke=DIR Tell configure where to find libstroke], [opt_stroke=$withval])
43 # Command line flags end
44 #########################################################################
46 #########################################################################
48 # Misc win32 / mingw checks and variables start
51 # Figure out if we are building on win32 and what environment.
53 *cygwin* ) AC_MSG_ERROR([Building gEDA/gaf under cygwin is not supported]) ;;
54 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
57 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
69 # Misc win32 / mingw checks and variables end
70 #########################################################################
72 # Checks for programs.
77 ############################################################################
78 # Check for guile start
79 # Do a very basic guile test, as the bulk of the flags will come from
84 # Manually search for guile-config. This is provided by GUILE_PROGS, but
85 # guile-1.4 does not have GUILE_PROGS, so we have to do it manually.
86 AC_PATH_PROG(GUILE_CONFIG,guile-config)
87 if test "$GUILE_CONFIG" = "" ; then
88 AC_MSG_ERROR([guile-config required but not found])
90 AC_SUBST(GUILE_CONFIG)
92 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
96 ############################################################################
98 ############################################################################
99 # Check for mics things start
101 # Checking for rint in math library
102 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
104 # Checking for dynamic lib
105 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
107 # Check for mics things start
108 ############################################################################
110 ############################################################################
111 # Check for X11 start
114 if test "$MINGW" = "no"
119 X_EXTRA_LIBS="$X_EXTRA_LIBS"
120 X_LDFLAGS="$X_LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11 -lm"
125 ############################################################################
127 ############################################################################
128 # Check for gtk+ 1.2 and 2.2 start
131 # Check for pkg-config
132 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
133 if test $PKG_CONFIG = no; then
134 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
137 # Search for gtk+ 2.2.x first (only if we are not forcing the gtk+ to 1.2)
138 if test "$opt_gtkver" != "1.2"
140 PKG_CHECK_MODULES(GTK22, gtk+-2.0 >= 2.2.0, GTK22="yes", no_GTK22="yes")
143 # This next bit of code figures out what gtk we need to use.
144 if test "$GTK22" = "yes" -a "$opt_gtkver" != "1.2"
147 AC_DEFINE(HAS_GTK22, 1, [If gtk+ 2.2.x has been installed, define this])
148 GTK_CFLAGS=$GTK22_CFLAGS
150 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
153 PKG_CHECK_MODULES(GLIB22, glib-2.0 >= 2.2.0, GLIB22="yes", no_GLIB22="yes")
154 if test "$GLIB22" != "yes"
156 AC_MSG_ERROR([Cannot find glib 2.2.x, install it and rerun ./configure.])
158 GLIB_CFLAGS=$GLIB22_CFLAGS
159 GLIB_LIBS=$GLIB22_LIBS
160 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
164 # Search for gtk+ 1.2 now
165 PKG_CHECK_MODULES(GTK12, gtk+ >= 1.2.3, GTK12="yes", no_GTK12="yes")
167 AC_DEFINE(HAS_GTK12, 1, [If gtk+ 1.2.x has been installed, define this])
168 GTK_CFLAGS=$GTK12_CFLAGS
170 GTK_VERSION=`$PKG_CONFIG gtk+ --modversion`
173 PKG_CHECK_MODULES(GLIB12, glib >= 1.2.3, GLIB12="yes", no_GLIB12="yes")
174 if test "$GLIB12" != "yes"
176 AC_MSG_ERROR([Cannot find glib >= 1.2.3, install it and rerun ./configure.])
178 GLIB_CFLAGS=$GLIB12_CFLAGS
179 GLIB_LIBS=$GLIB12_LIBS
180 GLIB_VERSION=`$PKG_CONFIG glib --modversion`
183 if test "$GTK_VERSION" = ""
185 AC_MSG_ERROR([Cannot find gtk+ 2.2.x or gtk+ 1.2.x, install one of them.])
189 # Check for gtk+ 1.2 and 2.2 end
190 ############################################################################
192 ############################################################################
193 # Check for libgeda start
195 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $VERSION, LIBGEDA="yes",
198 if test "$LIBGEDA" = "yes"
200 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
202 AC_MSG_ERROR([Cannot find libgeda (or libgeda.pc), please install libgeda])
206 # Check for libgeda end
207 ############################################################################
209 ############################################################################
210 # Check for libgdgeda start
211 # Do some very simple tests, as we just need to know if libgeda was
212 # built with libgdgeda support.
215 haslibgdgeda=`echo $LIBGEDA_LIBS | grep gdgeda`
216 if test "$haslibgdgeda" != ""; then
217 # Check disable-gdgeda command line flag value
218 if test "$no_gdgeda" = "yes"; then
219 echo found libgdgeda, but disabling gdgeda support
222 AC_DEFINE(HAS_LIBGDGEDA, 1, [Define if you have libgdgeda installed])
230 # Check for libgdgeda end
231 ############################################################################
234 ############################################################################
235 # Check for libstroke start
238 # user specified --with-stroke
239 if eval "test x$opt_stroke != x"; then
240 LIBSTROKE_LIBS="-L$opt_stroke/lib"
241 LIBSTROKE_CFLAGS="-I$opt_stroke/include"
244 # only check if the user has not disable strokes
245 if test "$no_stroke" != "yes"; then
246 save_cppflags="$CPPFLAGS"
247 save_ldflags="$LDFLAGS"
248 CPPFLAGS="$CPPFLAGS $LIBSTROKE_CFLAGS"
249 LDFLAGS="$LDFLAGS $LIBSTROKE_LIBS"
250 AC_CHECK_LIB(stroke, stroke_init, LIBSTROKE="yes", LIBSTROKE="no")
251 CPPFLAGS="$save_cppflags"
252 LDFLAGS="$save_ldflags"
255 if test "$LIBSTROKE" = "yes"; then
256 AC_DEFINE(HAS_LIBSTROKE, 1, [Define if you have libstroke installed])
257 if eval "test x$opt_stroke = x"; then
258 LIBSTROKE_LIBS="-lstroke"
261 LIBSTROKE_LIBS="$LIBSTROKE_LIBS -lstroke"
262 # LIBSTROKE_CFLAGS set above
266 if test "$no_stroke" = "yes"; then
268 echo "** Disabling libstroke by request **"
276 # Check for libstroke end
277 ############################################################################
279 ############################################################################
280 # Check for notangle, noweave, texi2html, indent start
283 # Tangling is required if there is no C source files in the src/
284 # directory. Therefore they need to be extracted from the documented
285 # sources in noweb/ either with notangle or notangle_guile.scm.
287 # notangle is the utility that comes with the noweb package.
288 # notangle_guile.scm is a script that act the same as notangle
289 # but only require a guile interpreter with built-in module regex
292 # search for notangle
293 AC_PATH_PROG(NOTANGLE, notangle, no, ${PATH})
294 cfiles=`\ls -1 src/libgeda.c 2> /dev/null`
297 if test "$NOTANGLE" = "no" -a "$exit_status" = "1"; then
299 # notangle not found, and no C sources in src
300 # need notangle_guile.scm
301 echo "** Cannot find notangle (part of noweb) : using notangle_guile.scm instead **"
303 # find the guile interpreter
304 AC_PATH_PROG(GUILEINTERP, guile, no, ${PATH})
305 if test "$GUILEINTERP" = "no"; then
306 AC_MSG_ERROR([guile interpreter is required])
309 # check (ice-9 getopt-long) module in guile
310 AC_MSG_CHECKING([for getopt-long module in guile])
311 guilegetopt=`$GUILEINTERP -c '(use-modules (ice-9 getopt-long))' 2> /dev/null`
313 if test "$exit_status" = "1"; then
315 echo "no support for getopt-long module in guile interpreter"
316 AC_MSG_ERROR([this module is required by notangle_guile.scm but is not available in the interpreter])
320 # check (ice-9 regex) module in guile
321 AC_MSG_CHECKING([for regex module in guile])
322 guileregex=`$GUILEINTERP -c '(use-modules (ice-9 regex))' 2> /dev/null`
324 if test ! "$exit_status" = "0"; then
326 echo "no support for regex module in guile interpreter"
327 AC_MSG_ERROR([this module is required by notangle_guile.scm but is not available in the interpreter])
331 # set NOTANGLE and NOTANGLEROOT to use notangle_guile.scm
332 # as the result of the previous tests
333 # - NOTANGLE is the relative pathname to script from the source dir
334 # - NOTANGLEROOT is the option to give the root code chunk name
335 # - NOTANGLEFLAGS are other flags to notangle_guile.scm
336 NOTANGLE="../scripts/notangle_guile.scm"
337 NOTANGLEROOT="--rootname="
340 echo "-- notangle_guile.scm should work fine on this system --"
344 # NOTANGLE has been set by AC_PATH_PROG above
350 # Weaving is extracting the documentation from the noweb files.
351 # The noweb package provides noweave to weave these files.
353 # The documentation is here written in Texinfo. A backend is
354 # provided in scripts to format the code chunks in Texinfo.
356 # The noweave program is therefore required to produce the
357 # documentation but building documentation is optionnal.
361 AC_PATH_PROG(NOWEAVE, noweave, no, ${PATH})
363 # the noweb texinfo backend is based on awk. If awk is not available,
364 # the backend will not work, and therefore it disables the
365 # documentation creation.
368 if test "$NOWEAVE" = "no" -o "$AWK" = "no"; then
369 # noweave is not available on the system
370 echo "** Cannot find noweave (part of noweb)! **"
371 echo "** Documentation creation disabled **"
374 # prevent from weaving the nw files
375 # but does not prevent from processing gschemdoc
378 # noweave is available on the system.
379 # now checking if the tools for Texinfo files processing
381 # The docs can be either processed to produce dvi, html or info
382 # with texi2dvi, texi2html or makeinfo respectively
383 # Note : these tests on makeinfo and texi2dvi are no more
384 # needed as automake makes them for us
386 # enable the weaving of the nw files to get documentation
390 # depending on variable builddoc, weaving is performed or not
391 # using conditionnal in docs/Makefile.in
392 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
394 # search for texi2html
395 # it looks like automake does not take care of html doc creation
396 AC_PATH_PROG(TEXI2HTML, texi2html, no, ${PATH})
398 if test "$TEXI2HTML" = "no"; then
399 echo "** Cannot find texi2html **"
400 echo "** HTML file creation disabled **"
405 AC_PATH_PROG(INDENT, indent, no, ${PATH})
407 if ! test "$INDENT" = "no"; then
408 indentversion=`$INDENT --version | grep GNU`
413 if test "$INDENT" = "no" -o "$indentversion"x = x; then
414 AC_PATH_PROG(GINDENT, gindent, no, ${PATH})
415 if test "$GINDENT" = "no"; then
416 echo "** Cannot find GNU indent or gindent, C code formatting disabled **"
424 # Check for notangle, noweave, texi2html, indent end
425 #########################################################################
427 #########################################################################
428 # Check for groff start
432 AC_PATH_PROG(GROFF, groff, no, ${PATH})
433 if test $GROFF = "no"; then
434 echo "Cannot find groff, some documentation will not be created."
438 # Check for groff end
439 #########################################################################
441 #########################################################################
442 # Checks for header files start
447 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
448 stdarg.h assert.h fcntl.h errno.h sys/param.h)
450 # Checks for typedefs, structures, and compiler characteristics.
453 # Checks for library functions.
455 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
457 AC_MSG_CHECKING([for optarg in unistd.h])
459 [#include <unistd.h>],
460 [ char *string = optarg; int i = optind; ],
463 AC_MSG_RESULT($optarg_found)
465 if test $optarg_found = yes; then
466 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
470 # Checks for header files end
471 #########################################################################
473 #########################################################################
474 # gEDA/gaf specific setup start
478 GEDADATADIR=$datadir/$DATADIR
480 if eval "test x$opt_rcdir = x"; then
481 # path was not specified with --with-rcdir
482 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
483 GEDARCDIR=$GEDADATADIR
485 # path WAS specified with --with-rcdir
486 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
487 GEDARCDIR="$opt_rcdir"
490 # Expand the prefix variable
491 # I don't like the way this is done, but it works (I hope).
492 if eval "test x$prefix = xNONE"; then
493 dprefix=$ac_default_prefix
498 gedatopdir=$dprefix/share/$DATADIR
499 expandgedadatadir=`echo $gedatopdir`
501 gedadocdir=$dprefix/share/doc/geda-doc
502 # --with-docdir : tells where to store documentation if not default
504 [ --with-docdir Where to store documentation if not default.],
506 expandgedadocdir=`echo $gedadocdir`
507 GEDADOCDIR=$expandgedadocdir
510 # this has to be expanded ( no ${prefix} ) --
511 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
512 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Currently running version of gEDA/gaf])
515 # gEDA/gaf specify things which need to setup
516 #########################################################################
518 # Initialized gettext
520 AM_GNU_GETTEXT_VERSION(0.12.1)
522 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
523 GSCHEM_CFLAGS="$LIBSTROKE_CFLAGS $LIBGEDA_CFLAGS"
524 GSCHEM_LDFLAGS="$LIBSTROKE_LIBS $LIBGEDA_LIBS $GTK_LIBS $X_LDFLAGS"
526 # Makefile.in variable substitution
527 AC_SUBST(GSCHEM_CFLAGS)
528 AC_SUBST(GSCHEM_LDFLAGS)
529 AC_SUBST(GEDADATADIR)
532 AC_SUBST(OTHERPATHSEP)
534 AC_SUBST(NOTANGLEROOT)
535 AC_SUBST(NOTANGLEFLAGS)
536 AC_SUBST(GUILEINTERP)
541 # Create all the necessary derived files
542 AC_CONFIG_FILES([Makefile
558 scripts/notangle_guile.scm ])
560 AC_CONFIG_COMMANDS([geda_totexi-chmod],[[chmod +x scripts/geda_totexi]],[[]])
561 AC_CONFIG_COMMANDS([notangle_guile.scm-chmod],[[chmod +x scripts/notangle_guile.scm]],[[]])
565 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
566 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
567 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
570 ** Configuration summary for $PACKAGE $VERSION:
572 GTK+ library version: $GTK_VERSION
573 GUILE library version: $GUILE_VERSION
574 libgeda library version: $LIBGEDA_VERSION
575 libstroke library: $LIBSTROKE
576 libdgeda library: $LIBGDGEDA
578 data directory: $expandedGEDADATADIR
579 rc directory: $expandedGEDARCDIR
580 documentation directory: $expandedGEDADOCDIR