1 # Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/gsymcheck.c])
8 echo Configuring $PACKAGE version $VERSION
11 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
12 AM_CONFIG_HEADER([config.h])
14 # Initialize maintainer mode
18 #########################################################################
19 # Command line flags start
21 # Change default location for rc files
22 AC_ARG_WITH(rcdir, [ --with-rcdir=path Change where the system-*rc files are installed], [opt_rcdir=$withval])
25 # Command line flags end
26 #########################################################################
28 # Checks for programs.
30 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
34 #########################################################################
36 # Misc win32 / mingw checks and variables start
39 # Figure out if we are building on win32 and what environment.
41 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
44 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
56 # Misc win32 / mingw checks and variables end
57 #########################################################################
59 ############################################################################
60 # Check for mics things start
62 # Checking for rint in math library
63 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
65 # Checking for dynamic lib
66 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
68 # Check for mics things start
69 ############################################################################
72 ############################################################################
73 # Check for gtk+ 2.4 start
76 # Check for pkg-config
77 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
78 if test $PKG_CONFIG = no; then
79 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
82 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
84 # This next bit of code figures out what gtk we need to use.
85 if test "$GTK24" = "yes"
88 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
89 GTK_CFLAGS=$GTK24_CFLAGS
91 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
94 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
95 if test "$GLIB24" != "yes"
97 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
99 GLIB_CFLAGS=$GLIB24_CFLAGS
100 GLIB_LIBS=$GLIB24_LIBS
101 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
107 if test "$GTK_VERSION" = ""
109 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
113 # Check for gtk+ 2.4 end
114 ############################################################################
116 ############################################################################
117 # Check for libgeda start
119 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $VERSION, LIBGEDA="yes",
122 if test "$LIBGEDA" = "yes"
124 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
126 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
130 # Check for libgeda end
131 ############################################################################
133 #########################################################################
134 # Checks for header files start
139 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
140 stdarg.h assert.h fcntl.h errno.h)
142 # Checks for typedefs, structures, and compiler characteristics.
145 # Checks for library functions.
147 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
149 AC_MSG_CHECKING([for optarg in unistd.h])
151 [#include <unistd.h>],
152 [ char *string = optarg; int i = optind; ],
155 AC_MSG_RESULT($optarg_found)
157 if test $optarg_found = yes; then
158 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
162 # Checks for header files start
163 #########################################################################
165 #########################################################################
166 # Check for groff start
170 AC_PATH_PROG(GROFF, groff, no, ${PATH})
171 if test $GROFF = "no"; then
172 echo "Cannot find groff, some documentation will not be created."
176 # Check for groff end
177 #########################################################################
179 #########################################################################
180 # gEDA/gaf specify setup start
184 GEDADATADIR=$datadir/$DATADIR
186 if eval "test x$opt_rcdir = x"; then
187 # path not was specified with --with-rcdir
188 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
189 GEDARCDIR=$GEDADATADIR
191 # path WAS specified with --with-rcdir
192 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
193 GEDARCDIR="$opt_rcdir"
196 # Expand the prefix variable
197 # I don't like the way this is done, but it works (I hope).
198 if eval "test x$prefix = xNONE"; then
199 dprefix=$ac_default_prefix
204 gedatopdir=$dprefix/share/$DATADIR
205 expandgedadatadir=`echo $gedatopdir`
207 gedadocdir=$dprefix/share/doc/geda-doc
208 # --with-docdir : tells where to store documentation if not default
210 [ --with-docdir Where to store documentation if not default.],
212 expandgedadocdir=`echo $gedadocdir`
213 GEDADOCDIR=$expandgedadocdir
216 # this has to be expanded ( no ${prefix} ) --
217 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
218 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Currently running version of gEDA/gaf])
221 # gEDA/gaf specify things which need to setup
222 #########################################################################
224 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
225 GSYMCHECK_CFLAGS="$LIBGEDA_CFLAGS"
226 GSYMCHECK_LDFLAGS="$LIBGEDA_LIBS"
228 # Makefile.in variable substitution
229 AC_SUBST(GSYMCHECK_CFLAGS)
230 AC_SUBST(GSYMCHECK_LDFLAGS)
232 AC_SUBST(GEDADATADIR)
234 AC_SUBST(OTHERPATHSEP)
236 # Create all the necessary derived files
237 AC_CONFIG_FILES([Makefile
246 lib/system-gsymcheckrc ])
250 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
251 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
252 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
255 ** Configuration summary for $PACKAGE $VERSION:
257 GTK+ library version: $GTK_VERSION
258 libgeda library version: $LIBGEDA_VERSION
260 data directory: $expandedGEDADATADIR
261 rc directory: $expandedGEDARCDIR
262 documentation directory: $expandedGEDADOCDIR