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-1.8], GUILE_PC="yes", no_GUILE_PC="yes")
63 if test "$GUILE_PC" = "yes"
66 GUILE_VERSION=`$PKG_CONFIG guile-1.8 --modversion`
70 # Find about the installed guile
72 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
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)
106 AH_VERBATIM(SCM_IS_INTEGER, [#if !HAVE_DECL_SCM_IS_INTEGER
107 # define scm_is_integer(x) SCM_INUMP(x)
109 AH_VERBATIM(SCM_TO_INT, [#if !HAVE_DECL_SCM_TO_INT
110 # define scm_to_int(x) SCM_INUM(x)
112 AH_VERBATIM(SCM_FROM_INT, [#if !HAVE_DECL_SCM_FROM_INT
113 # define scm_from_int(x) SCM_MAKINUM(x)
115 AH_VERBATIM(SCM_IS_TRUE, [#if !HAVE_DECL_SCM_IS_TRUE
116 # define scm_is_true(x) SCM_NFALSEP(x)
118 AH_VERBATIM(SCM_IS_FALSE, [#if !HAVE_DECL_SCM_IS_FALSE
119 # define scm_is_false(x) SCM_FALSEP(x)
121 AH_VERBATIM(SCM_FROM_LOCALE_STRING, [#if !HAVE_DECL_SCM_FROM_LOCALE_STRING
122 # define scm_from_locale_string(x) scm_makfrom0str(x)
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))
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 ############################################################################
144 ############################################################################
145 # Check for libgeda start
147 PKG_CHECK_MODULES(LIBGEDA, [libgeda >= $DATE_VERSION], LIBGEDA="yes",
150 if test "$LIBGEDA" = "yes"
152 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
154 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
158 # Check for libgeda end
159 ############################################################################
161 ############################################################################
162 # Check for glib start
165 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.8.0], GLIB="yes", no_GLIB="yes")
167 # This next bit of code figures out what glib we need to use.
168 if test "$GLIB" != "yes"
170 AC_MSG_ERROR([Cannot find glib 2.8.0 or later, please install it and rerun ./configure.])
172 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
176 ############################################################################
178 #########################################################################
179 # Checks for header files start
184 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
185 stdarg.h assert.h fcntl.h errno.h)
187 # Checks for typedefs, structures, and compiler characteristics.
190 # Checks for library functions.
192 AC_CHECK_FUNCS(strstr)
194 AC_MSG_CHECKING([for optarg in unistd.h])
196 [#include <unistd.h>],
197 [ char *string = optarg; int i = optind; ],
200 AC_MSG_RESULT($optarg_found)
202 if test $optarg_found = yes; then
203 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
207 # Checks for header files start
208 #########################################################################
210 #########################################################################
211 # Check for groff start
215 AC_PATH_PROG(GROFF, groff, no, ${PATH})
216 if test $GROFF = "no"; then
217 echo "Cannot find groff, some documentation will not be created."
221 # Check for groff end
222 #########################################################################
224 #########################################################################
225 # gEDA/gaf specify setup start
229 GEDADATADIR=$datadir/$DATADIR
231 if eval "test x$opt_rcdir = x"; then
232 # path not was specified with --with-rcdir
233 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
234 GEDARCDIR=$GEDADATADIR
236 # path WAS specified with --with-rcdir
237 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
238 GEDARCDIR="$opt_rcdir"
241 # Expand the prefix variable
242 # I don't like the way this is done, but it works (I hope).
243 if eval "test x$prefix = xNONE"; then
244 dprefix=$ac_default_prefix
249 gedatopdir=$dprefix/share/$DATADIR
250 expandgedadatadir=`echo $gedatopdir`
252 gedadocdir=$dprefix/share/doc/geda-doc
253 # --with-docdir : tells where to store documentation if not default
255 [ --with-docdir Where to store documentation if not default.],
257 expandgedadocdir=`echo $gedadocdir`
258 GEDADOCDIR=$expandgedadocdir
261 # this has to be expanded ( no ${prefix} ) --
262 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
263 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
264 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
265 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
268 # gEDA/gaf specify things which need to setup
269 #########################################################################
271 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
272 GSYMCHECK_CFLAGS="$GLIB_CFLAGS $LIBGEDA_CFLAGS $GUILE_CFLAGS"
273 GSYMCHECK_LDFLAGS="$GLIB_LIBS $LIBGEDA_LIBS $GUILE_LIBS"
275 # Makefile.in variable substitution
276 AC_SUBST(DATE_VERSION)
277 AC_SUBST(DOTTED_VERSION)
278 AC_SUBST(GSYMCHECK_CFLAGS)
279 AC_SUBST(GSYMCHECK_LDFLAGS)
281 AC_SUBST(GEDADATADIR)
283 # Create all the necessary derived files
284 AC_CONFIG_FILES([Makefile
292 lib/system-gsymcheckrc ])
296 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
297 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
298 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
301 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
303 libgeda library version: $LIBGEDA_VERSION
305 data directory: $expandedGEDADATADIR
306 rc directory: $expandedGEDARCDIR
307 documentation directory: $expandedGEDADOCDIR