1 # Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/gattrib.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])
15 # Create option to debug
17 [ --enable-debug Sets the DEBUG flag which causes lots of debug spew to be generated],
18 [ AC_DEFINE(DEBUG, 1, DEBUG) ]
22 #########################################################################
23 # Command line flags start
25 # Change default location for rc files
26 AC_ARG_WITH(rcdir, [ --with-rcdir=path Change where the system-*rc files are installed], [opt_rcdir=$withval])
28 # Change default location for XDG files (.desktop and icons)
29 AC_ARG_WITH(xdgdatadir, [ --with-xdgdatadir=path Change where the .desktop file and theme icons are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
32 # Command line flags end
33 #########################################################################
35 # Checks for programs.
37 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
39 AC_PATH_PROGS(AWK, nawk gawk mawk awk, )
40 IT_PROG_INTLTOOL(0.35.0)
42 ############################################################################
43 # Update desktop database utility start
46 AC_ARG_ENABLE(update-desktop-database,
47 AC_HELP_STRING([--disable-update-desktop-database],
48 [do not update desktop file database after installation]),,
49 enable_update_desktop_database=yes)
51 AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE,
52 test x$enable_update_desktop_database = xyes)
54 if test x$enable_update_desktop_database = xyes ; then
55 AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
56 if test $UPDATE_DESKTOP_DATABASE = no; then
57 AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
62 # Update desktop database utility end
63 ############################################################################
68 # Set package name for translations
69 GETTEXT_PACKAGE=$PACKAGE
70 AC_SUBST(GETTEXT_PACKAGE)
72 # Check pre-requsites for the PO dir.
73 # (Needed without explicitly initialising gettext)
76 #########################################################################
78 # Misc win32 / mingw checks and variables start
79 # Win32 stuff currently unsupported by SDB.
82 # Figure out if we are building on win32 and what environment.
84 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
87 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
95 # Misc win32 / mingw checks and variables end
96 #########################################################################
98 ############################################################################
99 # Check for guile start
101 # Check for pkg-config
102 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
103 if test $PKG_CONFIG = no; then
104 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
107 PKG_CHECK_MODULES(GUILE, guile-1.8, GUILE_PC="yes", no_GUILE_PC="yes")
109 if test "$GUILE_PC" = "yes"
112 GUILE_VERSION=`$PKG_CONFIG guile-1.8 --modversion`
116 # Find about the installed guile
118 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
122 # Check Guile version
125 guile_need_version="$guile_need_major[].$guile_need_minor.0"
127 AC_MSG_CHECKING([Guile version >= $guile_need_version])
129 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
130 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
131 AC_MSG_RESULT($GUILE_VERSION)
133 if test "$guile_need_major" -gt "$guile_major" \
134 || (test "$guile_need_major" -eq "$guile_major" \
135 && test "$guile_need_minor" -gt "$guile_minor"); then
136 AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
139 # Guile 1.6 compatability
141 CFLAGS_temp_save="$CFLAGS"
142 CFLAGS="$CFLAGS $GUILE_CFLAGS"
143 AC_CHECK_DECLS([scm_is_string, scm_is_integer, scm_to_int,
144 scm_from_int, scm_is_true, scm_is_false,
145 scm_from_locale_string, scm_to_locale_string],,,
146 [#include <libguile.h>])
147 CFLAGS="$CFLAGS_temp_save"
149 AH_VERBATIM(SCM_IS_STRING, [#if !HAVE_DECL_SCM_IS_STRING
150 # define scm_is_string(x) SCM_STRINGP(x)
152 AH_VERBATIM(SCM_IS_INTEGER, [#if !HAVE_DECL_SCM_IS_INTEGER
153 # define scm_is_integer(x) SCM_INUMP(x)
155 AH_VERBATIM(SCM_TO_INT, [#if !HAVE_DECL_SCM_TO_INT
156 # define scm_to_int(x) SCM_INUM(x)
158 AH_VERBATIM(SCM_FROM_INT, [#if !HAVE_DECL_SCM_FROM_INT
159 # define scm_from_int(x) SCM_MAKINUM(x)
161 AH_VERBATIM(SCM_IS_TRUE, [#if !HAVE_DECL_SCM_IS_TRUE
162 # define scm_is_true(x) SCM_NFALSEP(x)
164 AH_VERBATIM(SCM_IS_FALSE, [#if !HAVE_DECL_SCM_IS_FALSE
165 # define scm_is_false(x) SCM_FALSEP(x)
167 AH_VERBATIM(SCM_FROM_LOCALE_STRING, [#if !HAVE_DECL_SCM_FROM_LOCALE_STRING
168 # define scm_from_locale_string(x) scm_makfrom0str(x)
170 AH_VERBATIM(SCM_TO_LOCALE_STRING, [#if !HAVE_DECL_SCM_TO_LOCALE_STRING
171 # define scm_to_locale_string(x) strdup(SCM_STRING_CHARS(x))
175 # Check for guile end
176 ############################################################################
178 ############################################################################
179 # Check for misc things. . . .
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 ############################################################################
190 ############################################################################
191 ## This is looks for GTK2.4.
193 # Search for gtk+ 2.4.x
194 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
196 # This next bit of code figures out what gtk we need to use.
197 if test "$GTK24" = "yes"
200 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
201 GTK_CFLAGS=$GTK24_CFLAGS
203 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
206 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
207 if test "$GLIB24" != "yes"
209 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
211 GLIB_CFLAGS=$GLIB24_CFLAGS
212 GLIB_LIBS=$GLIB24_LIBS
213 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
215 ## GTKITEMENTRY_SOURCE=gtkitementry_2_2.c gtkitementry_2_2.h
218 PKG_CHECK_MODULES(GTHREAD, gthread-2.0, GTHREAD="yes", no_GTHREAD="yes")
219 if test "$GTHREAD" = "yes"
221 AC_DEFINE(HAVE_GTHREAD, 1, [If gthread support is installed, define this])
229 if test "$GTK_VERSION" = ""
231 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
234 ## These tell Makefile.am which package to compile
235 AM_CONDITIONAL(GTK24_SOURCE, test "$GLIB24" = "yes")
238 # Check for gtk+ 2.4 end
239 ############################################################################
242 ############################################################################
243 # Check for libgeda start
245 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes",
248 if test "$LIBGEDA" = "yes"
250 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
252 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
256 # Check for libgeda end
257 ############################################################################
259 ############################################################################
260 # Check for doxygen start
263 # Doxygen is a utility for generating html and latex documentation
264 # from c source code files.
267 AC_PATH_PROG(DOXYGEN, doxygen, no, ${PATH})
269 if test "$DOXYGEN" = "no"; then
270 # doxygen is not available on the system
271 echo "** Cannot find Doxygen! **"
272 echo "** Documentation creation disabled **"
275 # prevent from creating html and latex documents.
276 # but does not prevent from processing gschemdoc
279 # doxygen is available on the system.
280 # now checking if the tools for Texinfo files processing
282 # The docs can be either processed to produce dvi, html or info
283 # with texi2dvi, texi2html or makeinfo respectively
284 # Note : these tests on makeinfo and texi2dvi are no more
285 # needed as automake makes them for us
287 # enable the creation of html and latex documents.
291 # depending on variable builddoc, weaving is performed or not
292 # using conditionnal in docs/Makefile.in
293 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
296 # Check for doxygen end
297 #########################################################################
300 #########################################################################
301 # Checks for header files start
306 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
307 stdarg.h assert.h fcntl.h errno.h \
308 dirent.h sys/param.h getopt.h)
310 # Checks for typedefs, structures, and compiler characteristics.
313 # Checks for library functions.
315 AC_CHECK_FUNCS(getopt_long)
318 AC_MSG_CHECKING([for optarg in unistd.h])
320 [#include <unistd.h>],
321 [ char *string = optarg; int i = optind; ],
324 AC_MSG_RESULT($optarg_found)
326 if test $optarg_found = yes; then
327 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
331 # Checks for header files end
332 #########################################################################
334 #########################################################################
337 # ------------- dmalloc -------------------
340 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
341 AC_ARG_ENABLE([dmalloc],
342 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
344 if test "X$enable_dmalloc" != "Xno" ; then
346 AC_CHECK_HEADER(dmalloc.h,,
347 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
348 AC_CHECK_LIB(dmalloc,main,,
349 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
350 DMALLOC_LIBS="-ldmalloc"
362 # ------------- ElectricFence -------------------
363 dnl ElectricFence checks
365 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
366 AC_ARG_ENABLE([efence],
367 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
369 if test "X$enable_efence" != "Xno" ; then
371 if test "X$with_dmalloc" = "Xyes" ; then
372 AC_ERROR([You have requested both dmalloc and Electric Fence, however only 1 is allowed.])
374 AC_CHECK_LIB(efence,main,,
375 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
386 #########################################################################
388 #########################################################################
389 # gEDA/gaf specify setup start
393 GEDADATADIR=$datadir/$DATADIR
395 if eval "test x$opt_rcdir = x"; then
396 # path not was specified with --with-rcdir
397 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
398 GEDARCDIR=$GEDADATADIR
400 # path WAS specified with --with-rcdir
401 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
402 GEDARCDIR="$opt_rcdir"
405 if test x$opt_xdgdatadir = x; then
406 # path was not specified with --with-xdgdatadir
407 XDGDATADIR='${datadir}'
409 # path WAS specified with --with-xdgdatadir
410 XDGDATADIR="$opt_xdgdatadir"
414 # Expand the prefix variable
415 # I don't like the way this is done, but it works (I hope).
416 if eval "test x$prefix = xNONE"; then
417 dprefix=$ac_default_prefix
422 gedatopdir=$dprefix/share/$DATADIR
423 expandgedadatadir=`echo $gedatopdir`
425 # this has to be expanded ( no ${prefix} ) --
426 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
427 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
428 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
429 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
432 # gEDA/gaf specify things which need to setup
433 #########################################################################
435 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
436 GATTRIB_CFLAGS="$GTK_CFLAGS $GLIB_CFLAGS $LIBGEDA_CFLAGS $GTHREAD_CFLAGS"
437 GATTRIB_LDFLAGS="$GTK_LIBS $GLIB_LIBS $LIBGEDA_LIBS $GTHREAD_LIBS"
439 # Makefile.in variable substitution
440 AC_SUBST(DATE_VERSION)
441 AC_SUBST(DOTTED_VERSION)
442 AC_SUBST(GATTRIB_CFLAGS)
443 AC_SUBST(GATTRIB_LDFLAGS)
445 AC_SUBST(GEDADATADIR)
447 # Create all the necessary derived files
448 AC_CONFIG_FILES([Makefile
462 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
463 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
464 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
467 ***** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION *****
469 == libgeda library version: $LIBGEDA_VERSION
470 == data directory: $expandedGEDADATADIR
471 == rc directory: $expandedGEDARCDIR
472 == xdg directory: $expandedXDGDATADIR
473 == compiler flags: $GATTRIB_CFLAGS
474 == linker flags: $GATTRIB_LDFLAGS
475 == glib compiler flags: $GLIB_CFLAGS
476 == glib linker libs: $GLIB_LIBS
477 == glib library version: $GLIB_VERSION
478 == gtk compiler flags: $GTK_CFLAGS
479 == gtk linker libs: $GTK_LIBS
480 == gtk library version: $GTK_VERSION
481 == dmalloc debugging: $with_dmalloc
482 == Electric Fence debugging: $with_efence
484 ************************************************************