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 gtk+ start
194 PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.8.0], GTK="yes", no_GTK="yes")
196 # This next bit of code figures out what gtk we need to use.
197 if test "$GTK" = "yes"
199 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
202 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.8.0], GLIB="yes", no_GLIB="yes")
203 if test "$GLIB" != "yes"
205 AC_MSG_ERROR([Cannot find glib 2.8.0 or later, please install it and rerun ./configure.])
207 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
210 PKG_CHECK_MODULES(GTHREAD, [gthread-2.0], GTHREAD="yes", no_GTHREAD="yes")
211 if test "$GTHREAD" = "yes"
213 AC_DEFINE(HAVE_GTHREAD, 1, [If gthread support is installed, define this])
220 if test "$GTK_VERSION" = ""
222 AC_MSG_ERROR([Cannot find gtk+ 2.8.0 or later, please install it and rerun ./configure.])
227 ############################################################################
229 ############################################################################
230 # Check for cairo start
233 PKG_CHECK_MODULES(CAIRO, [cairo >= 1.2.0], CAIRO="yes", no_CAIRO="yes")
235 if test "$CAIRO" = "yes"
237 CAIRO_VERSION=`$PKG_CONFIG cairo --modversion`
239 AC_MSG_ERROR([Cannot find cairo 1.2.0 or later, please install or configure with --disable-cairo])
243 # Check for cairo end
244 ############################################################################
246 ############################################################################
247 # Check for libgeda start
249 PKG_CHECK_MODULES(LIBGEDA, [libgeda >= $DATE_VERSION], LIBGEDA="yes",
252 if test "$LIBGEDA" = "yes"
254 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
256 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
260 # Check for libgeda end
261 ############################################################################
263 ############################################################################
264 # Check for libstroke start
267 # user specified --with-stroke
268 if eval "test x$opt_stroke != x"; then
269 LIBSTROKE_LIBS="-L$opt_stroke/lib"
270 LIBSTROKE_CFLAGS="-I$opt_stroke/include"
273 # only check if the user has not disable strokes
274 if test "$no_stroke" != "yes"; then
275 save_cppflags="$CPPFLAGS"
276 save_ldflags="$LDFLAGS"
277 CPPFLAGS="$CPPFLAGS $LIBSTROKE_CFLAGS"
278 LDFLAGS="$LDFLAGS $LIBSTROKE_LIBS"
279 AC_CHECK_LIB(stroke, stroke_init, LIBSTROKE="yes", LIBSTROKE="no")
280 CPPFLAGS="$save_cppflags"
281 LDFLAGS="$save_ldflags"
284 if test "$LIBSTROKE" = "yes"; then
285 AC_DEFINE(HAS_LIBSTROKE, 1, [Define if you have libstroke installed])
286 if eval "test x$opt_stroke = x"; then
287 LIBSTROKE_LIBS="-lstroke"
290 LIBSTROKE_LIBS="$LIBSTROKE_LIBS -lstroke"
291 # LIBSTROKE_CFLAGS set above
295 if test "$no_stroke" = "yes"; then
297 echo "** Disabling libstroke by request **"
305 # Check for libstroke end
306 ############################################################################
308 ############################################################################
309 # Check for doxygen start
311 # Doxygen is a utility for generating html and latex documentation
312 # from c source code files.
315 AC_PATH_PROG(DOXYGEN, doxygen, no, ${PATH})
317 if test "$DOXYGEN" = "no"; then
318 # doxygen is not available on the system
319 echo "** Cannot find Doxygen! **"
320 echo "** Documentation creation disabled **"
323 # prevent from weaving the nw files
324 # but does not prevent from processing gschemdoc
327 # doxygen is available on the system.
328 # now checking if the tools for Texinfo files processing
330 # The docs can be either processed to produce dvi, html or info
331 # with texi2dvi, texi2html or makeinfo respectively
332 # Note : these tests on makeinfo and texi2dvi are no more
333 # needed as automake makes them for us
335 # enable the creation of html and latex documents.
339 # depending on variable builddoc, weaving is performed or not
340 # using conditionnal in docs/Makefile.in
341 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
344 # Check for doxygen end
345 #########################################################################
347 #########################################################################
348 # Check for groff start
352 AC_PATH_PROG(GROFF, groff, no, ${PATH})
353 if test $GROFF = "no"; then
354 echo "Cannot find groff, some documentation will not be created."
358 # Check for groff end
359 #########################################################################
361 #########################################################################
362 # Checks for header files start
367 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
368 stdarg.h assert.h fcntl.h errno.h sys/param.h)
374 AC_CHECK_HEADER([locale.h],
375 [AC_DEFINE([HAVE_LOCALE_H], 1, [Define if you have locale.h])],
377 if test "$USE_NLS" = "yes"; then
378 AC_MSG_ERROR([Cannot find useful locale.h, and nls support is enabled. Try compiling with --disable-nls])
382 # Set package name for translations
383 GETTEXT_PACKAGE=$PACKAGE
384 AC_SUBST(GETTEXT_PACKAGE)
386 # Checks for typedefs, structures, and compiler characteristics.
389 # Checks for library functions.
391 AC_CHECK_FUNCS(strstr getuid getgid)
393 AC_MSG_CHECKING([for optarg in unistd.h])
395 [#include <unistd.h>],
396 [ char *string = optarg; int i = optind; ],
399 AC_MSG_RESULT($optarg_found)
401 if test $optarg_found = yes; then
402 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
406 # Checks for header files end
407 #########################################################################
409 #########################################################################
412 # ------------- dmalloc -------------------
415 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
416 AC_ARG_ENABLE([dmalloc],
417 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
419 if test "X$enable_dmalloc" != "Xno" ; then
421 AC_CHECK_HEADER(dmalloc.h,,
422 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
423 AC_CHECK_LIB(dmalloc,main,,
424 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
425 DMALLOC_LIBS="-ldmalloc"
437 # ------------- ElectricFence -------------------
438 dnl ElectricFence checks
440 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
441 AC_ARG_ENABLE([efence],
442 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
444 if test "X$enable_efence" != "Xno" ; then
446 AC_CHECK_LIB(efence,main,,
447 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
458 #########################################################################
459 #########################################################################
460 # gEDA/gaf specific setup start
464 GEDADATADIR=$datadir/$DATADIR
466 if eval "test x$opt_rcdir = x"; then
467 # path was not specified with --with-rcdir
468 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
469 GEDARCDIR=$GEDADATADIR
471 # path WAS specified with --with-rcdir
472 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
473 GEDARCDIR="$opt_rcdir"
476 if test x$opt_xdgdatadir = x; then
477 # path was not specified with --with-xdgdatadir
478 XDGDATADIR='${datadir}'
480 # path WAS specified with --with-xdgdatadir
481 XDGDATADIR="$opt_xdgdatadir"
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(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
508 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
509 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
512 # gEDA/gaf specify things which need to setup
513 #########################################################################
515 # Initialized gettext
517 AM_GNU_GETTEXT_VERSION([%INSTALLED_GETTEXT_VERSION%])
519 #GETTEXT_PACKAGE=$PACKAGE
520 #AC_SUBST(GETTEXT_PACKAGE)
521 #AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"],
522 # [The domain to use with gettext])
525 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
526 GSCHEM_CFLAGS="$MINGW_CFLAGS $LIBSTROKE_CFLAGS $LIBGEDA_CFLAGS $GLIB_CFLAGS $GTK_CFLAGS $GTHREAD_CFLAGS $GUILE_CFLAGS"
527 GSCHEM_LDFLAGS="$LIBSTROKE_LIBS $LIBGEDA_LIBS $GLIB_LIBS $GTK_LIBS $DMALLOC_LIBS $GTHREAD_LIBS $GUILE_LIBS"
529 # Makefile.in variable substitution
530 AC_SUBST(DATE_VERSION)
531 AC_SUBST(DOTTED_VERSION)
532 AC_SUBST(GSCHEM_CFLAGS)
533 AC_SUBST(GSCHEM_LDFLAGS)
534 AC_SUBST(GEDADATADIR)
536 AC_SUBST(GUILEINTERP)
539 # Create all the necessary derived files
540 AC_CONFIG_FILES([Makefile
554 lib/system-gschemrc ])
559 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
560 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
561 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
562 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
565 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
567 GTK+ library version: $GTK_VERSION
568 CAIRO library version: $CAIRO_VERSION
569 GUILE library version: $GUILE_VERSION
570 libgeda library version: $LIBGEDA_VERSION
571 libstroke library: $LIBSTROKE
573 data directory: $expandedGEDADATADIR
574 rc directory: $expandedGEDARCDIR
575 xdg directory: $expandedXDGDATADIR
576 documentation directory: $expandedGEDADOCDIR
577 dmalloc debugging: $with_dmalloc
578 ElectricFence debugging: $with_efence