1 # Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/gsymcheck.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 #########################################################################
16 # Command line flags start
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])
22 # Command line flags end
23 #########################################################################
25 # Checks for programs.
27 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
31 #########################################################################
33 # Misc win32 / mingw checks and variables start
36 # Figure out if we are building on win32 and what environment.
38 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
41 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
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-2.0, GUILE_PC="yes", no_GUILE_PC="yes")
63 if test "$GUILE_PC" = "yes"
65 GUILE_VERSION=`$PKG_CONFIG guile-2.0 --modversion`
67 # Find about the installed guile
69 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
75 guile_need_version="$guile_need_major[].$guile_need_minor.0"
77 AC_MSG_CHECKING([Guile version >= $guile_need_version])
79 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
80 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
81 AC_MSG_RESULT($GUILE_VERSION)
83 if test "$guile_need_major" -gt "$guile_major" \
84 || (test "$guile_need_major" -eq "$guile_major" \
85 && test "$guile_need_minor" -gt "$guile_minor"); then
86 AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
89 # Guile 1.6 compatability
91 CFLAGS_temp_save="$CFLAGS"
92 CFLAGS="$CFLAGS $GUILE_CFLAGS"
93 AC_CHECK_DECLS([scm_is_string, scm_is_integer, scm_to_int,
94 scm_from_int, scm_is_true, scm_is_false,
95 scm_from_locale_string, scm_to_locale_string],,,
96 [#include <libguile.h>])
97 CFLAGS="$CFLAGS_temp_save"
99 AH_VERBATIM(SCM_IS_STRING, [#if !HAVE_DECL_SCM_IS_STRING
100 # define scm_is_string(x) SCM_STRINGP(x)
102 AH_VERBATIM(SCM_IS_INTEGER, [#if !HAVE_DECL_SCM_IS_INTEGER
103 # define scm_is_integer(x) SCM_INUMP(x)
105 AH_VERBATIM(SCM_TO_INT, [#if !HAVE_DECL_SCM_TO_INT
106 # define scm_to_int(x) SCM_INUM(x)
108 AH_VERBATIM(SCM_FROM_INT, [#if !HAVE_DECL_SCM_FROM_INT
109 # define scm_from_int(x) SCM_MAKINUM(x)
111 AH_VERBATIM(SCM_IS_TRUE, [#if !HAVE_DECL_SCM_IS_TRUE
112 # define scm_is_true(x) SCM_NFALSEP(x)
114 AH_VERBATIM(SCM_IS_FALSE, [#if !HAVE_DECL_SCM_IS_FALSE
115 # define scm_is_false(x) SCM_FALSEP(x)
117 AH_VERBATIM(SCM_FROM_LOCALE_STRING, [#if !HAVE_DECL_SCM_FROM_LOCALE_STRING
118 # define scm_from_locale_string(x) scm_makfrom0str(x)
120 AH_VERBATIM(SCM_TO_LOCALE_STRING, [#if !HAVE_DECL_SCM_TO_LOCALE_STRING
121 # define scm_to_locale_string(x) strdup(SCM_STRING_CHARS(x))
125 # Check for guile end
126 ############################################################################
128 ############################################################################
129 # Check for mics things start
131 # Checking for rint in math library
132 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
134 # Checking for dynamic lib
135 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
137 # Check for mics things start
138 ############################################################################
141 ############################################################################
142 # Check for gtk+ 2.4 start
145 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
147 # This next bit of code figures out what gtk we need to use.
148 if test "$GTK24" = "yes"
151 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
152 GTK_CFLAGS=$GTK24_CFLAGS
154 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
157 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
158 if test "$GLIB24" != "yes"
160 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
162 GLIB_CFLAGS=$GLIB24_CFLAGS
163 GLIB_LIBS=$GLIB24_LIBS
164 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
170 if test "$GTK_VERSION" = ""
172 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
176 # Check for gtk+ 2.4 end
177 ############################################################################
179 ############################################################################
180 # Check for libgeda start
182 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes",
185 if test "$LIBGEDA" = "yes"
187 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
189 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
193 # Check for libgeda end
194 ############################################################################
196 #########################################################################
197 # Checks for header files start
202 AC_CHECK_HEADERS(regex.h sys/types.h unistd.h string.h stdlib.h \
203 stdarg.h assert.h fcntl.h errno.h)
205 # Checks for typedefs, structures, and compiler characteristics.
208 # Checks for library functions.
210 AC_CHECK_FUNCS(strstr)
212 AC_MSG_CHECKING([for optarg in unistd.h])
214 [#include <unistd.h>],
215 [ char *string = optarg; int i = optind; ],
218 AC_MSG_RESULT($optarg_found)
220 if test $optarg_found = yes; then
221 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
225 # Checks for header files start
226 #########################################################################
228 #########################################################################
229 # Check for groff start
233 AC_PATH_PROG(GROFF, groff, no, ${PATH})
234 if test $GROFF = "no"; then
235 echo "Cannot find groff, some documentation will not be created."
239 # Check for groff end
240 #########################################################################
242 #########################################################################
243 # gEDA/gaf specify setup start
247 GEDADATADIR=$datadir/$DATADIR
249 if eval "test x$opt_rcdir = x"; then
250 # path not was specified with --with-rcdir
251 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
252 GEDARCDIR=$GEDADATADIR
254 # path WAS specified with --with-rcdir
255 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
256 GEDARCDIR="$opt_rcdir"
259 # Expand the prefix variable
260 # I don't like the way this is done, but it works (I hope).
261 if eval "test x$prefix = xNONE"; then
262 dprefix=$ac_default_prefix
267 gedatopdir=$dprefix/share/$DATADIR
268 expandgedadatadir=`echo $gedatopdir`
270 gedadocdir=$dprefix/share/doc/geda-doc
271 # --with-docdir : tells where to store documentation if not default
273 [ --with-docdir Where to store documentation if not default.],
275 expandgedadocdir=`echo $gedadocdir`
276 GEDADOCDIR=$expandgedadocdir
279 # this has to be expanded ( no ${prefix} ) --
280 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
281 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
282 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
283 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
286 # gEDA/gaf specify things which need to setup
287 #########################################################################
289 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
290 GSYMCHECK_CFLAGS="$LIBGEDA_CFLAGS"
291 GSYMCHECK_LDFLAGS="$LIBGEDA_LIBS"
293 # Makefile.in variable substitution
294 AC_SUBST(DATE_VERSION)
295 AC_SUBST(DOTTED_VERSION)
296 AC_SUBST(GSYMCHECK_CFLAGS)
297 AC_SUBST(GSYMCHECK_LDFLAGS)
299 AC_SUBST(GEDADATADIR)
301 # Create all the necessary derived files
302 AC_CONFIG_FILES([Makefile
310 lib/system-gsymcheckrc ])
314 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
315 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
316 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
319 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
321 GTK+ library version: $GTK_VERSION
322 libgeda library version: $LIBGEDA_VERSION
324 data directory: $expandedGEDADATADIR
325 rc directory: $expandedGEDARCDIR
326 documentation directory: $expandedGEDADOCDIR