1 # Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/libgeda.c])
9 SHARED_LIBRARY_VERSION=34:0:0
10 echo Configuring $PACKAGE version $DOTTED_VERSION.$DATE_VERSION
13 AM_INIT_AUTOMAKE($PACKAGE, $DOTTED_VERSION, no-define)
14 AM_CONFIG_HEADER([config.h])
15 AC_SUBST([CONFIG_DEPENDENCIES], ['$(top_srcdir)/configure.ac.in'])
17 # Call this to make autoconf and friends happy
23 #########################################################################
24 # Command line flags start
27 # Change default location for rc files
28 AC_ARG_WITH(rcdir, [ --with-rcdir=path Change where the system-*rc files are installed], [opt_rcdir=$withval])
30 # Change default location for XDG files (MIME and Icons)
31 AC_ARG_WITH(xdgdatadir, [ --with-xdgdatadir=path Change where the theme icons and mime registrations are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
33 # Change default location for KDE data files (KDE MIME registrations)
34 AC_ARG_WITH(kdedatadir, [ --with-kdedatadir=path Change where the KDE mime registrations are installed [[DATADIR]]], [opt_kdedatadir=$withval])
37 # Command line flags end
38 #########################################################################
40 # Checks for libraries.
41 #########################################################################
43 # Misc win32 / mingw checks and variables start
45 # Figure out if we are building on win32 and what environment.
47 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
50 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
51 MINGW_CFLAGS="-mms-bitfields -mwindows"
60 # Misc win32 / mingw checks and variables end
61 #########################################################################
63 # Checks for programs.
65 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
69 ############################################################################
70 # Internationalisation start
73 AC_GEDA_MACRO_CHECK([AM_NLS], [nls.m4])
76 # Set package name for translations
77 so_major=`echo "$SHARED_LIBRARY_VERSION" | sed 's/:.*//'`
78 GETTEXT_PACKAGE=$PACKAGE$so_major
79 AH_TEMPLATE([GETTEXT_PACKAGE], [Name of this program's gettext domain])
80 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"])
81 AC_SUBST(GETTEXT_PACKAGE)
84 AC_GEDA_MACRO_CHECK([AM_GNU_GETTEXT], [gettext.m4])
86 AM_GNU_GETTEXT_VERSION([%INSTALLED_GETTEXT_VERSION%])
89 AC_GEDA_MACRO_CHECK([IT_PROG_INTLTOOL], [intltool.m4])
90 IT_PROG_INTLTOOL(0.35.0)
93 # Internationalisation end
94 #########################################################################
96 ############################################################################
97 # Check for pkg-config start
100 # Check for pkg-config
101 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
102 if test $PKG_CONFIG = no; then
103 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
107 # Check for pkg-config end
108 ############################################################################
110 ############################################################################
111 # Check for guile start
114 PKG_CHECK_MODULES(GUILE, guile-2.0, GUILE_PC="yes", no_GUILE_PC="yes")
116 if test "$GUILE_PC" = "yes"
118 GUILE_LDFLAGS=$GUILE_LIBS
119 GUILE_VERSION=`$PKG_CONFIG guile-2.0 --modversion`
121 # Find about the installed guile
122 AC_GEDA_MACRO_CHECK([GUILE_FLAGS], [guile.m4])
124 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
127 # Check Guile version
130 guile_need_version="$guile_need_major[].$guile_need_minor.0"
132 AC_MSG_CHECKING([Guile version >= $guile_need_version])
134 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
135 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
136 AC_MSG_RESULT($GUILE_VERSION)
138 if test "$guile_need_major" -gt "$guile_major" \
139 || (test "$guile_need_major" -eq "$guile_major" \
140 && test "$guile_need_minor" -gt "$guile_minor"); then
141 AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
144 # Guile 1.6 compatability
146 CFLAGS_temp_save="$CFLAGS"
147 CFLAGS="$CFLAGS $GUILE_CFLAGS"
153 scm_from_locale_string,
154 scm_from_locale_symbol,
160 scm_to_locale_string],,,
161 [#include <libguile.h>])
162 CFLAGS="$CFLAGS_temp_save"
165 # Check for guile end
166 ############################################################################
168 ############################################################################
169 # Check for mics things start
171 # Checking for rint in math library
172 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
174 # An implementation of libuuid lives in e2fsprogs, of all places!
175 # FIXME: There are several hostilely incompatible uuid libraries. Rather just
176 # use libaprutil to hide the porting complexity.
177 AC_CHECK_LIB(uuid, uuid_generate,
178 UUID_LDFLAGS="-luuid"
179 AC_DEFINE(HAVE_LIBUUID, 1, [Define to 1 if you have libuuid]),
182 # Checking for dynamic lib
183 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
185 # Check for mics things end
186 ############################################################################
188 ############################################################################
189 # Check for X11 start
192 if test "$MINGW" = "no"
197 X_EXTRA_LIBS="$X_EXTRA_LIBS"
198 X_LDFLAGS="$X_LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11 -lm"
203 ############################################################################
205 ############################################################################
206 # Check for glib 2.4 start
210 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
211 if test "$GLIB24" != "yes"
213 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.
214 You may find the following error output (if any) useful:
218 GLIB_CFLAGS=$GLIB24_CFLAGS
219 GLIB_LIBS=$GLIB24_LIBS
220 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
223 # Check for glib 2.4 end
224 ############################################################################
226 ############################################################################
227 # Check for gdk 2.4 or later
230 PKG_CHECK_MODULES(GDK, gdk-2.0 >= 2.4.0, GDK="yes", no_GDK="yes")
232 # This next bit of code figures out what gtk we need to use.
233 if test "$GDK" = "yes"
236 AC_DEFINE(HAS_GDK, 1, [If gdk has been installed, define this])
237 GDK_CFLAGS=$GDK_CFLAGS
239 GDK_VERSION=`$PKG_CONFIG gdk-2.0 --modversion`
243 if test "$GDK_VERSION" = ""
245 AC_MSG_ERROR([Cannot find gdk, please make sure it is installed.])
250 ############################################################################
252 ############################################################################
253 # Check for gdk-pixbuf
256 PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0 >= 0.15.0, GDK_PIXBUF="yes", no_GDK_PIXBUF="yes")
258 # This next bit of code figures out what gtk we need to use.
259 if test "$GDK_PIXBUF" = "yes"
262 AC_DEFINE(HAS_GDK_PIXBUF, 1, [If gdk-pixbuf has been installed, define this])
263 GDK_PIXBUF_CFLAGS=$GDK_PIXBUF_CFLAGS
264 GDK_PIXBUF_LIBS=$GDK_PIXBUF_LIBS
265 GDK_PIXBUF_VERSION=`$PKG_CONFIG gdk-pixbuf-2.0 --modversion`
269 if test "$GDK_PIXBUF_VERSION" = ""
271 AC_MSG_ERROR([Cannot find gdk-pixbuf, please make sure it is installed.])
275 # Check for gdk-pixbuf end
276 ############################################################################
280 ############################################################################
281 # Check for doxygen start
284 # Doxygen is a utility for generating html and latex documentation
285 # from c source code files.
288 AC_PATH_PROG(DOXYGEN, doxygen, no, ${PATH})
290 if test "$DOXYGEN" = "no"; then
291 # doxygen is not available on the system
292 echo "** Cannot find Doxygen! **"
293 echo "** Documentation creation disabled **"
296 # prevent from creating html and latex documents.
297 # but does not prevent from processing gschemdoc
300 # doxygen is available on the system.
301 # now checking if the tools for Texinfo files processing
303 # The docs can be either processed to produce dvi, html or info
304 # with texi2dvi, texi2html or makeinfo respectively
305 # Note : these tests on makeinfo and texi2dvi are no more
306 # needed as automake makes them for us
308 # enable the creation of html and latex documents.
312 # depending on variable builddoc, weaving is performed or not
313 # using conditionnal in docs/Makefile.in
314 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
317 # Check for doxygen end
318 #########################################################################
320 #########################################################################
321 # Checks for header files start
327 AC_CHECK_HEADERS(unistd.h string.h stdlib.h stdarg.h assert.h fcntl.h \
330 AC_MSG_CHECKING([for optarg in unistd.h])
332 [#include <unistd.h>],
333 [ char *string = optarg; int i = optind; ],
336 AC_MSG_RESULT($optarg_found)
337 if test $optarg_found = yes; then
338 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
341 # Checks for typedefs, structures, and compiler characteristics.
344 # Checks for library functions.
346 AC_CHECK_FUNCS(strstr chown getlogin)
348 CFLAGS="$GLIB_CFLAGS $CFLAGS"
349 AC_CHECK_DECLS([g_date_time_format],,,[#include <glib.h>])
353 # Checks for header files end
354 #########################################################################
356 #########################################################################
359 # ------------- dmalloc -------------------
362 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
363 AC_ARG_ENABLE([dmalloc],
364 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
366 if test "X$enable_dmalloc" != "Xno" ; then
368 AC_CHECK_HEADER(dmalloc.h,,
369 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
370 AC_CHECK_LIB(dmalloc,main,,
371 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
372 DMALLOC_LIBS="-ldmalloc"
384 # ------------- ElectricFence -------------------
385 dnl ElectricFence checks
387 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
388 AC_ARG_ENABLE([efence],
389 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
391 if test "X$enable_efence" != "Xno" ; then
393 AC_CHECK_LIB(efence,main,,
394 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
405 #########################################################################
407 #########################################################################
408 # gEDA/gaf specific setup start
412 GEDADATADIR=$datadir/$DATADIR
414 if eval "test x$opt_rcdir = x"; then
415 # path was not specified with --with-rcdir
416 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
417 GEDARCDIR=$GEDADATADIR
419 # path WAS specified with --with-rcdir
420 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
421 GEDARCDIR="$opt_rcdir"
424 if test x$opt_xdgdatadir = x; then
425 # path was not specified with --with-xdgdatadir
426 XDGDATADIR='${datadir}'
428 # path WAS specified with --with-xdgdatadir
429 XDGDATADIR="$opt_xdgdatadir"
433 if test x$opt_kdedatadir = x; then
434 # path was not specified with --with-kdedatadir
435 KDEDATADIR='${datadir}'
437 # path WAS specified with --with-kdedatadir
438 KDEDATADIR="$opt_kdedatadir"
442 # Defs for libary symbol files
444 # Expand the prefix variable
445 if eval "test x$prefix = xNONE"; then
446 dprefix=$ac_default_prefix
451 gedatopdir=$dprefix/share/$DATADIR
452 expandgedadatadir=`echo $gedatopdir`
454 # this has to be expanded ( no ${prefix} ) --
455 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
456 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
457 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
458 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
461 # gEDA/gaf specify things which need to setup
462 #########################################################################
464 #########################################################################
465 # Update mime database utility start
467 # Adapted from gnome-control-center.
470 AC_ARG_ENABLE(update-mime-database,
471 AC_HELP_STRING([--disable-update-mime-database],
472 [do not update mime database after installation]),,
473 enable_update_mime_database=yes)
475 AM_CONDITIONAL(ENABLE_UPDATE_MIME_DATABASE,
476 test x$enable_update_mime_database = xyes)
478 if test x$enable_update_mime_database = xyes ; then
479 AC_PATH_PROG(UPDATE_MIME_DATABASE, [update-mime-database], no)
480 if test $UPDATE_MIME_DATABASE = no; then
481 AC_MSG_ERROR([Cannot find update-mime-database, make sure it is installed and in your PATH, or configure with --disable-update-mime-database])
486 # Update mime database utility end
487 #########################################################################
489 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
490 LIBGEDA_CFLAGS="$MINGW_CFLAGS $GUILE_CFLAGS $GLIB_CFLAGS $X_CFLAGS $GDK_PIXBUF_CFLAGS $GDK_CFLAGS"
491 LIBGEDA_LDFLAGS="$GUILE_LDFLAGS $GLIB_LIBS $DMALLOC_LIBS $GDK_PIXBUF_LIBS $GDK_LIBS $UUID_LDFLAGS"
492 LIBTOOL_FLAGS="-version-info $SHARED_LIBRARY_VERSION"
494 # Makefile.in variable substitution
495 AC_SUBST(DATE_VERSION)
496 AC_SUBST(DOTTED_VERSION)
497 AC_SUBST(LIBGEDA_CFLAGS)
498 AC_SUBST(LIBGEDA_LDFLAGS)
499 AC_SUBST(LIBTOOL_FLAGS)
500 AC_SUBST(GEDADATADIR)
503 AC_SUBST(OTHERPATHSEP)
504 AC_SUBST(GUILEINTERP)
507 # Create all the necessary derived files
508 AC_CONFIG_FILES([Makefile
524 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
525 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
526 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
527 expandedKDEDATADIR=`eval "echo $KDEDATADIR"`
530 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION
532 GLIB library version: $GLIB_VERSION
533 GDK library version: $GDK_VERSION
534 GDK-PIXBUF (png output): $GDK_PIXBUF_VERSION
535 GUILE library version: $GUILE_VERSION
537 data directory: $expandedGEDADATADIR
538 rc directory: $expandedGEDARCDIR
539 xdg data directory: $expandedXDGDATADIR
540 KDE data directory: $expandedKDEDATADIR
541 LIBGEDA .so version: $SHARED_LIBRARY_VERSION
542 dmalloc debugging: $with_dmalloc
543 ElectricFence debugging: $with_efence