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
59 # Misc win32 / mingw checks and variables end
60 #########################################################################
62 # Checks for programs.
64 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
67 IT_PROG_INTLTOOL(0.35.0)
69 ############################################################################
70 # Update desktop database utility start
73 AC_ARG_ENABLE(update-desktop-database,
74 AC_HELP_STRING([--disable-update-desktop-database],
75 [do not update desktop file database after installation]),,
76 enable_update_desktop_database=yes)
78 AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE,
79 test x$enable_update_desktop_database = xyes)
81 if test x$enable_update_desktop_database = xyes ; then
82 AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
83 if test $UPDATE_DESKTOP_DATABASE = no; then
84 AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
89 # Update desktop database utility end
90 ############################################################################
92 ############################################################################
93 # Check for guile start
99 guile_need_version="$guile_need_major[].$guile_need_minor.0"
101 AC_MSG_CHECKING([Guile version >= $guile_need_version])
102 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
104 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
105 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
106 AC_MSG_RESULT($GUILE_VERSION)
108 if test "$guile_need_major" -gt "$guile_major" \
109 || (test "$guile_need_major" -eq "$guile_major" \
110 && test "$guile_need_minor" -gt "$guile_minor"); then
111 AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
114 # Guile 1.6 compatability
116 CFLAGS_temp_save="$CFLAGS"
117 CFLAGS="$CFLAGS $GUILE_CFLAGS"
118 AC_CHECK_DECLS([scm_is_string, scm_is_integer, scm_to_int,
119 scm_from_int, scm_is_true, scm_is_false,
120 scm_from_locale_string, scm_to_locale_string],,,
121 [#include <libguile.h>])
122 CFLAGS="$CFLAGS_temp_save"
124 AH_VERBATIM(SCM_IS_STRING, [#if !HAVE_DECL_SCM_IS_STRING
125 # define scm_is_string(x) SCM_STRINGP(x)
127 AH_VERBATIM(SCM_IS_INTEGER, [#if !HAVE_DECL_SCM_IS_INTEGER
128 # define scm_is_integer(x) SCM_INUMP(x)
130 AH_VERBATIM(SCM_TO_INT, [#if !HAVE_DECL_SCM_TO_INT
131 # define scm_to_int(x) SCM_INUM(x)
133 AH_VERBATIM(SCM_FROM_INT, [#if !HAVE_DECL_SCM_FROM_INT
134 # define scm_from_int(x) SCM_MAKINUM(x)
136 AH_VERBATIM(SCM_IS_TRUE, [#if !HAVE_DECL_SCM_IS_TRUE
137 # define scm_is_true(x) SCM_NFALSEP(x)
139 AH_VERBATIM(SCM_IS_FALSE, [#if !HAVE_DECL_SCM_IS_FALSE
140 # define scm_is_false(x) SCM_FALSEP(x)
142 AH_VERBATIM(SCM_FROM_LOCALE_STRING, [#if !HAVE_DECL_SCM_FROM_LOCALE_STRING
143 # define scm_from_locale_string(x) scm_makfrom0str(x)
145 AH_VERBATIM(SCM_TO_LOCALE_STRING, [#if !HAVE_DECL_SCM_TO_LOCALE_STRING
146 # define scm_to_locale_string(x) strdup(SCM_STRING_CHARS(x))
150 # Check for guile end
151 ############################################################################
153 ############################################################################
154 # Check for mics things start
156 # Checking for rint in math library
157 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
159 # Checking for dynamic lib
160 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
162 # Check for mics things start
163 ############################################################################
165 ############################################################################
166 # Check for X11 start
169 if test "$MINGW" = "no"
174 X_EXTRA_LIBS="$X_EXTRA_LIBS"
175 X_LDFLAGS="$X_LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11 -lm"
178 AC_MSG_CHECKING([if hardcoding of the X11 runtime library path is desired])
179 AC_ARG_ENABLE([rpath],
180 [ --enable-rpath Enable hardcoding the X11 runtime library path [default=disabled]],
182 if test "X$enable_rpath" = "Xno" ; then
195 if test "X$_use_rpath" = "Xyes" ; then
196 # Try to figure out if we need -Rpath for finding X11 libs
197 # at runtime. Why autoconf doesn't already do this, I don't
200 for p in $X_LDFLAGS ; do
203 xlib_path="$xlib_path $p"
209 LIBS="$LIBS $X_LDFLAGS"
211 for fl in "-Wl,-rpath " "-Wl,--rpath " "-rpath " "--rpath " "-Wl,-R" "-R" "-R " ; do
212 xlib_rpath=`echo $xlib_path | sed "s/-L/$fl/g"`
213 LIBS="$_save_LIBS $X_LIBS $xlib_rpath"
214 AC_MSG_CHECKING([if the compiler accepts ${fl}path for runtime libraries])
215 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
219 test -n "$rpath" && break
221 if test -n "$rpath"; then
222 X_LDFLAGS="$X_LDFLAGS $xlib_rpath"
231 ############################################################################
233 ############################################################################
234 # Check for gtk+ 2.4 start
237 # Check for pkg-config
238 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
239 if test $PKG_CONFIG = no; then
240 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
243 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
245 # This next bit of code figures out what gtk we need to use.
246 if test "$GTK24" = "yes"
249 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
250 GTK_CFLAGS=$GTK24_CFLAGS
252 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
255 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
256 if test "$GLIB24" != "yes"
258 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
260 GLIB_CFLAGS=$GLIB24_CFLAGS
261 GLIB_LIBS=$GLIB24_LIBS
262 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
265 PKG_CHECK_MODULES(GTHREAD, gthread-2.0, GTHREAD="yes", no_GTHREAD="yes")
266 if test "$GTHREAD" = "yes"
268 AC_DEFINE(HAVE_GTHREAD, 1, [If gthread support is installed, define this])
275 if test "$GTK_VERSION" = ""
277 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
281 # Check for gtk+ 2.4 end
282 ############################################################################
284 ############################################################################
285 # Check for libgeda start
287 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes",
290 if test "$LIBGEDA" = "yes"
292 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
294 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
298 # Check for libgeda end
299 ############################################################################
301 ############################################################################
302 # Check for libstroke start
305 # user specified --with-stroke
306 if eval "test x$opt_stroke != x"; then
307 LIBSTROKE_LIBS="-L$opt_stroke/lib"
308 LIBSTROKE_CFLAGS="-I$opt_stroke/include"
311 # only check if the user has not disable strokes
312 if test "$no_stroke" != "yes"; then
313 save_cppflags="$CPPFLAGS"
314 save_ldflags="$LDFLAGS"
315 CPPFLAGS="$CPPFLAGS $LIBSTROKE_CFLAGS"
316 LDFLAGS="$LDFLAGS $LIBSTROKE_LIBS"
317 AC_CHECK_LIB(stroke, stroke_init, LIBSTROKE="yes", LIBSTROKE="no")
318 CPPFLAGS="$save_cppflags"
319 LDFLAGS="$save_ldflags"
322 if test "$LIBSTROKE" = "yes"; then
323 AC_DEFINE(HAS_LIBSTROKE, 1, [Define if you have libstroke installed])
324 if eval "test x$opt_stroke = x"; then
325 LIBSTROKE_LIBS="-lstroke"
328 LIBSTROKE_LIBS="$LIBSTROKE_LIBS -lstroke"
329 # LIBSTROKE_CFLAGS set above
333 if test "$no_stroke" = "yes"; then
335 echo "** Disabling libstroke by request **"
343 # Check for libstroke end
344 ############################################################################
346 ############################################################################
347 # Check for doxygen start
349 # Doxygen is a utility for generating html and latex documentation
350 # from c source code files.
353 AC_PATH_PROG(DOXYGEN, doxygen, no, ${PATH})
355 if test "$DOXYGEN" = "no"; then
356 # doxygen is not available on the system
357 echo "** Cannot find Doxygen! **"
358 echo "** Documentation creation disabled **"
361 # prevent from weaving the nw files
362 # but does not prevent from processing gschemdoc
365 # doxygen is available on the system.
366 # now checking if the tools for Texinfo files processing
368 # The docs can be either processed to produce dvi, html or info
369 # with texi2dvi, texi2html or makeinfo respectively
370 # Note : these tests on makeinfo and texi2dvi are no more
371 # needed as automake makes them for us
373 # enable the creation of html and latex documents.
377 # depending on variable builddoc, weaving is performed or not
378 # using conditionnal in docs/Makefile.in
379 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
382 # Check for doxygen end
383 #########################################################################
385 #########################################################################
386 # Check for groff start
390 AC_PATH_PROG(GROFF, groff, no, ${PATH})
391 if test $GROFF = "no"; then
392 echo "Cannot find groff, some documentation will not be created."
396 # Check for groff end
397 #########################################################################
399 #########################################################################
400 # Checks for header files start
405 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
406 stdarg.h assert.h fcntl.h errno.h sys/param.h)
412 AC_CHECK_HEADER([locale.h],
413 [AC_DEFINE([HAVE_LOCALE_H], 1, [Define if you have locale.h])],
415 if test "$USE_NLS" = "yes"; then
416 AC_MSG_ERROR([Cannot find useful locale.h, and nls support is enabled. Try compiling with --disable-nls])
420 # Set package name for translations
421 GETTEXT_PACKAGE=$PACKAGE
422 AC_SUBST(GETTEXT_PACKAGE)
424 # Checks for typedefs, structures, and compiler characteristics.
427 # Checks for library functions.
429 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf getuid getgid)
431 AC_MSG_CHECKING([for optarg in unistd.h])
433 [#include <unistd.h>],
434 [ char *string = optarg; int i = optind; ],
437 AC_MSG_RESULT($optarg_found)
439 if test $optarg_found = yes; then
440 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
444 # Checks for header files end
445 #########################################################################
447 #########################################################################
450 # ------------- dmalloc -------------------
453 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
454 AC_ARG_ENABLE([dmalloc],
455 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
457 if test "X$enable_dmalloc" != "Xno" ; then
459 AC_CHECK_HEADER(dmalloc.h,,
460 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
461 AC_CHECK_LIB(dmalloc,main,,
462 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
463 DMALLOC_LIBS="-ldmalloc"
475 # ------------- ElectricFence -------------------
476 dnl ElectricFence checks
478 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
479 AC_ARG_ENABLE([efence],
480 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
482 if test "X$enable_efence" != "Xno" ; then
484 AC_CHECK_LIB(efence,main,,
485 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
496 #########################################################################
497 #########################################################################
498 # gEDA/gaf specific setup start
502 GEDADATADIR=$datadir/$DATADIR
504 if eval "test x$opt_rcdir = x"; then
505 # path was not specified with --with-rcdir
506 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
507 GEDARCDIR=$GEDADATADIR
509 # path WAS specified with --with-rcdir
510 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
511 GEDARCDIR="$opt_rcdir"
514 if test x$opt_xdgdatadir = x; then
515 # path was not specified with --with-xdgdatadir
516 XDGDATADIR='${datadir}'
518 # path WAS specified with --with-xdgdatadir
519 XDGDATADIR="$opt_xdgdatadir"
523 # Expand the prefix variable
524 # I don't like the way this is done, but it works (I hope).
525 if eval "test x$prefix = xNONE"; then
526 dprefix=$ac_default_prefix
531 gedatopdir=$dprefix/share/$DATADIR
532 expandgedadatadir=`echo $gedatopdir`
534 gedadocdir=$dprefix/share/doc/geda-doc
535 # --with-docdir : tells where to store documentation if not default
537 [ --with-docdir Where to store documentation if not default.],
539 expandgedadocdir=`echo $gedadocdir`
540 GEDADOCDIR=$expandgedadocdir
543 # this has to be expanded ( no ${prefix} ) --
544 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
545 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
546 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
547 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
550 # gEDA/gaf specify things which need to setup
551 #########################################################################
553 # Initialized gettext
555 AM_GNU_GETTEXT_VERSION([%INSTALLED_GETTEXT_VERSION%])
557 #GETTEXT_PACKAGE=$PACKAGE
558 #AC_SUBST(GETTEXT_PACKAGE)
559 #AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"],
560 # [The domain to use with gettext])
563 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
564 GSCHEM_CFLAGS="$LIBSTROKE_CFLAGS $LIBGEDA_CFLAGS $GTHREAD_CFLAGS"
565 GSCHEM_LDFLAGS="$LIBSTROKE_LIBS $LIBGEDA_LIBS $GTK_LIBS $X_LDFLAGS $DMALLOC_LIBS $GTHREAD_LIBS"
567 # Makefile.in variable substitution
568 AC_SUBST(DATE_VERSION)
569 AC_SUBST(DOTTED_VERSION)
570 AC_SUBST(GSCHEM_CFLAGS)
571 AC_SUBST(GSCHEM_LDFLAGS)
572 AC_SUBST(GEDADATADIR)
574 AC_SUBST(GUILEINTERP)
577 # Create all the necessary derived files
578 AC_CONFIG_FILES([Makefile
593 lib/system-gschemrc ])
598 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
599 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
600 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
601 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
604 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
606 GTK+ library version: $GTK_VERSION
607 GUILE library version: $GUILE_VERSION
608 libgeda library version: $LIBGEDA_VERSION
609 libstroke library: $LIBSTROKE
611 data directory: $expandedGEDADATADIR
612 rc directory: $expandedGEDARCDIR
613 xdg directory: $expandedXDGDATADIR
614 documentation directory: $expandedGEDADOCDIR
615 dmalloc debugging: $with_dmalloc
616 ElectricFence debugging: $with_efence