Stay in GETCOORDS if there are more coord prompts.
[geda-gaf/berndj.git] / gattrib / configure.ac
blobe0a861b2d11f80d8892d0f693181e28ffeb7bdd3
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT
3 AC_CONFIG_SRCDIR([src/gattrib.c])
4 AC_PREREQ(2.54)
6 PACKAGE=geda-gattrib
7 DOTTED_VERSION=1.5.0
8 DATE_VERSION=20080706
9 echo Configuring $PACKAGE version $DOTTED_VERSION.$DATE_VERSION
11 # Initialize automake
12 AM_INIT_AUTOMAKE($PACKAGE, $DOTTED_VERSION, no-define)
13 AM_CONFIG_HEADER([config.h])
15 # Create option to debug
16 AC_ARG_ENABLE(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
24
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])
31
32 # Command line flags end
33 #########################################################################
35 # Checks for programs.
36 AC_PROG_CC
37 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")    
38 AC_PROG_MAKE_SET
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])
58   fi
62 # Update desktop database utility end
63 ############################################################################
65 # Set USE_NLS
66 AM_NLS
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)
74 AM_PO_SUBDIRS
76 #########################################################################
77
78 #  Misc win32 / mingw checks and variables start
79 #  Win32 stuff currently unsupported by SDB.
80 AC_CANONICAL_HOST
82 # Figure out if we are building on win32 and what environment.
83 case $host_os in
84   *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
85 esac
87 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
88    MINGW="yes"
89 else
90    # Unix host
91    MINGW="no"
94
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" 
110 then
112    GUILE_VERSION=`$PKG_CONFIG guile-1.8 --modversion`
114 else
116    # Find about the installed guile
117    GUILE_FLAGS
118    GUILE_VERSION=`$GUILE_CONFIG info guileversion`
122 # Check Guile version
123 guile_need_major=1
124 guile_need_minor=6
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)
151 #endif])
152 AH_VERBATIM(SCM_IS_INTEGER, [#if !HAVE_DECL_SCM_IS_INTEGER
153 #  define scm_is_integer(x) SCM_INUMP(x)
154 #endif])
155 AH_VERBATIM(SCM_TO_INT, [#if !HAVE_DECL_SCM_TO_INT
156 #  define scm_to_int(x)     SCM_INUM(x)
157 #endif])
158 AH_VERBATIM(SCM_FROM_INT, [#if !HAVE_DECL_SCM_FROM_INT
159 #  define scm_from_int(x)   SCM_MAKINUM(x)
160 #endif])
161 AH_VERBATIM(SCM_IS_TRUE, [#if !HAVE_DECL_SCM_IS_TRUE
162 #  define scm_is_true(x)    SCM_NFALSEP(x)
163 #endif])
164 AH_VERBATIM(SCM_IS_FALSE, [#if !HAVE_DECL_SCM_IS_FALSE
165 #  define scm_is_false(x)   SCM_FALSEP(x)
166 #endif])
167 AH_VERBATIM(SCM_FROM_LOCALE_STRING, [#if !HAVE_DECL_SCM_FROM_LOCALE_STRING
168 #  define scm_from_locale_string(x) scm_makfrom0str(x)
169 #endif])
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))
172 #endif])
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.
192 #                                                                                      
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" 
198 then
200    AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
201    GTK_CFLAGS=$GTK24_CFLAGS
202    GTK_LIBS=$GTK24_LIBS
203    GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
205    # Search for glib
206    PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
207    if test "$GLIB24" != "yes"
208    then
209        AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
210    fi
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
217    # Search for gthread
218    PKG_CHECK_MODULES(GTHREAD, gthread-2.0, GTHREAD="yes", no_GTHREAD="yes")
219    if test "$GTHREAD" = "yes"
220    then
221        AC_DEFINE(HAVE_GTHREAD, 1, [If gthread support is installed, define this])
222    fi
224 else
225    GTK_VERSION=""
228                                                                                       
229 if test "$GTK_VERSION" = ""
230 then
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")
236                                                                                       
238 # Check for gtk+ 2.4 end
239 ############################################################################
240                                                                                       
242 ############################################################################
243 # Check for libgeda start
245 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes", 
246                   no_LIBGEDA="yes")
248 if test "$LIBGEDA" = "yes" 
249 then
250    LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
251 else
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.
266 # search for Doxygen
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    **"
273    DOXYGEN=echo
275    # prevent from creating html and latex documents.
276    # but does not prevent from processing gschemdoc
277    builddoc=false
278 else
279    # doxygen is available on the system.
280    # now checking if the tools for Texinfo files processing
281    # is installed.
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.
288    builddoc=true
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
303 AC_HEADER_STDC
304 AC_HEADER_SYS_WAIT
305 AC_HEADER_DIRENT
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.
311 AC_C_CONST
313 # Checks for library functions.
314 AC_TYPE_SIGNAL
315 AC_CHECK_FUNCS(getopt_long)
318 AC_MSG_CHECKING([for optarg in unistd.h])
319 AC_TRY_COMPILE(
320 [#include <unistd.h>],
321 [ char *string = optarg; int i = optind; ],
322 optarg_found=yes,
323 optarg_found=no)
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 -------------------
338 dnl dmalloc checks
339 with_dmalloc="no"
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
345         AC_MSG_RESULT([yes])
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"
351         with_dmalloc="yes"
352 else
353         AC_MSG_RESULT([no])
354         DMALLOC_LIBS=""
358         AC_MSG_RESULT([no])
359         DMALLOC_LIBS=""
362 # ------------- ElectricFence -------------------
363 dnl ElectricFence checks
364 with_efence="no"
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
370         AC_MSG_RESULT([yes])
371         if test "X$with_dmalloc" = "Xyes" ; then
372                 AC_ERROR([You have requested both dmalloc and Electric Fence, however only 1 is allowed.])
373         fi
374         AC_CHECK_LIB(efence,main,,
375                 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
376         with_efence="yes"
377 else
378         AC_MSG_RESULT([no])
382 AC_MSG_RESULT([no])
386 #########################################################################
388 #########################################################################
389 # gEDA/gaf specify setup start
392 DATADIR=gEDA
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
399 else
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}'
408 else
409         # path WAS specified with --with-xdgdatadir
410         XDGDATADIR="$opt_xdgdatadir"
412 AC_SUBST(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
418 else
419  dprefix=$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)
444 AC_SUBST(GEDARCDIR)
445 AC_SUBST(GEDADATADIR)
447 # Create all the necessary derived files
448 AC_CONFIG_FILES([Makefile 
449                  src/Makefile
450                  lib/Makefile 
451                  docs/Makefile
452                  design/Makefile
453                  include/Makefile 
454                  data/Makefile
455                  po/Makefile.in
456                  po/Makefile
457                  lib/system-gattribrc
458                 ])
460 AC_OUTPUT
462 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
463 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
464 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
466 AC_MSG_RESULT([
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 ************************************************************