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 ############################################################################
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"
155 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
156 GTK_CFLAGS=$GTK24_CFLAGS
158 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
161 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
162 if test "$GLIB24" != "yes"
164 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
166 GLIB_CFLAGS=$GLIB24_CFLAGS
167 GLIB_LIBS=$GLIB24_LIBS
168 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
174 if test "$GTK_VERSION" = ""
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",
189 if test "$LIBGEDA" = "yes"
191 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
193 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
197 # Check for libgeda end
198 ############################################################################
200 #########################################################################
201 # Checks for header files start
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.
212 # Checks for library functions.
214 AC_CHECK_FUNCS(strstr)
216 AC_MSG_CHECKING([for optarg in unistd.h])
218 [#include <unistd.h>],
219 [ char *string = optarg; int i = optind; ],
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
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
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
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
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
277 [ --with-docdir Where to store documentation if not default.],
279 expandgedadocdir=`echo $gedadocdir`
280 GEDADOCDIR=$expandgedadocdir
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)
303 AC_SUBST(GEDADATADIR)
305 # Create all the necessary derived files
306 AC_CONFIG_FILES([Makefile
314 lib/system-gsymcheckrc ])
318 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
319 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
320 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
323 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
325 GTK+ library version: $GTK_VERSION
326 libgeda library version: $LIBGEDA_VERSION
328 data directory: $expandedGEDADATADIR
329 rc directory: $expandedGEDARCDIR
330 documentation directory: $expandedGEDADOCDIR