Updated versions in the important man pages
[geda-gaf/whiteaudio.git] / gsymcheck / configure.ac
blob2c7cd64eecda739c11ee1b115727499f8bfd4466
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.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 #########################################################################
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
54 GUILE_FLAGS
56 # Check Guile version
57 guile_need_major=1
58 guile_need_minor=6
59 guile_need_version="$guile_need_major[].$guile_need_minor.0"
61 AC_MSG_CHECKING([Guile version >= $guile_need_version])
62 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
64 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
65 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
66 AC_MSG_RESULT($GUILE_VERSION)
68 if test "$guile_need_major" -gt "$guile_major" \
69    || (test "$guile_need_major" -eq "$guile_major" \
70        && test "$guile_need_minor" -gt "$guile_minor"); then
71   AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
74 # Guile 1.6 compatability
76 CFLAGS_temp_save="$CFLAGS"
77 CFLAGS="$CFLAGS $GUILE_CFLAGS"
78 AC_CHECK_DECLS([scm_is_string, scm_is_integer, scm_to_int,
79 scm_from_int,  scm_is_true,    scm_is_false,
80 scm_from_locale_string, scm_to_locale_string],,,
81 [#include <libguile.h>])
82 CFLAGS="$CFLAGS_temp_save"
84 AH_VERBATIM(SCM_IS_STRING, [#if !HAVE_DECL_SCM_IS_STRING
85 #  define scm_is_string(x) SCM_STRINGP(x)
86 #endif])
87 AH_VERBATIM(SCM_IS_INTEGER, [#if !HAVE_DECL_SCM_IS_INTEGER
88 #  define scm_is_integer(x) SCM_INUMP(x)
89 #endif])
90 AH_VERBATIM(SCM_TO_INT, [#if !HAVE_DECL_SCM_TO_INT
91 #  define scm_to_int(x)     SCM_INUM(x)
92 #endif])
93 AH_VERBATIM(SCM_FROM_INT, [#if !HAVE_DECL_SCM_FROM_INT
94 #  define scm_from_int(x)   SCM_MAKINUM(x)
95 #endif])
96 AH_VERBATIM(SCM_IS_TRUE, [#if !HAVE_DECL_SCM_IS_TRUE
97 #  define scm_is_true(x)    SCM_NFALSEP(x)
98 #endif])
99 AH_VERBATIM(SCM_IS_FALSE, [#if !HAVE_DECL_SCM_IS_FALSE
100 #  define scm_is_false(x)   SCM_FALSEP(x)
101 #endif])
102 AH_VERBATIM(SCM_FROM_LOCALE_STRING, [#if !HAVE_DECL_SCM_FROM_LOCALE_STRING
103 #  define scm_from_locale_string(x) scm_makfrom0str(x)
104 #endif])
105 AH_VERBATIM(SCM_TO_LOCALE_STRING, [#if !HAVE_DECL_SCM_TO_LOCALE_STRING
106 #  define scm_to_locale_string(x)   strdup(SCM_STRING_CHARS(x))
107 #endif])
110 # Check for guile end
111 ############################################################################
113 ############################################################################
114 # Check for mics things start
116 # Checking for rint in math library
117 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
119 # Checking for dynamic lib
120 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
122 # Check for mics things start
123 ############################################################################
126 ############################################################################
127 # Check for gtk+ 2.4 start
130 # Check for pkg-config
131 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
132 if test $PKG_CONFIG = no; then
133    AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
136 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
138 # This next bit of code figures out what gtk we need to use.
139 if test "$GTK24" = "yes" 
140 then
142    AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
143    GTK_CFLAGS=$GTK24_CFLAGS
144    GTK_LIBS=$GTK24_LIBS
145    GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
147    # Search for glib
148    PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
149    if test "$GLIB24" != "yes"
150    then
151        AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
152    fi
153    GLIB_CFLAGS=$GLIB24_CFLAGS
154    GLIB_LIBS=$GLIB24_LIBS
155    GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
157 else
158    GTK_VERSION=""
161 if test "$GTK_VERSION" = ""
162 then
163    AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
167 # Check for gtk+ 2.4 end
168 ############################################################################
170 ############################################################################
171 # Check for libgeda start
173 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes", 
174                   no_LIBGEDA="yes")
176 if test "$LIBGEDA" = "yes" 
177 then
178    LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
179 else
180    AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
184 # Check for libgeda end
185 ############################################################################
187 #########################################################################
188 # Checks for header files start
190 AC_HEADER_STDC
191 AC_HEADER_SYS_WAIT
192 AC_HEADER_DIRENT
193 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
194                  stdarg.h assert.h fcntl.h errno.h)
196 # Checks for typedefs, structures, and compiler characteristics.
197 AC_C_CONST
199 # Checks for library functions.
200 AC_TYPE_SIGNAL
201 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
203 AC_MSG_CHECKING([for optarg in unistd.h])
204 AC_TRY_COMPILE(
205 [#include <unistd.h>],
206 [ char *string = optarg; int i = optind; ],
207 optarg_found=yes,
208 optarg_found=no)
209 AC_MSG_RESULT($optarg_found)
211 if test $optarg_found = yes; then
212     AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
216 # Checks for header files start
217 #########################################################################
219 #########################################################################
220 # Check for groff start
223 # search for groff
224 AC_PATH_PROG(GROFF, groff, no, ${PATH})
225 if test $GROFF = "no"; then
226         echo "Cannot find groff, some documentation will not be created."
230 # Check for groff end
231 #########################################################################
233 #########################################################################
234 # gEDA/gaf specify setup start
237 DATADIR=gEDA
238 GEDADATADIR=$datadir/$DATADIR
240 if eval "test x$opt_rcdir = x"; then
241         # path not was specified with --with-rcdir
242         AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
243         GEDARCDIR=$GEDADATADIR
244 else
245         # path WAS specified with --with-rcdir
246         AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
247         GEDARCDIR="$opt_rcdir"
250 # Expand the prefix variable
251 # I don't like the way this is done, but it works (I hope).
252 if eval "test x$prefix = xNONE"; then
253  dprefix=$ac_default_prefix
254 else
255  dprefix=$prefix
258 gedatopdir=$dprefix/share/$DATADIR
259 expandgedadatadir=`echo $gedatopdir`
261 gedadocdir=$dprefix/share/doc/geda-doc
262 # --with-docdir : tells where to store documentation if not default
263 AC_ARG_WITH(docdir,
264     [  --with-docdir      Where to store documentation if not default.],
265         gedadocdir=$withval)
266 expandgedadocdir=`echo $gedadocdir`
267 GEDADOCDIR=$expandgedadocdir
268 AC_SUBST(GEDADOCDIR)
270 # this has to be expanded ( no ${prefix} ) --
271 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
272 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
273 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
274 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
277 # gEDA/gaf specify things which need to setup
278 #########################################################################
280 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
281 GSYMCHECK_CFLAGS="$LIBGEDA_CFLAGS"
282 GSYMCHECK_LDFLAGS="$LIBGEDA_LIBS"  
284 # Makefile.in variable substitution
285 AC_SUBST(DATE_VERSION)
286 AC_SUBST(DOTTED_VERSION)
287 AC_SUBST(GSYMCHECK_CFLAGS)
288 AC_SUBST(GSYMCHECK_LDFLAGS)
289 AC_SUBST(GEDARCDIR)
290 AC_SUBST(GEDADATADIR)
292 # Create all the necessary derived files
293 AC_CONFIG_FILES([Makefile 
294                  src/Makefile 
295                  include/Makefile 
296                  scheme/Makefile 
297                  examples/Makefile 
298                  lib/Makefile 
299                  utils/Makefile
300                  docs/Makefile
301                  tests/Makefile
302                  lib/system-gsymcheckrc ])
304 AC_OUTPUT
306 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
307 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
308 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
310 AC_MSG_RESULT([
311 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
313    GTK+ library version:             $GTK_VERSION
314    libgeda library version:          $LIBGEDA_VERSION
315    mingw build:                      $MINGW
316    data directory:                   $expandedGEDADATADIR
317    rc directory:                     $expandedGEDARCDIR
318    documentation directory:          $expandedGEDADOCDIR