3 # Process this file with autoconf to produce a configure script.
5 AC_CONFIG_SRCDIR([src/gschem.c])
10 echo Configuring $PACKAGE version $VERSION
13 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
14 AM_CONFIG_HEADER([config.h])
16 # Initialize maintainer mode
19 # Call this to make autoconf and friends happy
22 #########################################################################
23 # Command line flags start
25 # --disable-stroke : turn off stroke support
27 [ --disable-stroke Disable stroke support (don't use LibStroke at all)], [ if test $enableval = "no"; then
31 # --disable-gd : turn off libgd support
33 [ --disable-gd Disable libgd support (don't use libgd at all)], [ if test $enableval = "no"; then
37 # Change default location for rc files
38 AC_ARG_WITH(rcdir, [ --with-rcdir=path Change where the system-*rc files are installed], [opt_rcdir=$withval])
40 # Allow the user to specify where there libstroke library lives
41 AC_ARG_WITH(stroke, [ --with-stroke=DIR Tell configure where to find libstroke], [opt_stroke=$withval])
44 # Command line flags end
45 #########################################################################
47 #########################################################################
49 # Misc win32 / mingw checks and variables start
52 # Figure out if we are building on win32 and what environment.
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.
74 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
78 ############################################################################
79 # Check for guile start
80 # Do a very basic guile test, as the bulk of the flags will come from
85 # Manually search for guile-config. This is provided by GUILE_PROGS, but
86 # guile-1.4 does not have GUILE_PROGS, so we have to do it manually.
87 AC_PATH_PROG(GUILE_CONFIG,guile-config)
88 if test "$GUILE_CONFIG" = "" ; then
89 AC_MSG_ERROR([guile-config required but not found])
91 AC_SUBST(GUILE_CONFIG)
93 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
97 ############################################################################
99 ############################################################################
100 # Check for mics things start
102 # Checking for rint in math library
103 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
105 # Checking for dynamic lib
106 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
108 # Check for mics things start
109 ############################################################################
111 ############################################################################
112 # Check for X11 start
115 if test "$MINGW" = "no"
120 X_EXTRA_LIBS="$X_EXTRA_LIBS"
121 X_LDFLAGS="$X_LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11 -lm"
124 AC_MSG_CHECKING([if hardcoding of the X11 runtime library path is desired])
125 AC_ARG_ENABLE([rpath],
126 [ --enable-rpath Enable hardcoding the X11 runtime library path [default=disabled]],
128 if test "X$enable_rpath" = "Xno" ; then
141 if test "X$_use_rpath" = "Xyes" ; then
142 # Try to figure out if we need -Rpath for finding X11 libs
143 # at runtime. Why autoconf doesn't already do this, I don't
146 for p in $X_LDFLAGS ; do
149 xlib_path="$xlib_path $p"
155 LIBS="$LIBS $X_LDFLAGS"
157 for fl in "-Wl,-rpath " "-Wl,--rpath " "-rpath " "--rpath " "-Wl,-R" "-R" "-R " ; do
158 xlib_rpath=`echo $xlib_path | sed "s/-L/$fl/g"`
159 LIBS="$_save_LIBS $X_LIBS $xlib_rpath"
160 AC_MSG_CHECKING([if the compiler accepts ${fl}path for runtime libraries])
161 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
165 test -n "$rpath" && break
167 if test -n "$rpath"; then
168 X_LDFLAGS="$X_LDFLAGS $xlib_rpath"
177 ############################################################################
179 ############################################################################
180 # Check for gtk+ 2.4 start
183 # Check for pkg-config
184 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
185 if test $PKG_CONFIG = no; then
186 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
189 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
191 # This next bit of code figures out what gtk we need to use.
192 if test "$GTK24" = "yes"
195 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
196 GTK_CFLAGS=$GTK24_CFLAGS
198 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
201 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
202 if test "$GLIB24" != "yes"
204 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
206 GLIB_CFLAGS=$GLIB24_CFLAGS
207 GLIB_LIBS=$GLIB24_LIBS
208 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
214 if test "$GTK_VERSION" = ""
216 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
220 # Check for gtk+ 2.4 end
221 ############################################################################
223 ############################################################################
224 # Check for libgeda start
226 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $VERSION, LIBGEDA="yes",
229 if test "$LIBGEDA" = "yes"
231 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
233 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
237 # Check for libgeda end
238 ############################################################################
240 ############################################################################
241 # Check for libgd start
242 # Do some very simple tests, as we just need to know if libgeda was
243 # built with libgd support.
246 if test "X$no_gd" != "Xyes"; then
247 AC_MSG_CHECKING([if libgeda was compiled with gdlib])
248 haslibgd=`$PKG_CONFIG --variable=LIBGEDA_HASGD libgeda`
249 if test "$haslibgd" != "yes"; then
250 AC_MSG_WARN([libgeda was not built with libgd png support.
251 gschem will use the builtin png support. If you want libgd png support, you
252 must recompile libgeda with gdlib support.])
257 AC_DEFINE(HAS_LIBGD, 1, [If gd has been installed, define this])
265 # Check for libgd end
266 ############################################################################
269 ############################################################################
270 # Check for libstroke start
273 # user specified --with-stroke
274 if eval "test x$opt_stroke != x"; then
275 LIBSTROKE_LIBS="-L$opt_stroke/lib"
276 LIBSTROKE_CFLAGS="-I$opt_stroke/include"
279 # only check if the user has not disable strokes
280 if test "$no_stroke" != "yes"; then
281 save_cppflags="$CPPFLAGS"
282 save_ldflags="$LDFLAGS"
283 CPPFLAGS="$CPPFLAGS $LIBSTROKE_CFLAGS"
284 LDFLAGS="$LDFLAGS $LIBSTROKE_LIBS"
285 AC_CHECK_LIB(stroke, stroke_init, LIBSTROKE="yes", LIBSTROKE="no")
286 CPPFLAGS="$save_cppflags"
287 LDFLAGS="$save_ldflags"
290 if test "$LIBSTROKE" = "yes"; then
291 AC_DEFINE(HAS_LIBSTROKE, 1, [Define if you have libstroke installed])
292 if eval "test x$opt_stroke = x"; then
293 LIBSTROKE_LIBS="-lstroke"
296 LIBSTROKE_LIBS="$LIBSTROKE_LIBS -lstroke"
297 # LIBSTROKE_CFLAGS set above
301 if test "$no_stroke" = "yes"; then
303 echo "** Disabling libstroke by request **"
311 # Check for libstroke end
312 ############################################################################
314 ############################################################################
315 # Check for doxygen, indent start
317 # Doxygen is a utility for generating html and latex documentation
318 # from c source code files.
321 AC_PATH_PROG(DOXYGEN, doxygen, no, ${PATH})
323 if test "$DOXYGEN" = "no"; then
324 # doxygen is not available on the system
325 echo "** Cannot find Doxygen! **"
326 echo "** Documentation creation disabled **"
329 # prevent from weaving the nw files
330 # but does not prevent from processing gschemdoc
333 # doxygen is available on the system.
334 # now checking if the tools for Texinfo files processing
336 # The docs can be either processed to produce dvi, html or info
337 # with texi2dvi, texi2html or makeinfo respectively
338 # Note : these tests on makeinfo and texi2dvi are no more
339 # needed as automake makes them for us
341 # enable the creation of html and latex documents.
345 # depending on variable builddoc, weaving is performed or not
346 # using conditionnal in docs/Makefile.in
347 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
350 AC_PATH_PROG(INDENT, indent, no, ${PATH})
352 if ! test "$INDENT" = "no"; then
353 indentversion=`$INDENT --version | grep GNU`
358 if test "$INDENT" = "no" -o "$indentversion"x = x; then
359 AC_PATH_PROG(GINDENT, gindent, no, ${PATH})
360 if test "$GINDENT" = "no"; then
361 echo "** Cannot find GNU indent or gindent, C code formatting disabled **"
369 # Check for doxygen, indent end
370 #########################################################################
372 #########################################################################
373 # Check for groff start
377 AC_PATH_PROG(GROFF, groff, no, ${PATH})
378 if test $GROFF = "no"; then
379 echo "Cannot find groff, some documentation will not be created."
383 # Check for groff end
384 #########################################################################
386 #########################################################################
387 # Checks for header files start
392 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
393 stdarg.h assert.h fcntl.h errno.h sys/param.h)
395 # Checks for typedefs, structures, and compiler characteristics.
398 # Checks for library functions.
400 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
402 AC_MSG_CHECKING([for optarg in unistd.h])
404 [#include <unistd.h>],
405 [ char *string = optarg; int i = optind; ],
408 AC_MSG_RESULT($optarg_found)
410 if test $optarg_found = yes; then
411 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
415 # Checks for header files end
416 #########################################################################
418 #########################################################################
421 # ------------- dmalloc -------------------
424 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
425 AC_ARG_ENABLE([dmalloc],
426 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
428 if test "X$enable_dmalloc" != "Xno" ; then
430 AC_CHECK_HEADER(dmalloc.h,,
431 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
432 AC_CHECK_LIB(dmalloc,main,,
433 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
434 DMALLOC_LIBS="-ldmalloc"
446 # ------------- ElectricFence -------------------
447 dnl ElectricFence checks
449 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
450 AC_ARG_ENABLE([efence],
451 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
453 if test "X$enable_efence" != "Xno" ; then
455 AC_CHECK_LIB(efence,main,,
456 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
467 #########################################################################
468 #########################################################################
469 # gEDA/gaf specific setup start
473 GEDADATADIR=$datadir/$DATADIR
475 if eval "test x$opt_rcdir = x"; then
476 # path was not specified with --with-rcdir
477 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
478 GEDARCDIR=$GEDADATADIR
480 # path WAS specified with --with-rcdir
481 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
482 GEDARCDIR="$opt_rcdir"
485 # Expand the prefix variable
486 # I don't like the way this is done, but it works (I hope).
487 if eval "test x$prefix = xNONE"; then
488 dprefix=$ac_default_prefix
493 gedatopdir=$dprefix/share/$DATADIR
494 expandgedadatadir=`echo $gedatopdir`
496 gedadocdir=$dprefix/share/doc/geda-doc
497 # --with-docdir : tells where to store documentation if not default
499 [ --with-docdir Where to store documentation if not default.],
501 expandgedadocdir=`echo $gedadocdir`
502 GEDADOCDIR=$expandgedadocdir
505 # this has to be expanded ( no ${prefix} ) --
506 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
507 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Currently running version of gEDA/gaf])
510 # gEDA/gaf specify things which need to setup
511 #########################################################################
513 # Initialized gettext
515 AM_GNU_GETTEXT_VERSION([%INSTALLED_GETTEXT_VERSION%])
517 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
518 GSCHEM_CFLAGS="$LIBSTROKE_CFLAGS $LIBGEDA_CFLAGS"
519 GSCHEM_LDFLAGS="$LIBSTROKE_LIBS $LIBGEDA_LIBS $GTK_LIBS $X_LDFLAGS $DMALLOC_LIBS"
521 # Makefile.in variable substitution
522 AC_SUBST(GSCHEM_CFLAGS)
523 AC_SUBST(GSCHEM_LDFLAGS)
524 AC_SUBST(GEDADATADIR)
527 AC_SUBST(OTHERPATHSEP)
528 AC_SUBST(GUILEINTERP)
531 # Create all the necessary derived files
532 AC_CONFIG_FILES([Makefile
545 lib/system-gschemrc ])
550 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
551 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
552 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
555 ** Configuration summary for $PACKAGE $VERSION:
557 GTK+ library version: $GTK_VERSION
558 GUILE library version: $GUILE_VERSION
559 libgeda library version: $LIBGEDA_VERSION
560 libstroke library: $LIBSTROKE
561 libgd library: $LIBGD
563 data directory: $expandedGEDADATADIR
564 rc directory: $expandedGEDARCDIR
565 documentation directory: $expandedGEDADOCDIR
566 dmalloc debugging: $with_dmalloc
567 ElectricFence debugging: $with_efence