1 # Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([include/libgeda.h])
8 SHARED_LIBRARY_VERSION=24:0:0
9 echo Configuring $PACKAGE version $VERSION
12 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
13 AM_CONFIG_HEADER([config.h])
18 # Init maintainer mode
21 #########################################################################
22 # Command line flags start
24 # --disable-gdgeda : turn off libgdgeda support
25 AC_ARG_ENABLE(gdgeda, [ --disable-gdgeda Disable libgdgeda support (don't use libgdgeda at all)],
26 [ if test $enableval = "no"; then no_gdgeda=yes; fi ])
28 # Change default location for rc files
29 AC_ARG_WITH(rcdir, [ --with-rcdir=path Change where the system-*rc files are installed], [opt_rcdir=$withval])
32 # Command line flags end
33 #########################################################################
35 # Checks for libraries.
36 #########################################################################
38 # Misc win32 / mingw checks and variables start
40 # Figure out if we are building on win32 and what environment.
42 *cygwin* ) AC_MSG_ERROR([Building gEDA/gaf under cygwin is not supported]) ;;
43 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
46 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
47 MINGW_CFLAGS="-mms-bitfields -mwindows"
48 MINGW_LIBS="-lregex -liberty"
62 # Misc win32 / mingw checks and variables end
63 #########################################################################
65 # Checks for programs.
67 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
71 ############################################################################
72 # Check for guile start
76 # Manually search for guile-config. This is provided by GUILE_PROGS, but
77 # guile-1.4 does not have GUILE_PROGS, so we have to do it manually.
78 AC_PATH_PROG(GUILE_CONFIG,guile-config)
79 if test "$GUILE_CONFIG" = "" ; then
80 AC_MSG_ERROR([guile-config required but not found])
82 AC_SUBST(GUILE_CONFIG)
84 # must have guile flags in CFLAGS for AC_COMPILE_IFELSE to work right
85 saved_CFLAGS="${CFLAGS}"
86 CFLAGS="${CFLAGS} ${GUILE_CFLAGS}"
88 # 1-argument scm_eval_x (guile-1.4) or 2-argument form (guile-1.6)?
90 [if scm_eval_x() takes a second module argument])
91 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libguile.h>]],
92 [[SCM foo,bar; scm_eval_x(foo,bar);]])],
93 [AC_DEFINE([HAVE_SCM_EVAL_X_MODULE], 1,
94 [Define if the SCM_EVAL_X function takes a second argument "module"])
95 AC_MSG_RESULT(yes) ], [AC_MSG_RESULT(no)])
96 CFLAGS="${saved_CFLAGS}"
98 # Check that scm_make_smob_type exist
99 AC_CHECK_LIB(guile, scm_make_smob_type,,
100 [AC_MSG_ERROR([Upgrade Guile, At least version >= 1.3.2])],
103 # Restore LIBS. Apperantly AC_CHECK_LIB destroys it.
106 # Check that scm_set_smob_mark exist
107 AC_CHECK_LIB(guile, scm_set_smob_mark,,
108 [AC_MSG_ERROR([Upgrade Guile, At least version >= 1.3.2])],
111 # Restore LIBS. Apperantly AC_CHECK_LIB destroys it.
114 # Check that scm_set_smob_free exist
115 AC_CHECK_LIB(guile, scm_set_smob_free,,
116 [AC_MSG_ERROR([Upgrade Guile, At least version >= 1.3.2])],
119 # Restore LIBS. Apperantly AC_CHECK_LIB destroys it.
122 # Check that scm_set_smob_print exist
123 AC_CHECK_LIB(guile, scm_set_smob_print,,
124 [AC_MSG_ERROR([Upgrade Guile, At least version >= 1.3.2])],
127 # Restore LIBS. Apperantly AC_CHECK_LIB destroys it.
130 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
133 # Check for guile end
134 ############################################################################
136 ############################################################################
137 # Check for mics things start
139 # Checking for rint in math library
140 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
142 # Checking for dynamic lib
143 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
145 # Check for mics things start
146 ############################################################################
148 ############################################################################
149 # Check for libgdgeda start
151 AC_PATH_PROG(LIBGDGEDACONFIG, libgdgeda-config, no, ${PATH})
153 if test "$LIBGDGEDACONFIG" = "no"
160 if test "$no_gdgeda" = "yes"
162 echo found libgdgeda, but disabling gdgeda support.
168 GDGEDA_CFLAGS=`$LIBGDGEDACONFIG --cflags`
169 GDGEDA_LIBS1=`$LIBGDGEDACONFIG --ldflags`
170 GDGEDA_LIBS2=`$LIBGDGEDACONFIG --libs`
171 GDGEDA_LIBS="$GDGEDA_LIBS1 $GDGEDA_LIBS2"
172 GDGEDA_VERSION=`$LIBGDGEDACONFIG --version`
175 # This is not really used to figure out paths, but just to make
176 # sure >= 2.0.15 is installed
177 PKG_CHECK_MODULES(libgdgeda, libgdgeda >= 2.0.15)
178 AC_DEFINE(HAS_LIBGDGEDA, 1, [If libgdgeda has been installed, define this])
183 # Check for libgdgeda end
184 ############################################################################
186 ############################################################################
187 # Check for X11 start
190 if test "$MINGW" = "no"
195 X_EXTRA_LIBS="$X_EXTRA_LIBS"
196 X_LDFLAGS="$X_LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11 -lm"
201 ############################################################################
203 ############################################################################
204 # Check for gtk+ 2.2 start
207 # Check for pkg-config
208 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
209 if test $PKG_CONFIG = no; then
210 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
213 PKG_CHECK_MODULES(GTK22, gtk+-2.0 >= 2.2.0, GTK22="yes", no_GTK22="yes")
215 # This next bit of code figures out what gtk we need to use.
216 if test "$GTK22" = "yes"
219 AC_DEFINE(HAS_GTK22, 1, [If gtk+ 2.2.x has been installed, define this])
220 GTK_CFLAGS=$GTK22_CFLAGS
222 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
225 PKG_CHECK_MODULES(GLIB22, glib-2.0 >= 2.2.0, GLIB22="yes", no_GLIB22="yes")
226 if test "$GLIB22" != "yes"
228 AC_MSG_ERROR([Cannot find glib 2.2.x, install it and rerun ./configure.])
230 GLIB_CFLAGS=$GLIB22_CFLAGS
231 GLIB_LIBS=$GLIB22_LIBS
232 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
238 if test "$GTK_VERSION" = ""
240 AC_MSG_ERROR([Cannot find gtk+ 2.2.x or later, please install gtk+.])
244 # Check for gtk+ 2.2 end
245 ############################################################################
247 ############################################################################
248 # Check for gdk 2.2 or later
251 # Check for pkg-config
252 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
253 if test $PKG_CONFIG = no; then
254 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
257 PKG_CHECK_MODULES(GDK, gdk-2.0 >= 2.2.0, GDK="yes", no_GDK="yes")
259 # This next bit of code figures out what gtk we need to use.
260 if test "$GDK" = "yes"
263 AC_DEFINE(HAS_GDK, 1, [If gdk has been installed, define this])
264 GDK_CFLAGS=$GDK_CFLAGS
266 GDK_VERSION=`$PKG_CONFIG gdk-2.0 --modversion`
270 if test "$GDK_VERSION" = ""
272 AC_MSG_ERROR([Cannot find gdk, please make sure it is installed.])
277 ############################################################################
279 ############################################################################
280 # Check for gdk-pixbuf
283 # Check for pkg-config
284 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
285 if test $PKG_CONFIG = no; then
286 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
289 PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0 >= 0.15.0, GDK_PIXBUF="yes", no_GDK_PIXBUF="yes")
291 # This next bit of code figures out what gtk we need to use.
292 if test "$GDK_PIXBUF" = "yes"
295 AC_DEFINE(HAS_GDK_PIXBUF, 1, [If gdk-pixbuf has been installed, define this])
296 GDK_PIXBUF_CFLAGS=$GDK_PIXBUF_CFLAGS
297 GDK_PIXBUF_LIBS=$GDK_PIXBUF_LIBS
298 GDK_PIXBUF_VERSION=`$PKG_CONFIG gdk-pixbuf-2.0 --modversion`
302 if test "$GDK_PIXBUF_VERSION" = ""
304 AC_MSG_ERROR([Cannot find gdk-pixbuf, please make sure it is installed.])
308 # Check for gdk-pixbuf end
309 ############################################################################
313 ############################################################################
314 # Check for notangle, noweave, texi2html, indent start
317 # Tangling is required if there is no C source files in the src/
318 # directory. Therefore they need to be extracted from the documented
319 # sources in noweb/ either with notangle or notangle_guile.
321 # notangle is the utility that comes with the noweb package.
322 # notangle_guile is a script that act the same as notangle
323 # but only require a guile interpreter with built-in module regex
326 # search for notangle
327 AC_PATH_PROG(NOTANGLE, notangle, no, ${PATH})
328 cfiles=`\ls -1 src/libgeda.c 2> /dev/null`
331 if test "$NOTANGLE" = "no" -a "$exit_status" = "1"; then
333 # notangle not found, and no C sources in src
334 # need notangle_guile
335 echo "** Cannot find notangle (part of noweb) : using notangle_guile instead **"
337 # find the guile interpreter
338 AC_PATH_PROG(GUILEINTERP, guile, no, ${PATH})
339 if test "$GUILEINTERP" = "no"; then
340 AC_MSG_ERROR([guile interpreter is required])
343 # check (ice-9 getopt-long) module in guile
344 AC_MSG_CHECKING([for getopt-long module in guile])
345 guilegetopt=`$GUILEINTERP -c '(use-modules (ice-9 getopt-long))' 2> /dev/null`
347 if test "$exit_status" = "1"; then
349 echo "no support for getopt-long module in guile interpreter"
350 AC_MSG_ERROR([this module is required by notangle_guile but is not available in the interpreter])
354 # check (ice-9 regex) module in guile
355 AC_MSG_CHECKING([for regex module in guile])
356 guileregex=`$GUILEINTERP -c '(use-modules (ice-9 regex))' 2> /dev/null`
358 if test ! "$exit_status" = "0"; then
360 echo "no support for regex module in guile interpreter"
361 AC_MSG_ERROR([this module is required by notangle_guile but is not available in the interpreter])
365 # set NOTANGLE and NOTANGLEROOT to use notangle_guile
366 # as the result of the previous tests
367 # - NOTANGLE is the relative pathname to script from the source dir
368 # - NOTANGLEROOT is the option to give the root code chunk name
369 # - NOTANGLEFLAGS are other flags to notangle_guile
370 NOTANGLE="../scripts/notangle_guile"
371 NOTANGLEROOT="--rootname="
374 echo "-- notangle_guile should work fine on this system --"
378 # NOTANGLE has been set by AC_PATH_PROG above
384 # Weaving is extracting the documentation from the noweb files.
385 # The noweb package provides noweave to weave these files.
387 # The documentation is here written in Texinfo. A backend is
388 # provided in scripts to format the code chunks in Texinfo.
390 # The noweave program is therefore required to produce the
391 # documentation but building documentation is optionnal.
395 AC_PATH_PROG(NOWEAVE, noweave, no, ${PATH})
397 # the noweb texinfo backend is based on awk. If awk is not available,
398 # the backend will not work, and therefore it disables the
399 # documentation creation.
402 if test "$NOWEAVE" = "no" -o "$AWK" = "no"; then
403 # noweave is not available on the system
404 echo "** Cannot find noweave (part of noweb)! **"
405 echo "** Documentation creation disabled **"
408 # prevent from weaving the nw files
409 # but does not prevent from processing gschemdoc
412 # noweave is available on the system.
413 # now checking if the tools for Texinfo files processing
415 # The docs can be either processed to produce dvi, html or info
416 # with texi2dvi, texi2html or makeinfo respectively
417 # Note : these tests on makeinfo and texi2dvi are no more
418 # needed as automake makes them for us
420 # enable the weaving of the nw files to get documentation
424 # depending on variable builddoc, weaving is performed or not
425 # using conditionnal in docs/Makefile.in
426 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
428 # search for texi2html
429 # it looks like automake does not take care of html doc creation
430 AC_PATH_PROG(TEXI2HTML, texi2html, no, ${PATH})
432 if test "$TEXI2HTML" = "no"; then
433 echo "** Cannot find texi2html **"
434 echo "** HTML file creation disabled **"
439 AC_PATH_PROG(INDENT, indent, no, ${PATH})
441 if ! test "$INDENT" = "no"; then
442 indentversion=`$INDENT --version | grep GNU`
447 if test "$INDENT" = "no" -o "$indentversion"x = x; then
448 AC_PATH_PROG(GINDENT, gindent, no, ${PATH})
449 if test "$GINDENT" = "no"; then
450 echo "** Cannot find GNU indent or gindent, C code formatting disabled **"
458 # Check for notangle, noweave, texi2html, indent end
459 #########################################################################
461 #########################################################################
462 # Checks for header files start
468 AC_CHECK_HEADERS(unistd.h string.h stdlib.h stdarg.h assert.h fcntl.h \
471 AC_MSG_CHECKING([for optarg in unistd.h])
473 [#include <unistd.h>],
474 [ char *string = optarg; int i = optind; ],
477 AC_MSG_RESULT($optarg_found)
478 if test $optarg_found = yes; then
479 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
482 # Checks for typedefs, structures, and compiler characteristics.
485 # Checks for library functions.
487 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
490 # Checks for header files end
491 #########################################################################
493 #########################################################################
496 # ------------- dmalloc -------------------
499 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
500 AC_ARG_ENABLE([dmalloc],
501 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
503 if test "X$enable_dmalloc" != "Xno" ; then
505 AC_CHECK_HEADER(dmalloc.h,,
506 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
507 AC_CHECK_LIB(dmalloc,main,,
508 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
509 DMALLOC_LIBS="-ldmalloc"
521 # ------------- ElectricFence -------------------
522 dnl ElectricFence checks
524 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
525 AC_ARG_ENABLE([efence],
526 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
528 if test "X$enable_efence" != "Xno" ; then
530 AC_CHECK_LIB(efence,main,,
531 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
542 #########################################################################
544 #########################################################################
545 # gEDA/gaf specific setup start
549 GEDADATADIR=$datadir/$DATADIR
551 if eval "test x$opt_rcdir = x"; then
552 # path was not specified with --with-rcdir
553 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
554 GEDARCDIR=$GEDADATADIR
556 # path WAS specified with --with-rcdir
557 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
558 GEDARCDIR="$opt_rcdir"
561 # Defs for libary symbol files
563 # Expand the prefix variable
564 if eval "test x$prefix = xNONE"; then
565 dprefix=$ac_default_prefix
570 gedatopdir=$dprefix/share/$DATADIR
571 expandgedadatadir=`echo $gedatopdir`
573 # this has to be expanded ( no ${prefix} ) --
574 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
575 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Currently running version of gEDA/gaf])
578 # gEDA/gaf specify things which need to setup
579 #########################################################################
582 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
583 LIBGEDA_CFLAGS="$MINGW_CFLAGS $GUILE_CFLAGS $GDGEDA_CFLAGS $GTK_CFLAGS $X_CFLAGS $GDK_PIXBUF_CFLAGS $GDK_CFLAGS"
584 LIBGEDA_LDFLAGS="$GUILE_LDFLAGS $GDGEDA_LIBS $GLIB_LIBS $MINGW_LIBS $DMALLOC_LIBS $GDK_PIXBUF_LIBS $GDK_LIBS"
585 LIBTOOL_FLAGS="-version-info $SHARED_LIBRARY_VERSION"
587 # Makefile.in variable substitution
589 AC_SUBST(LIBGEDA_CFLAGS)
590 AC_SUBST(LIBGEDA_LDFLAGS)
591 AC_SUBST(LIBTOOL_FLAGS)
592 AC_SUBST(GEDADATADIR)
595 AC_SUBST(OTHERPATHSEP)
597 AC_SUBST(NOTANGLEROOT)
598 AC_SUBST(NOTANGLEFLAGS)
599 AC_SUBST(GUILEINTERP)
604 # Create all the necessary derived files
605 AC_CONFIG_FILES([Makefile
613 scripts/notangle_guile ])
615 AC_CONFIG_COMMANDS([geda_totexi-chmod],
616 [[chmod +x scripts/geda_totexi]],[[]])
617 AC_CONFIG_COMMANDS([notangle_guile-chmod],
618 [[chmod +x scripts/notangle_guile]],[[]])
622 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
623 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
626 ** Configuration summary for $PACKAGE $VERSION:
628 GLIB library version: $GLIB_VERSION
629 GTK+ library version: $GTK_VERSION
630 GUILE library version: $GUILE_VERSION
631 libgdgeda (png output): $GDGEDA $GDGEDA_VERSION
633 data directory: $expandedGEDADATADIR
634 rc directory: $expandedGEDARCDIR
635 LIBGEDA .so version: $SHARED_LIBRARY_VERSION
636 dmalloc debugging: $with_dmalloc
637 ElectricFence debugging: $with_efence