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
102 # Check Guile version
105 guile_need_version="$guile_need_major[].$guile_need_minor.0"
107 AC_MSG_CHECKING([Guile version >= $guile_need_version])
108 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
110 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
111 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
112 AC_MSG_RESULT($GUILE_VERSION)
114 if test "$guile_need_major" -gt "$guile_major" \
115 || (test "$guile_need_major" -eq "$guile_major" \
116 && test "$guile_need_minor" -gt "$guile_minor"); then
117 AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
120 # Guile 1.6 compatability
122 CFLAGS_temp_save="$CFLAGS"
123 CFLAGS="$CFLAGS $GUILE_CFLAGS"
124 AC_CHECK_DECLS([scm_is_string, scm_is_integer, scm_to_int,
125 scm_from_int, scm_is_true, scm_is_false,
126 scm_from_locale_string, scm_to_locale_string],,,
127 [#include <libguile.h>])
128 CFLAGS="$CFLAGS_temp_save"
130 AH_VERBATIM(SCM_IS_STRING, [#if !HAVE_DECL_SCM_IS_STRING
131 # define scm_is_string(x) SCM_STRINGP(x)
133 AH_VERBATIM(SCM_IS_INTEGER, [#if !HAVE_DECL_SCM_IS_INTEGER
134 # define scm_is_integer(x) SCM_INUMP(x)
136 AH_VERBATIM(SCM_TO_INT, [#if !HAVE_DECL_SCM_TO_INT
137 # define scm_to_int(x) SCM_INUM(x)
139 AH_VERBATIM(SCM_FROM_INT, [#if !HAVE_DECL_SCM_FROM_INT
140 # define scm_from_int(x) SCM_MAKINUM(x)
142 AH_VERBATIM(SCM_IS_TRUE, [#if !HAVE_DECL_SCM_IS_TRUE
143 # define scm_is_true(x) SCM_NFALSEP(x)
145 AH_VERBATIM(SCM_IS_FALSE, [#if !HAVE_DECL_SCM_IS_FALSE
146 # define scm_is_false(x) SCM_FALSEP(x)
148 AH_VERBATIM(SCM_FROM_LOCALE_STRING, [#if !HAVE_DECL_SCM_FROM_LOCALE_STRING
149 # define scm_from_locale_string(x) scm_makfrom0str(x)
151 AH_VERBATIM(SCM_TO_LOCALE_STRING, [#if !HAVE_DECL_SCM_TO_LOCALE_STRING
152 # define scm_to_locale_string(x) strdup(SCM_STRING_CHARS(x))
156 # Check for guile end
157 ############################################################################
159 ############################################################################
160 # Check for misc things. . . .
162 # Checking for rint in math library
163 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
165 # Checking for dynamic lib
166 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
168 ############################################################################
171 ############################################################################
172 ## This is looks for GTK2.4.
174 # Check for pkg-config
175 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
176 if test $PKG_CONFIG = no; then
177 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
180 # Search for gtk+ 2.4.x
181 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
183 # This next bit of code figures out what gtk we need to use.
184 if test "$GTK24" = "yes"
187 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
188 GTK_CFLAGS=$GTK24_CFLAGS
190 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
193 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
194 if test "$GLIB24" != "yes"
196 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
198 GLIB_CFLAGS=$GLIB24_CFLAGS
199 GLIB_LIBS=$GLIB24_LIBS
200 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
202 ## GTKITEMENTRY_SOURCE=gtkitementry_2_2.c gtkitementry_2_2.h
205 PKG_CHECK_MODULES(GTHREAD, gthread-2.0, GTHREAD="yes", no_GTHREAD="yes")
206 if test "$GTHREAD" = "yes"
208 AC_DEFINE(HAVE_GTHREAD, 1, [If gthread support is installed, define this])
216 if test "$GTK_VERSION" = ""
218 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
221 ## These tell Makefile.am which package to compile
222 AM_CONDITIONAL(GTK24_SOURCE, test "$GLIB24" = "yes")
225 # Check for gtk+ 2.4 end
226 ############################################################################
229 ############################################################################
230 # Check for libgeda start
232 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes",
235 if test "$LIBGEDA" = "yes"
237 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
239 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
243 # Check for libgeda end
244 ############################################################################
246 ############################################################################
247 # Check for doxygen start
250 # Doxygen is a utility for generating html and latex documentation
251 # from c source code files.
254 AC_PATH_PROG(DOXYGEN, doxygen, no, ${PATH})
256 if test "$DOXYGEN" = "no"; then
257 # doxygen is not available on the system
258 echo "** Cannot find Doxygen! **"
259 echo "** Documentation creation disabled **"
262 # prevent from creating html and latex documents.
263 # but does not prevent from processing gschemdoc
266 # doxygen is available on the system.
267 # now checking if the tools for Texinfo files processing
269 # The docs can be either processed to produce dvi, html or info
270 # with texi2dvi, texi2html or makeinfo respectively
271 # Note : these tests on makeinfo and texi2dvi are no more
272 # needed as automake makes them for us
274 # enable the creation of html and latex documents.
278 # depending on variable builddoc, weaving is performed or not
279 # using conditionnal in docs/Makefile.in
280 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
283 # Check for doxygen end
284 #########################################################################
287 #########################################################################
288 # Checks for header files start
293 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
294 stdarg.h assert.h fcntl.h errno.h \
295 dirent.h sys/param.h getopt.h)
297 # Checks for typedefs, structures, and compiler characteristics.
300 # Checks for library functions.
302 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf getopt_long)
305 AC_MSG_CHECKING([for optarg in unistd.h])
307 [#include <unistd.h>],
308 [ char *string = optarg; int i = optind; ],
311 AC_MSG_RESULT($optarg_found)
313 if test $optarg_found = yes; then
314 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
318 # Checks for header files end
319 #########################################################################
321 #########################################################################
324 # ------------- dmalloc -------------------
327 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
328 AC_ARG_ENABLE([dmalloc],
329 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
331 if test "X$enable_dmalloc" != "Xno" ; then
333 AC_CHECK_HEADER(dmalloc.h,,
334 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
335 AC_CHECK_LIB(dmalloc,main,,
336 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
337 DMALLOC_LIBS="-ldmalloc"
349 # ------------- ElectricFence -------------------
350 dnl ElectricFence checks
352 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
353 AC_ARG_ENABLE([efence],
354 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
356 if test "X$enable_efence" != "Xno" ; then
358 if test "X$with_dmalloc" = "Xyes" ; then
359 AC_ERROR([You have requested both dmalloc and Electric Fence, however only 1 is allowed.])
361 AC_CHECK_LIB(efence,main,,
362 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
373 #########################################################################
375 #########################################################################
376 # gEDA/gaf specify setup start
380 GEDADATADIR=$datadir/$DATADIR
382 if eval "test x$opt_rcdir = x"; then
383 # path not was specified with --with-rcdir
384 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
385 GEDARCDIR=$GEDADATADIR
387 # path WAS specified with --with-rcdir
388 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
389 GEDARCDIR="$opt_rcdir"
392 if test x$opt_xdgdatadir = x; then
393 # path was not specified with --with-xdgdatadir
394 XDGDATADIR='${datadir}'
396 # path WAS specified with --with-xdgdatadir
397 XDGDATADIR="$opt_xdgdatadir"
401 # Expand the prefix variable
402 # I don't like the way this is done, but it works (I hope).
403 if eval "test x$prefix = xNONE"; then
404 dprefix=$ac_default_prefix
409 gedatopdir=$dprefix/share/$DATADIR
410 expandgedadatadir=`echo $gedatopdir`
412 # this has to be expanded ( no ${prefix} ) --
413 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
414 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
415 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
416 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
419 # gEDA/gaf specify things which need to setup
420 #########################################################################
422 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
423 GATTRIB_CFLAGS="$GTK_CFLAGS $GLIB_CFLAGS $LIBGEDA_CFLAGS $GTHREAD_CFLAGS"
424 GATTRIB_LDFLAGS="$GTK_LIBS $GLIB_LIBS $LIBGEDA_LIBS $GTHREAD_LIBS"
426 # Makefile.in variable substitution
427 AC_SUBST(DATE_VERSION)
428 AC_SUBST(DOTTED_VERSION)
429 AC_SUBST(GATTRIB_CFLAGS)
430 AC_SUBST(GATTRIB_LDFLAGS)
432 AC_SUBST(GEDADATADIR)
434 # Create all the necessary derived files
435 AC_CONFIG_FILES([Makefile
449 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
450 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
451 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
454 ***** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION *****
456 == libgeda library version: $LIBGEDA_VERSION
457 == data directory: $expandedGEDADATADIR
458 == rc directory: $expandedGEDARCDIR
459 == xdg directory: $expandedXDGDATADIR
460 == compiler flags: $GATTRIB_CFLAGS
461 == linker flags: $GATTRIB_LDFLAGS
462 == glib compiler flags: $GLIB_CFLAGS
463 == glib linker libs: $GLIB_LIBS
464 == glib library version: $GLIB_VERSION
465 == gtk compiler flags: $GTK_CFLAGS
466 == gtk linker libs: $GTK_LIBS
467 == gtk library version: $GTK_VERSION
468 == dmalloc debugging: $with_dmalloc
469 == Electric Fence debugging: $with_efence
471 ************************************************************