1 dr Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/gattrib.c])
8 GATTRIB_VERSION=20060824
9 echo Configuring $PACKAGE version $GATTRIB_VERSION
10 echo Part of gEDA version $GEDA_VERSION
12 # Initialize automake -- use base gEDA version here
13 AM_INIT_AUTOMAKE($PACKAGE, $GEDA_VERSION)
14 AM_CONFIG_HEADER([config.h])
16 # Initialize maintainer mode
19 # Create option to debug
21 [ --enable-debug Sets the DEBUG flag which causes lots of debug spew to be generated],
22 [ AC_DEFINE(DEBUG, 1, DEBUG) ]
25 #########################################################################
26 # Command line flags start
28 # Change default location for rc files
29 AC_ARG_WITH(rcdir, [ --with-rcdir=path Change where the system-*rc files are installed], [opt_rcdir=$withval])
32 # Command line flags end
33 #########################################################################
35 # Checks for programs.
37 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
39 AC_PATH_PROGS(AWK, nawk gawk mawk awk, )
41 #########################################################################
43 # Misc win32 / mingw checks and variables start
44 # Win32 stuff currently unsupported by SDB. I left it in because we need
45 # to set the PATHSEP var.
48 # Figure out if we are building on win32 and what environment.
50 *cygwin* ) AC_MSG_ERROR([Building gEDA/gaf under cygwin is not supported]) ;;
51 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
54 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
66 # Misc win32 / mingw checks and variables end
67 #########################################################################
70 ############################################################################
71 # Check for misc things. . . .
73 # Checking for rint in math library
74 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
76 # Checking for dynamic lib
77 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
79 ############################################################################
82 ############################################################################
83 ## This is looks for GTK2.2.
85 # Check for pkg-config
86 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
87 if test $PKG_CONFIG = no; then
88 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
91 # Search for gtk+ 2.2.x
92 PKG_CHECK_MODULES(GTK22, gtk+-2.0 >= 2.2.0, GTK22="yes", no_GTK22="yes")
94 # This next bit of code figures out what gtk we need to use.
95 if test "$GTK22" = "yes"
98 AC_DEFINE(HAS_GTK22, 1, [If gtk+ 2.2.x has been installed, define this])
99 GTK_CFLAGS=$GTK22_CFLAGS
101 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
104 PKG_CHECK_MODULES(GLIB22, glib-2.0 >= 2.2.0, GLIB22="yes", no_GLIB22="yes")
105 if test "$GLIB22" != "yes"
107 AC_MSG_ERROR([Cannot find glib 2.2.x, install it and rerun ./configure.])
109 GLIB_CFLAGS=$GLIB22_CFLAGS
110 GLIB_LIBS=$GLIB22_LIBS
111 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
113 ## GTKITEMENTRY_SOURCE=gtkitementry_2_2.c gtkitementry_2_2.h
120 if test "$GTK_VERSION" = ""
122 AC_MSG_ERROR([Cannot find gtk+ 2.2.x or later, please install gtk+.])
125 ## These tell Makefile.am which package to compile
126 AM_CONDITIONAL(GTK22_SOURCE, test "$GLIB22" = "yes")
129 # Check for gtk+ 2.2 end
130 ############################################################################
133 ############################################################################
134 # Check for libgeda start
136 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $GEDA_VERSION, LIBGEDA="yes",
139 if test "$LIBGEDA" = "yes"
141 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
143 AC_MSG_ERROR([Cannot find libgeda>=$GEDA_VERSION (or libgeda.pc), please install libgeda-$GEDA_VERSION])
147 # Check for libgeda end
148 ############################################################################
150 #########################################################################
151 # Checks for header files start
156 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
157 stdarg.h assert.h fcntl.h errno.h \
158 dirent.h sys/param.h getopt.h)
160 # Checks for typedefs, structures, and compiler characteristics.
163 # Checks for library functions.
165 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf getopt_long)
168 AC_MSG_CHECKING([for optarg in unistd.h])
170 [#include <unistd.h>],
171 [ char *string = optarg; int i = optind; ],
174 AC_MSG_RESULT($optarg_found)
176 if test $optarg_found = yes; then
177 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
181 # Checks for header files end
182 #########################################################################
184 #########################################################################
187 # ------------- dmalloc -------------------
190 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
191 AC_ARG_ENABLE([dmalloc],
192 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
194 if test "X$enable_dmalloc" != "Xno" ; then
196 AC_CHECK_HEADER(dmalloc.h,,
197 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
198 AC_CHECK_LIB(dmalloc,main,,
199 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
200 DMALLOC_LIBS="-ldmalloc"
212 # ------------- ElectricFence -------------------
213 dnl ElectricFence checks
215 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
216 AC_ARG_ENABLE([efence],
217 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
219 if test "X$enable_efence" != "Xno" ; then
221 if test "X$with_dmalloc" = "Xyes" ; then
222 AC_ERROR([You have requested both dmalloc and Electric Fence, however only 1 is allowed.])
224 AC_CHECK_LIB(efence,main,,
225 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
236 #########################################################################
238 #########################################################################
239 # gEDA/gaf specify setup start
243 GEDADATADIR=$datadir/$DATADIR
245 if eval "test x$opt_rcdir = x"; then
246 # path not was specified with --with-rcdir
247 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
248 GEDARCDIR=$GEDADATADIR
250 # path WAS specified with --with-rcdir
251 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
252 GEDARCDIR="$opt_rcdir"
255 # Expand the prefix variable
256 # I don't like the way this is done, but it works (I hope).
257 if eval "test x$prefix = xNONE"; then
258 dprefix=$ac_default_prefix
263 gedatopdir=$dprefix/share/$DATADIR
264 expandgedadatadir=`echo $gedatopdir`
266 # this has to be expanded ( no ${prefix} ) --
267 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
268 AC_DEFINE_UNQUOTED(VERSION, "$GEDA_VERSION", [Currently running version of gEDA/gaf])
271 # gEDA/gaf specify things which need to setup
272 #########################################################################
274 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
275 GATTRIB_CFLAGS="$GTK_CFLAGS $GLIB_CFLAGS $LIBGEDA_CFLAGS"
276 GATTRIB_LDFLAGS="$GTK_LIBS $GLIB_LIBS $LIBGEDA_LIBS"
278 # Makefile.in variable substitution
279 AC_SUBST(GATTRIB_CFLAGS)
280 AC_SUBST(GATTRIB_LDFLAGS)
282 AC_SUBST(GEDADATADIR)
284 AC_SUBST(OTHERPATHSEP)
286 # Create all the necessary derived files
287 AC_CONFIG_FILES([Makefile
297 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
298 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
301 ***** Configuration summary for $PACKAGE $GATTRIB_VERSION *****
303 == gattrib version: $GATTRIB_VERSION
304 == base gEDA version: $GEDA_VERSION
305 == libgeda library version: $LIBGEDA_VERSION
306 == data directory: $expandedGEDADATADIR
307 == rc directory: $expandedGEDARCDIR
308 == compiler flags: $GATTRIB_CFLAGS
309 == linker flags: $GATTRIB_LDFLAGS
310 == glib compiler flags: $GLIB_CFLAGS
311 == glib linker libs: $GLIB_LIBS
312 == glib library version: $GLIB_VERSION
313 == gtk compiler flags: $GTK_CFLAGS
314 == gtk linker libs: $GTK_LIBS
315 == gtk library version: $GTK_VERSION
316 == dmalloc debugging: $with_dmalloc
317 == Electric Fence debugging: $with_efence
319 ************************************************************