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
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)
87 AH_VERBATIM(SCM_IS_INTEGER, [#if !HAVE_DECL_SCM_IS_INTEGER
88 # define scm_is_integer(x) SCM_INUMP(x)
90 AH_VERBATIM(SCM_TO_INT, [#if !HAVE_DECL_SCM_TO_INT
91 # define scm_to_int(x) SCM_INUM(x)
93 AH_VERBATIM(SCM_FROM_INT, [#if !HAVE_DECL_SCM_FROM_INT
94 # define scm_from_int(x) SCM_MAKINUM(x)
96 AH_VERBATIM(SCM_IS_TRUE, [#if !HAVE_DECL_SCM_IS_TRUE
97 # define scm_is_true(x) SCM_NFALSEP(x)
99 AH_VERBATIM(SCM_IS_FALSE, [#if !HAVE_DECL_SCM_IS_FALSE
100 # define scm_is_false(x) SCM_FALSEP(x)
102 AH_VERBATIM(SCM_FROM_LOCALE_STRING, [#if !HAVE_DECL_SCM_FROM_LOCALE_STRING
103 # define scm_from_locale_string(x) scm_makfrom0str(x)
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))
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"
142 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
143 GTK_CFLAGS=$GTK24_CFLAGS
145 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
148 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
149 if test "$GLIB24" != "yes"
151 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
153 GLIB_CFLAGS=$GLIB24_CFLAGS
154 GLIB_LIBS=$GLIB24_LIBS
155 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
161 if test "$GTK_VERSION" = ""
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",
176 if test "$LIBGEDA" = "yes"
178 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
180 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
184 # Check for libgeda end
185 ############################################################################
187 #########################################################################
188 # Checks for header files start
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.
199 # Checks for library functions.
201 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
203 AC_MSG_CHECKING([for optarg in unistd.h])
205 [#include <unistd.h>],
206 [ char *string = optarg; int i = optind; ],
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
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
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
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
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
264 [ --with-docdir Where to store documentation if not default.],
266 expandgedadocdir=`echo $gedadocdir`
267 GEDADOCDIR=$expandgedadocdir
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)
290 AC_SUBST(GEDADATADIR)
292 # Create all the necessary derived files
293 AC_CONFIG_FILES([Makefile
302 lib/system-gsymcheckrc ])
306 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
307 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
308 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
311 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
313 GTK+ library version: $GTK_VERSION
314 libgeda library version: $LIBGEDA_VERSION
316 data directory: $expandedGEDADATADIR
317 rc directory: $expandedGEDARCDIR
318 documentation directory: $expandedGEDADOCDIR