Updated all versions to 1.5.1 20081221 35:0:0
[geda-gaf/peter-b.git] / gsymcheck / configure.ac
blob7cf10d154ed9f87bee72c83563ae17064d85450b
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT
3 AC_CONFIG_SRCDIR([src/gsymcheck.c])
4 AC_PREREQ(2.54)
6 PACKAGE=geda-gsymcheck
7 DOTTED_VERSION=1.5.1
8 DATE_VERSION=20081221
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 #########################################################################
16 # Command line flags start
17
18 # Change default location for rc files
19 AC_ARG_WITH(rcdir, [  --with-rcdir=path       Change where the system-*rc files are installed], [opt_rcdir=$withval])
21
22 # Command line flags end
23 #########################################################################
25 # Checks for programs.
26 AC_PROG_CC
27 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")    
28 AC_PROG_CPP
29 AC_PROG_MAKE_SET
31 #########################################################################
32
33 # Misc win32 / mingw checks and variables start
34 AC_CANONICAL_HOST
36 # Figure out if we are building on win32 and what environment.
37 case $host_os in
38   *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
39 esac
41 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
42    MINGW="yes"
43 else
44    # Unix host
45    MINGW="no"
48
49 # Misc win32 / mingw checks and variables end
50 #########################################################################
52 ############################################################################
53 # Check for guile start
55 # Check for pkg-config
56 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
57 if test $PKG_CONFIG = no; then
58    AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
61 PKG_CHECK_MODULES(GUILE, guile-1.8, GUILE_PC="yes", no_GUILE_PC="yes")
63 if test "$GUILE_PC" = "yes" 
64 then
66    GUILE_VERSION=`$PKG_CONFIG guile-1.8 --modversion`
68 else
70    # Find about the installed guile
71    GUILE_FLAGS
72    GUILE_VERSION=`$GUILE_CONFIG info guileversion`
76 # Check Guile version
77 guile_need_major=1
78 guile_need_minor=6
79 guile_need_version="$guile_need_major[].$guile_need_minor.0"
81 AC_MSG_CHECKING([Guile version >= $guile_need_version])
83 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
84 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
85 AC_MSG_RESULT($GUILE_VERSION)
87 if test "$guile_need_major" -gt "$guile_major" \
88    || (test "$guile_need_major" -eq "$guile_major" \
89        && test "$guile_need_minor" -gt "$guile_minor"); then
90   AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
93 # Guile 1.6 compatability
95 CFLAGS_temp_save="$CFLAGS"
96 CFLAGS="$CFLAGS $GUILE_CFLAGS"
97 AC_CHECK_DECLS([scm_is_string, scm_is_integer, scm_to_int,
98 scm_from_int,  scm_is_true,    scm_is_false,
99 scm_from_locale_string, scm_to_locale_string],,,
100 [#include <libguile.h>])
101 CFLAGS="$CFLAGS_temp_save"
103 AH_VERBATIM(SCM_IS_STRING, [#if !HAVE_DECL_SCM_IS_STRING
104 #  define scm_is_string(x) SCM_STRINGP(x)
105 #endif])
106 AH_VERBATIM(SCM_IS_INTEGER, [#if !HAVE_DECL_SCM_IS_INTEGER
107 #  define scm_is_integer(x) SCM_INUMP(x)
108 #endif])
109 AH_VERBATIM(SCM_TO_INT, [#if !HAVE_DECL_SCM_TO_INT
110 #  define scm_to_int(x)     SCM_INUM(x)
111 #endif])
112 AH_VERBATIM(SCM_FROM_INT, [#if !HAVE_DECL_SCM_FROM_INT
113 #  define scm_from_int(x)   SCM_MAKINUM(x)
114 #endif])
115 AH_VERBATIM(SCM_IS_TRUE, [#if !HAVE_DECL_SCM_IS_TRUE
116 #  define scm_is_true(x)    SCM_NFALSEP(x)
117 #endif])
118 AH_VERBATIM(SCM_IS_FALSE, [#if !HAVE_DECL_SCM_IS_FALSE
119 #  define scm_is_false(x)   SCM_FALSEP(x)
120 #endif])
121 AH_VERBATIM(SCM_FROM_LOCALE_STRING, [#if !HAVE_DECL_SCM_FROM_LOCALE_STRING
122 #  define scm_from_locale_string(x) scm_makfrom0str(x)
123 #endif])
124 AH_VERBATIM(SCM_TO_LOCALE_STRING, [#if !HAVE_DECL_SCM_TO_LOCALE_STRING
125 #  define scm_to_locale_string(x)   strdup(SCM_STRING_CHARS(x))
126 #endif])
129 # Check for guile end
130 ############################################################################
132 ############################################################################
133 # Check for mics things start
135 # Checking for rint in math library
136 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
138 # Checking for dynamic lib
139 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
141 # Check for mics things start
142 ############################################################################
145 ############################################################################
146 # Check for gtk+ 2.4 start
149 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
151 # This next bit of code figures out what gtk we need to use.
152 if test "$GTK24" = "yes" 
153 then
155    AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
156    GTK_CFLAGS=$GTK24_CFLAGS
157    GTK_LIBS=$GTK24_LIBS
158    GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
160    # Search for glib
161    PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
162    if test "$GLIB24" != "yes"
163    then
164        AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
165    fi
166    GLIB_CFLAGS=$GLIB24_CFLAGS
167    GLIB_LIBS=$GLIB24_LIBS
168    GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
170 else
171    GTK_VERSION=""
174 if test "$GTK_VERSION" = ""
175 then
176    AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
180 # Check for gtk+ 2.4 end
181 ############################################################################
183 ############################################################################
184 # Check for libgeda start
186 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes", 
187                   no_LIBGEDA="yes")
189 if test "$LIBGEDA" = "yes" 
190 then
191    LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
192 else
193    AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
197 # Check for libgeda end
198 ############################################################################
200 #########################################################################
201 # Checks for header files start
203 AC_HEADER_STDC
204 AC_HEADER_SYS_WAIT
205 AC_HEADER_DIRENT
206 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
207                  stdarg.h assert.h fcntl.h errno.h)
209 # Checks for typedefs, structures, and compiler characteristics.
210 AC_C_CONST
212 # Checks for library functions.
213 AC_TYPE_SIGNAL
214 AC_CHECK_FUNCS(strstr)
216 AC_MSG_CHECKING([for optarg in unistd.h])
217 AC_TRY_COMPILE(
218 [#include <unistd.h>],
219 [ char *string = optarg; int i = optind; ],
220 optarg_found=yes,
221 optarg_found=no)
222 AC_MSG_RESULT($optarg_found)
224 if test $optarg_found = yes; then
225     AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
229 # Checks for header files start
230 #########################################################################
232 #########################################################################
233 # Check for groff start
236 # search for groff
237 AC_PATH_PROG(GROFF, groff, no, ${PATH})
238 if test $GROFF = "no"; then
239         echo "Cannot find groff, some documentation will not be created."
243 # Check for groff end
244 #########################################################################
246 #########################################################################
247 # gEDA/gaf specify setup start
250 DATADIR=gEDA
251 GEDADATADIR=$datadir/$DATADIR
253 if eval "test x$opt_rcdir = x"; then
254         # path not was specified with --with-rcdir
255         AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
256         GEDARCDIR=$GEDADATADIR
257 else
258         # path WAS specified with --with-rcdir
259         AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
260         GEDARCDIR="$opt_rcdir"
263 # Expand the prefix variable
264 # I don't like the way this is done, but it works (I hope).
265 if eval "test x$prefix = xNONE"; then
266  dprefix=$ac_default_prefix
267 else
268  dprefix=$prefix
271 gedatopdir=$dprefix/share/$DATADIR
272 expandgedadatadir=`echo $gedatopdir`
274 gedadocdir=$dprefix/share/doc/geda-doc
275 # --with-docdir : tells where to store documentation if not default
276 AC_ARG_WITH(docdir,
277     [  --with-docdir      Where to store documentation if not default.],
278         gedadocdir=$withval)
279 expandgedadocdir=`echo $gedadocdir`
280 GEDADOCDIR=$expandgedadocdir
281 AC_SUBST(GEDADOCDIR)
283 # this has to be expanded ( no ${prefix} ) --
284 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
285 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
286 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
287 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
290 # gEDA/gaf specify things which need to setup
291 #########################################################################
293 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
294 GSYMCHECK_CFLAGS="$LIBGEDA_CFLAGS"
295 GSYMCHECK_LDFLAGS="$LIBGEDA_LIBS"  
297 # Makefile.in variable substitution
298 AC_SUBST(DATE_VERSION)
299 AC_SUBST(DOTTED_VERSION)
300 AC_SUBST(GSYMCHECK_CFLAGS)
301 AC_SUBST(GSYMCHECK_LDFLAGS)
302 AC_SUBST(GEDARCDIR)
303 AC_SUBST(GEDADATADIR)
305 # Create all the necessary derived files
306 AC_CONFIG_FILES([Makefile 
307                  src/Makefile 
308                  include/Makefile 
309                  scheme/Makefile 
310                  examples/Makefile 
311                  lib/Makefile 
312                  docs/Makefile
313                  tests/Makefile
314                  lib/system-gsymcheckrc ])
316 AC_OUTPUT
318 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
319 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
320 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
322 AC_MSG_RESULT([
323 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
325    GTK+ library version:             $GTK_VERSION
326    libgeda library version:          $LIBGEDA_VERSION
327    mingw build:                      $MINGW
328    data directory:                   $expandedGEDADATADIR
329    rc directory:                     $expandedGEDARCDIR
330    documentation directory:          $expandedGEDADOCDIR