1 # Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/gschem.c])
9 echo Configuring $PACKAGE version $DOTTED_VERSION.$DATE_VERSION
12 AM_INIT_AUTOMAKE($PACKAGE, $DOTTED_VERSION, no-define)
13 AM_CONFIG_HEADER([config.h])
14 AC_SUBST([CONFIG_DEPENDENCIES], ['$(top_srcdir)/configure.ac.in'])
16 # Call this to make autoconf and friends happy
19 #########################################################################
20 # Command line flags start
22 # --disable-stroke : turn off stroke support
24 [ --disable-stroke Disable stroke support (don't use LibStroke at all)], [ if test $enableval = "no"; then
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])
31 # Change default location for XDG files (.desktop and icons)
32 AC_ARG_WITH(xdgdatadir, [ --with-xdgdatadir=path Change where the .desktop file and theme icons are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
34 # Allow the user to specify where there libstroke library lives
35 AC_ARG_WITH(stroke, [ --with-stroke=DIR Tell configure where to find libstroke], [opt_stroke=$withval])
38 # Command line flags end
39 #########################################################################
41 #########################################################################
43 # Misc win32 / mingw checks and variables start
46 # Figure out if we are building on win32 and what environment.
48 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
51 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
53 MINGW_CFLAGS="-mms-bitfields -mwindows"
61 # Misc win32 / mingw checks and variables end
62 #########################################################################
64 # Checks for programs.
66 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
69 IT_PROG_INTLTOOL(0.35.0)
71 ############################################################################
72 # Update desktop database utility start
75 AC_ARG_ENABLE(update-desktop-database,
76 AC_HELP_STRING([--disable-update-desktop-database],
77 [do not update desktop file database after installation]),,
78 enable_update_desktop_database=yes)
80 AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE,
81 test x$enable_update_desktop_database = xyes)
83 if test x$enable_update_desktop_database = xyes ; then
84 AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
85 if test $UPDATE_DESKTOP_DATABASE = no; then
86 AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
91 # Update desktop database utility end
92 ############################################################################
94 ############################################################################
95 # Check for guile start
97 # Check for pkg-config
98 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
99 if test $PKG_CONFIG = no; then
100 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
103 PKG_CHECK_MODULES(GUILE, guile-1.8, GUILE_PC="yes", no_GUILE_PC="yes")
105 if test "$GUILE_PC" = "yes"
108 GUILE_VERSION=`$PKG_CONFIG guile-1.8 --modversion`
112 # Find about the installed guile
114 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
118 # Check Guile version
121 guile_need_version="$guile_need_major[].$guile_need_minor.0"
123 AC_MSG_CHECKING([Guile version >= $guile_need_version])
125 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
126 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
127 AC_MSG_RESULT($GUILE_VERSION)
129 if test "$guile_need_major" -gt "$guile_major" \
130 || (test "$guile_need_major" -eq "$guile_major" \
131 && test "$guile_need_minor" -gt "$guile_minor"); then
132 AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
135 # Guile 1.6 compatability
137 CFLAGS_temp_save="$CFLAGS"
138 CFLAGS="$CFLAGS $GUILE_CFLAGS"
139 AC_CHECK_DECLS([scm_is_string, scm_is_integer, scm_to_int,
140 scm_from_int, scm_is_true, scm_is_false,
141 scm_from_locale_string, scm_to_locale_string,
142 scm_from_locale_symbol],,,
143 [#include <libguile.h>])
144 CFLAGS="$CFLAGS_temp_save"
146 AH_VERBATIM(SCM_IS_STRING, [#if !HAVE_DECL_SCM_IS_STRING
147 # define scm_is_string(x) SCM_STRINGP(x)
149 AH_VERBATIM(SCM_IS_INTEGER, [#if !HAVE_DECL_SCM_IS_INTEGER
150 # define scm_is_integer(x) SCM_INUMP(x)
152 AH_VERBATIM(SCM_TO_INT, [#if !HAVE_DECL_SCM_TO_INT
153 # define scm_to_int(x) SCM_INUM(x)
155 AH_VERBATIM(SCM_FROM_INT, [#if !HAVE_DECL_SCM_FROM_INT
156 # define scm_from_int(x) SCM_MAKINUM(x)
158 AH_VERBATIM(SCM_IS_TRUE, [#if !HAVE_DECL_SCM_IS_TRUE
159 # define scm_is_true(x) SCM_NFALSEP(x)
161 AH_VERBATIM(SCM_IS_FALSE, [#if !HAVE_DECL_SCM_IS_FALSE
162 # define scm_is_false(x) SCM_FALSEP(x)
164 AH_VERBATIM(SCM_FROM_LOCALE_STRING, [#if !HAVE_DECL_SCM_FROM_LOCALE_STRING
165 # define scm_from_locale_string(x) scm_makfrom0str(x)
167 AH_VERBATIM(SCM_TO_LOCALE_STRING, [#if !HAVE_DECL_SCM_TO_LOCALE_STRING
168 # define scm_to_locale_string(x) strdup(SCM_STRING_CHARS(x))
170 AH_VERBATIM(SCM_FROM_LOCALE_SYMBOL, [#if !HAVE_DECL_SCM_FROM_LOCALE_SYMBOL
171 # define scm_from_locale_symbol(x) scm_string_to_symbol (scm_from_locale_string(x))
175 # Check for guile end
176 ############################################################################
178 ############################################################################
179 # Check for mics things start
181 # Checking for rint in math library
182 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
184 # Checking for dynamic lib
185 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
187 # Check for mics things start
188 ############################################################################
190 ############################################################################
191 # Check for X11 start
194 if test "$MINGW" = "no"
199 X_EXTRA_LIBS="$X_EXTRA_LIBS"
200 X_LDFLAGS="$X_LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11 -lm"
203 AC_MSG_CHECKING([if hardcoding of the X11 runtime library path is desired])
204 AC_ARG_ENABLE([rpath],
205 [ --enable-rpath Enable hardcoding the X11 runtime library path [default=disabled]],
207 if test "X$enable_rpath" = "Xno" ; then
220 if test "X$_use_rpath" = "Xyes" ; then
221 # Try to figure out if we need -Rpath for finding X11 libs
222 # at runtime. Why autoconf doesn't already do this, I don't
225 for p in $X_LDFLAGS ; do
228 xlib_path="$xlib_path $p"
234 LIBS="$LIBS $X_LDFLAGS"
236 for fl in "-Wl,-rpath " "-Wl,--rpath " "-rpath " "--rpath " "-Wl,-R" "-R" "-R " ; do
237 xlib_rpath=`echo $xlib_path | sed "s/-L/$fl/g"`
238 LIBS="$_save_LIBS $X_LIBS $xlib_rpath"
239 AC_MSG_CHECKING([if the compiler accepts ${fl}path for runtime libraries])
240 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
244 test -n "$rpath" && break
246 if test -n "$rpath"; then
247 X_LDFLAGS="$X_LDFLAGS $xlib_rpath"
256 ############################################################################
258 ############################################################################
259 # Check for gtk+ start
262 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8.0, GTK="yes", no_GTK="yes")
264 # This next bit of code figures out what gtk we need to use.
265 if test "$GTK" = "yes"
267 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
270 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.8.0, GLIB="yes", no_GLIB="yes")
271 if test "$GLIB" != "yes"
273 AC_MSG_ERROR([Cannot find glib 2.8.0 or later, please install it and rerun ./configure.])
275 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
278 PKG_CHECK_MODULES(GTHREAD, gthread-2.0, GTHREAD="yes", no_GTHREAD="yes")
279 if test "$GTHREAD" = "yes"
281 AC_DEFINE(HAVE_GTHREAD, 1, [If gthread support is installed, define this])
288 if test "$GTK_VERSION" = ""
290 AC_MSG_ERROR([Cannot find gtk+ 2.8.0 or later, please install it and rerun ./configure.])
295 ############################################################################
297 ############################################################################
298 # Check for cairo start
302 AC_HELP_STRING([--disable-cairo],
303 [Disable the use of cairo for rendering]), , enable_cairo=yes)
305 AM_CONDITIONAL(ENABLE_CAIRO, test "x$enable_cairo" = "xyes")
307 PKG_CHECK_MODULES(CAIRO, cairo >= 1.2.0, CAIRO="yes", no_CAIRO="yes")
309 if test "x$enable_cairo" != "xyes"
311 AC_DEFINE(ENABLE_CAIRO, 1, [If cairo rendering is enabled, define this])
313 if test "$CAIRO" = "yes"
315 CAIRO_VERSION=`$PKG_CONFIG cairo --modversion`
317 AC_MSG_ERROR([Cannot find cairo 1.2.0 or later, please install or configure with --disable-cairo])
322 # Check for cairo end
323 ############################################################################
325 ############################################################################
326 # Check for libgeda start
328 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes",
331 if test "$LIBGEDA" = "yes"
333 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
335 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
339 # Check for libgeda end
340 ############################################################################
342 ############################################################################
343 # Check for libstroke start
346 # user specified --with-stroke
347 if eval "test x$opt_stroke != x"; then
348 LIBSTROKE_LIBS="-L$opt_stroke/lib"
349 LIBSTROKE_CFLAGS="-I$opt_stroke/include"
352 # only check if the user has not disable strokes
353 if test "$no_stroke" != "yes"; then
354 save_cppflags="$CPPFLAGS"
355 save_ldflags="$LDFLAGS"
356 CPPFLAGS="$CPPFLAGS $LIBSTROKE_CFLAGS"
357 LDFLAGS="$LDFLAGS $LIBSTROKE_LIBS"
358 AC_CHECK_LIB(stroke, stroke_init, LIBSTROKE="yes", LIBSTROKE="no")
359 CPPFLAGS="$save_cppflags"
360 LDFLAGS="$save_ldflags"
363 if test "$LIBSTROKE" = "yes"; then
364 AC_DEFINE(HAS_LIBSTROKE, 1, [Define if you have libstroke installed])
365 if eval "test x$opt_stroke = x"; then
366 LIBSTROKE_LIBS="-lstroke"
369 LIBSTROKE_LIBS="$LIBSTROKE_LIBS -lstroke"
370 # LIBSTROKE_CFLAGS set above
374 if test "$no_stroke" = "yes"; then
376 echo "** Disabling libstroke by request **"
384 # Check for libstroke end
385 ############################################################################
387 ############################################################################
388 # Check for doxygen start
390 # Doxygen is a utility for generating html and latex documentation
391 # from c source code files.
394 AC_PATH_PROG(DOXYGEN, doxygen, no, ${PATH})
396 if test "$DOXYGEN" = "no"; then
397 # doxygen is not available on the system
398 echo "** Cannot find Doxygen! **"
399 echo "** Documentation creation disabled **"
402 # prevent from weaving the nw files
403 # but does not prevent from processing gschemdoc
406 # doxygen 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 creation of html and latex documents.
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)
423 # Check for doxygen end
424 #########################################################################
426 #########################################################################
427 # Check for groff start
431 AC_PATH_PROG(GROFF, groff, no, ${PATH})
432 if test $GROFF = "no"; then
433 echo "Cannot find groff, some documentation will not be created."
437 # Check for groff end
438 #########################################################################
440 #########################################################################
441 # Checks for header files start
446 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
447 stdarg.h assert.h fcntl.h errno.h sys/param.h)
453 AC_CHECK_HEADER([locale.h],
454 [AC_DEFINE([HAVE_LOCALE_H], 1, [Define if you have locale.h])],
456 if test "$USE_NLS" = "yes"; then
457 AC_MSG_ERROR([Cannot find useful locale.h, and nls support is enabled. Try compiling with --disable-nls])
461 # Set package name for translations
462 GETTEXT_PACKAGE=$PACKAGE
463 AC_SUBST(GETTEXT_PACKAGE)
465 # Checks for typedefs, structures, and compiler characteristics.
468 # Checks for library functions.
470 AC_CHECK_FUNCS(strstr getuid getgid)
472 AC_MSG_CHECKING([for optarg in unistd.h])
474 [#include <unistd.h>],
475 [ char *string = optarg; int i = optind; ],
478 AC_MSG_RESULT($optarg_found)
480 if test $optarg_found = yes; then
481 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
485 # Checks for header files end
486 #########################################################################
488 #########################################################################
491 # ------------- dmalloc -------------------
494 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
495 AC_ARG_ENABLE([dmalloc],
496 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
498 if test "X$enable_dmalloc" != "Xno" ; then
500 AC_CHECK_HEADER(dmalloc.h,,
501 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
502 AC_CHECK_LIB(dmalloc,main,,
503 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
504 DMALLOC_LIBS="-ldmalloc"
516 # ------------- ElectricFence -------------------
517 dnl ElectricFence checks
519 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
520 AC_ARG_ENABLE([efence],
521 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
523 if test "X$enable_efence" != "Xno" ; then
525 AC_CHECK_LIB(efence,main,,
526 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
537 #########################################################################
538 #########################################################################
539 # gEDA/gaf specific setup start
543 GEDADATADIR=$datadir/$DATADIR
545 if eval "test x$opt_rcdir = x"; then
546 # path was not specified with --with-rcdir
547 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
548 GEDARCDIR=$GEDADATADIR
550 # path WAS specified with --with-rcdir
551 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
552 GEDARCDIR="$opt_rcdir"
555 if test x$opt_xdgdatadir = x; then
556 # path was not specified with --with-xdgdatadir
557 XDGDATADIR='${datadir}'
559 # path WAS specified with --with-xdgdatadir
560 XDGDATADIR="$opt_xdgdatadir"
564 # Expand the prefix variable
565 # I don't like the way this is done, but it works (I hope).
566 if eval "test x$prefix = xNONE"; then
567 dprefix=$ac_default_prefix
572 gedatopdir=$dprefix/share/$DATADIR
573 expandgedadatadir=`echo $gedatopdir`
575 gedadocdir=$dprefix/share/doc/geda-doc
576 # --with-docdir : tells where to store documentation if not default
578 [ --with-docdir Where to store documentation if not default.],
580 expandgedadocdir=`echo $gedadocdir`
581 GEDADOCDIR=$expandgedadocdir
584 # this has to be expanded ( no ${prefix} ) --
585 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
586 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
587 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
588 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
591 # gEDA/gaf specify things which need to setup
592 #########################################################################
594 # Initialized gettext
596 AM_GNU_GETTEXT_VERSION([%INSTALLED_GETTEXT_VERSION%])
598 #GETTEXT_PACKAGE=$PACKAGE
599 #AC_SUBST(GETTEXT_PACKAGE)
600 #AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"],
601 # [The domain to use with gettext])
604 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
605 GSCHEM_CFLAGS="$MINGW_CFLAGS $LIBSTROKE_CFLAGS $LIBGEDA_CFLAGS $GTK_CFLAGS $GTHREAD_CFLAGS"
606 GSCHEM_LDFLAGS="$LIBSTROKE_LIBS $LIBGEDA_LIBS $GTK_LIBS $X_LDFLAGS $DMALLOC_LIBS $GTHREAD_LIBS"
608 # Makefile.in variable substitution
609 AC_SUBST(DATE_VERSION)
610 AC_SUBST(DOTTED_VERSION)
611 AC_SUBST(GSCHEM_CFLAGS)
612 AC_SUBST(GSCHEM_LDFLAGS)
613 AC_SUBST(GEDADATADIR)
615 AC_SUBST(GUILEINTERP)
618 # Create all the necessary derived files
619 AC_CONFIG_FILES([Makefile
634 lib/system-gschemrc ])
639 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
640 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
641 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
642 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
644 if test "x$enable_cairo" = "xyes"
646 cairo_report=$CAIRO_VERSION
648 cairo_report="[[DISABLED]]"
652 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
654 GTK+ library version: $GTK_VERSION
655 CAIRO library version: $cairo_report
656 GUILE library version: $GUILE_VERSION
657 libgeda library version: $LIBGEDA_VERSION
658 libstroke library: $LIBSTROKE
660 data directory: $expandedGEDADATADIR
661 rc directory: $expandedGEDARCDIR
662 xdg directory: $expandedXDGDATADIR
663 documentation directory: $expandedGEDADOCDIR
664 dmalloc debugging: $with_dmalloc
665 ElectricFence debugging: $with_efence