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
20 #########################################################################
21 # Command line flags start
23 # --disable-stroke : turn off stroke support
25 [ --disable-stroke Disable stroke support (don't use LibStroke at all)], [ if test $enableval = "no"; then
29 # --disable-gd : turn off libgd support
31 [ --disable-gd Disable libgd support (don't use libgd at all)], [ if test $enableval = "no"; then
35 # Change default location for rc files
36 AC_ARG_WITH(rcdir, [ --with-rcdir=path Change where the system-*rc files are installed], [opt_rcdir=$withval])
38 # Allow the user to specify where there libstroke library lives
39 AC_ARG_WITH(stroke, [ --with-stroke=DIR Tell configure where to find libstroke], [opt_stroke=$withval])
42 # Command line flags end
43 #########################################################################
45 #########################################################################
47 # Misc win32 / mingw checks and variables start
50 # Figure out if we are building on win32 and what environment.
52 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
55 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
67 # Misc win32 / mingw checks and variables end
68 #########################################################################
70 # Checks for programs.
72 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
76 ############################################################################
77 # Check for guile start
78 # Do a very basic guile test, as the bulk of the flags will come from
83 # Manually search for guile-config. This is provided by GUILE_PROGS, but
84 # guile-1.4 does not have GUILE_PROGS, so we have to do it manually.
85 AC_PATH_PROG(GUILE_CONFIG,guile-config)
86 if test "$GUILE_CONFIG" = "" ; then
87 AC_MSG_ERROR([guile-config required but not found])
89 AC_SUBST(GUILE_CONFIG)
91 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
95 ############################################################################
97 ############################################################################
98 # Check for mics things start
100 # Checking for rint in math library
101 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
103 # Checking for dynamic lib
104 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
106 # Check for mics things start
107 ############################################################################
109 ############################################################################
110 # Check for X11 start
113 if test "$MINGW" = "no"
118 X_EXTRA_LIBS="$X_EXTRA_LIBS"
119 X_LDFLAGS="$X_LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11 -lm"
122 AC_MSG_CHECKING([if hardcoding of the X11 runtime library path is desired])
123 AC_ARG_ENABLE([rpath],
124 [ --enable-rpath Enable hardcoding the X11 runtime library path [default=disabled]],
126 if test "X$enable_rpath" = "Xno" ; then
139 if test "X$_use_rpath" = "Xyes" ; then
140 # Try to figure out if we need -Rpath for finding X11 libs
141 # at runtime. Why autoconf doesn't already do this, I don't
144 for p in $X_LDFLAGS ; do
147 xlib_path="$xlib_path $p"
153 LIBS="$LIBS $X_LDFLAGS"
155 for fl in "-Wl,-rpath " "-Wl,--rpath " "-rpath " "--rpath " "-Wl,-R" "-R" "-R " ; do
156 xlib_rpath=`echo $xlib_path | sed "s/-L/$fl/g"`
157 LIBS="$_save_LIBS $X_LIBS $xlib_rpath"
158 AC_MSG_CHECKING([if the compiler accepts ${fl}path for runtime libraries])
159 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
163 test -n "$rpath" && break
165 if test -n "$rpath"; then
166 X_LDFLAGS="$X_LDFLAGS $xlib_rpath"
175 ############################################################################
177 ############################################################################
178 # Check for gtk+ 2.4 start
181 # Check for pkg-config
182 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
183 if test $PKG_CONFIG = no; then
184 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
187 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
189 # This next bit of code figures out what gtk we need to use.
190 if test "$GTK24" = "yes"
193 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
194 GTK_CFLAGS=$GTK24_CFLAGS
196 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
199 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
200 if test "$GLIB24" != "yes"
202 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
204 GLIB_CFLAGS=$GLIB24_CFLAGS
205 GLIB_LIBS=$GLIB24_LIBS
206 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
212 if test "$GTK_VERSION" = ""
214 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
218 # Check for gtk+ 2.4 end
219 ############################################################################
221 ############################################################################
222 # Check for libgeda start
224 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $VERSION, LIBGEDA="yes",
227 if test "$LIBGEDA" = "yes"
229 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
231 AC_MSG_ERROR([Cannot find libgeda (or libgeda.pc), please install libgeda])
235 # Check for libgeda end
236 ############################################################################
238 ############################################################################
239 # Check for libgd start
240 # Do some very simple tests, as we just need to know if libgeda was
241 # built with libgd support.
244 if test "X$no_gd" != "Xyes"; then
245 AC_MSG_CHECKING([if libgeda was compiled with gdlib])
246 haslibgd=`$PKG_CONFIG --variable=LIBGEDA_HASGD libgeda`
247 if test "$haslibgd" != "yes"; then
248 AC_MSG_WARN([libgeda was not built with libgd png support.
249 gschem will use the builtin png support. If you want libgd png support, you
250 must recompile libgeda with gdlib support.])
262 # Check for libgd end
263 ############################################################################
266 ############################################################################
267 # Check for libstroke start
270 # user specified --with-stroke
271 if eval "test x$opt_stroke != x"; then
272 LIBSTROKE_LIBS="-L$opt_stroke/lib"
273 LIBSTROKE_CFLAGS="-I$opt_stroke/include"
276 # only check if the user has not disable strokes
277 if test "$no_stroke" != "yes"; then
278 save_cppflags="$CPPFLAGS"
279 save_ldflags="$LDFLAGS"
280 CPPFLAGS="$CPPFLAGS $LIBSTROKE_CFLAGS"
281 LDFLAGS="$LDFLAGS $LIBSTROKE_LIBS"
282 AC_CHECK_LIB(stroke, stroke_init, LIBSTROKE="yes", LIBSTROKE="no")
283 CPPFLAGS="$save_cppflags"
284 LDFLAGS="$save_ldflags"
287 if test "$LIBSTROKE" = "yes"; then
288 AC_DEFINE(HAS_LIBSTROKE, 1, [Define if you have libstroke installed])
289 if eval "test x$opt_stroke = x"; then
290 LIBSTROKE_LIBS="-lstroke"
293 LIBSTROKE_LIBS="$LIBSTROKE_LIBS -lstroke"
294 # LIBSTROKE_CFLAGS set above
298 if test "$no_stroke" = "yes"; then
300 echo "** Disabling libstroke by request **"
308 # Check for libstroke end
309 ############################################################################
311 ############################################################################
312 # Check for doxygen, indent start
314 # Doxygen is a utility for generating html and latex documentation
315 # from c source code files.
318 AC_PATH_PROG(DOXYGEN, doxygen, no, ${PATH})
320 if test "$DOXYGEN" = "no"; then
321 # doxygen is not available on the system
322 echo "** Cannot find Doxygen! **"
323 echo "** Documentation creation disabled **"
326 # prevent from weaving the nw files
327 # but does not prevent from processing gschemdoc
330 # doxygen is available on the system.
331 # now checking if the tools for Texinfo files processing
333 # The docs can be either processed to produce dvi, html or info
334 # with texi2dvi, texi2html or makeinfo respectively
335 # Note : these tests on makeinfo and texi2dvi are no more
336 # needed as automake makes them for us
338 # enable the creation of html and latex documents.
342 # depending on variable builddoc, weaving is performed or not
343 # using conditionnal in docs/Makefile.in
344 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
347 AC_PATH_PROG(INDENT, indent, no, ${PATH})
349 if ! test "$INDENT" = "no"; then
350 indentversion=`$INDENT --version | grep GNU`
355 if test "$INDENT" = "no" -o "$indentversion"x = x; then
356 AC_PATH_PROG(GINDENT, gindent, no, ${PATH})
357 if test "$GINDENT" = "no"; then
358 echo "** Cannot find GNU indent or gindent, C code formatting disabled **"
366 # Check for doxygen, indent end
367 #########################################################################
369 #########################################################################
370 # Check for groff start
374 AC_PATH_PROG(GROFF, groff, no, ${PATH})
375 if test $GROFF = "no"; then
376 echo "Cannot find groff, some documentation will not be created."
380 # Check for groff end
381 #########################################################################
383 #########################################################################
384 # Checks for header files start
389 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
390 stdarg.h assert.h fcntl.h errno.h sys/param.h)
392 # Checks for typedefs, structures, and compiler characteristics.
395 # Checks for library functions.
397 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
399 AC_MSG_CHECKING([for optarg in unistd.h])
401 [#include <unistd.h>],
402 [ char *string = optarg; int i = optind; ],
405 AC_MSG_RESULT($optarg_found)
407 if test $optarg_found = yes; then
408 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
412 # Checks for header files end
413 #########################################################################
415 #########################################################################
418 # ------------- dmalloc -------------------
421 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
422 AC_ARG_ENABLE([dmalloc],
423 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
425 if test "X$enable_dmalloc" != "Xno" ; then
427 AC_CHECK_HEADER(dmalloc.h,,
428 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
429 AC_CHECK_LIB(dmalloc,main,,
430 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
431 DMALLOC_LIBS="-ldmalloc"
443 # ------------- ElectricFence -------------------
444 dnl ElectricFence checks
446 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
447 AC_ARG_ENABLE([efence],
448 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
450 if test "X$enable_efence" != "Xno" ; then
452 AC_CHECK_LIB(efence,main,,
453 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
464 #########################################################################
465 #########################################################################
466 # gEDA/gaf specific setup start
470 GEDADATADIR=$datadir/$DATADIR
472 if eval "test x$opt_rcdir = x"; then
473 # path was not specified with --with-rcdir
474 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
475 GEDARCDIR=$GEDADATADIR
477 # path WAS specified with --with-rcdir
478 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
479 GEDARCDIR="$opt_rcdir"
482 # Expand the prefix variable
483 # I don't like the way this is done, but it works (I hope).
484 if eval "test x$prefix = xNONE"; then
485 dprefix=$ac_default_prefix
490 gedatopdir=$dprefix/share/$DATADIR
491 expandgedadatadir=`echo $gedatopdir`
493 gedadocdir=$dprefix/share/doc/geda-doc
494 # --with-docdir : tells where to store documentation if not default
496 [ --with-docdir Where to store documentation if not default.],
498 expandgedadocdir=`echo $gedadocdir`
499 GEDADOCDIR=$expandgedadocdir
502 # this has to be expanded ( no ${prefix} ) --
503 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
504 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Currently running version of gEDA/gaf])
507 # gEDA/gaf specify things which need to setup
508 #########################################################################
510 # Initialized gettext
512 AM_GNU_GETTEXT_VERSION(0.12.1)
514 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
515 GSCHEM_CFLAGS="$LIBSTROKE_CFLAGS $LIBGEDA_CFLAGS"
516 GSCHEM_LDFLAGS="$LIBSTROKE_LIBS $LIBGEDA_LIBS $GTK_LIBS $X_LDFLAGS $DMALLOC_LIBS"
518 # Makefile.in variable substitution
519 AC_SUBST(GSCHEM_CFLAGS)
520 AC_SUBST(GSCHEM_LDFLAGS)
521 AC_SUBST(GEDADATADIR)
524 AC_SUBST(OTHERPATHSEP)
525 AC_SUBST(GUILEINTERP)
528 # Create all the necessary derived files
529 AC_CONFIG_FILES([Makefile
542 lib/system-gschemrc ])
547 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
548 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
549 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
552 ** Configuration summary for $PACKAGE $VERSION:
554 GTK+ library version: $GTK_VERSION
555 GUILE library version: $GUILE_VERSION
556 libgeda library version: $LIBGEDA_VERSION
557 libstroke library: $LIBSTROKE
558 libgd library: $LIBGD
560 data directory: $expandedGEDADATADIR
561 rc directory: $expandedGEDARCDIR
562 documentation directory: $expandedGEDADOCDIR
563 dmalloc debugging: $with_dmalloc
564 ElectricFence debugging: $with_efence