1 dr Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/gattrib.c])
8 GATTRIB_VERSION=20040806
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
20 #########################################################################
21 # Command line flags start
23 # Change default location for rc files
24 AC_ARG_WITH(rcdir, [ --with-rcdir=path Change where the system-*rc files are installed], [opt_rcdir=$withval])
26 # Force a specific version of gtk+
27 AC_ARG_WITH(gtk12, [ --with-gtk12 Force the use of gtk+ 1.2.x], [opt_gtkver=1.2])
30 # Command line flags end
31 #########################################################################
33 # Checks for programs.
36 AC_PATH_PROGS(AWK, nawk gawk mawk awk, )
38 #########################################################################
40 # Misc win32 / mingw checks and variables start
41 # Win32 stuff currently unsupported by SDB. I left it in because we need
42 # to set the PATHSEP var.
45 # Figure out if we are building on win32 and what environment.
47 *cygwin* ) AC_MSG_ERROR([Building gEDA/gaf under cygwin is not supported]) ;;
48 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
51 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
63 # Misc win32 / mingw checks and variables end
64 #########################################################################
67 ############################################################################
68 # Check for misc things. . . .
70 # Checking for rint in math library
71 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
73 # Checking for dynamic lib
74 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
76 ############################################################################
79 ############################################################################
80 ## This is supposed to first look for GTK2.2 and then for GTK1.2. Right now,
81 ## gattrib doesn't work with GTK2.X, therefore, most of this is commented out.
82 ## Reconfigure this when GTK-2.X actually works with gattrib.
83 ## Copied from configure.ac in geda.
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 first (only if we are not forcing the gtk+ to 1.2)
92 if test "$opt_gtkver" != "1.2"
94 PKG_CHECK_MODULES(GTK22, gtk+-2.0 >= 2.2.0, GTK22="yes", no_GTK22="yes")
97 # This next bit of code figures out what gtk we need to use.
98 if test "$GTK22" = "yes" -a "$opt_gtkver" != "1.2"
101 AC_DEFINE(HAS_GTK22, 1, [If gtk+ 2.2.x has been installed, define this])
102 GTK_CFLAGS=$GTK22_CFLAGS
104 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
107 PKG_CHECK_MODULES(GLIB22, glib-2.0 >= 2.2.0, GLIB22="yes", no_GLIB22="yes")
108 if test "$GLIB22" != "yes"
110 AC_MSG_ERROR([Cannot find glib 2.2.x, install it and rerun ./configure.])
112 GLIB_CFLAGS=$GLIB22_CFLAGS
113 GLIB_LIBS=$GLIB22_LIBS
114 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
116 ## GTKITEMENTRY_SOURCE=gtkitementry_2_2.c gtkitementry_2_2.h
120 # Search for gtk+ 1.2 now
121 PKG_CHECK_MODULES(GTK12, gtk+ >= 1.2, GTK12="yes", no_GTK12="yes")
123 AC_DEFINE(HAS_GTK12, 1, [If gtk+ 1.2.x has been installed, define this])
124 GTK_CFLAGS=$GTK12_CFLAGS
126 GTK_VERSION=`$PKG_CONFIG gtk+ --modversion`
129 PKG_CHECK_MODULES(GLIB12, glib >= 1.2, GLIB12="yes", no_GLIB12="yes")
130 if test "$GLIB12" != "yes"
132 AC_MSG_ERROR([Cannot find glib >= 1.2, install it and rerun ./configure.])
134 GLIB_CFLAGS=$GLIB12_CFLAGS
135 GLIB_LIBS=$GLIB12_LIBS
136 GLIB_VERSION=`$PKG_CONFIG glib --modversion`
138 ## GTKITEMENTRY_SOURCE=gtkitementry_1_2.c gtkitementry_1_2.h
143 if test "$GTK_VERSION" = ""
145 AC_MSG_ERROR([Cannot find gtk+ 2.2.x or gtk+ 1.2.x, install one of them.])
148 ## These tell Makefile.am which package to compile
149 AM_CONDITIONAL(GTK12_SOURCE, test "$GLIB12" = "yes")
150 AM_CONDITIONAL(GTK22_SOURCE, test "$GLIB22" = "yes" -a "$opt_gtkver" != "1.2")
153 # Check for gtk+ 1.2 and 2.2 end
154 ############################################################################
157 ############################################################################
158 # Check for libgeda start
160 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $GEDA_VERSION, LIBGEDA="yes",
163 if test "$LIBGEDA" = "yes"
165 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
167 AC_MSG_ERROR([Cannot find libgeda (or libgeda.pc), please install libgeda])
171 # Check for libgeda end
172 ############################################################################
174 #########################################################################
175 # Checks for header files start
180 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
181 stdarg.h assert.h fcntl.h errno.h \
182 dirent.h sys/param.h)
184 # Checks for typedefs, structures, and compiler characteristics.
187 # Checks for library functions.
189 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
192 AC_MSG_CHECKING([for optarg in unistd.h])
194 [#include <unistd.h>],
195 [ char *string = optarg; int i = optind; ],
198 AC_MSG_RESULT($optarg_found)
200 if test $optarg_found = yes; then
201 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
205 # Checks for header files start
206 #########################################################################
208 #########################################################################
209 # gEDA/gaf specify setup start
213 GEDADATADIR=$datadir/$DATADIR
215 if eval "test x$opt_rcdir = x"; then
216 # path not was specified with --with-rcdir
217 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
218 GEDARCDIR=$GEDADATADIR
220 # path WAS specified with --with-rcdir
221 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
222 GEDARCDIR="$opt_rcdir"
225 # Expand the prefix variable
226 # I don't like the way this is done, but it works (I hope).
227 if eval "test x$prefix = xNONE"; then
228 dprefix=$ac_default_prefix
233 gedatopdir=$dprefix/share/$DATADIR
234 expandgedadatadir=`echo $gedatopdir`
236 # this has to be expanded ( no ${prefix} ) --
237 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
238 AC_DEFINE_UNQUOTED(VERSION, "$GEDA_VERSION", [Currently running version of gEDA/gaf])
241 # gEDA/gaf specify things which need to setup
242 #########################################################################
244 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
245 GATTRIB_CFLAGS="$GTK_CFLAGS $GLIB_CFLAGS $LIBGEDA_CFLAGS"
246 GATTRIB_LDFLAGS="$GTK_LIBS $GLIB_LIBS $LIBGEDA_LIBS"
248 # Makefile.in variable substitution
249 AC_SUBST(GATTRIB_CFLAGS)
250 AC_SUBST(GATTRIB_LDFLAGS)
252 AC_SUBST(GEDADATADIR)
254 AC_SUBST(OTHERPATHSEP)
256 # Create all the necessary derived files
257 AC_CONFIG_FILES([Makefile
267 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
268 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
271 ***** Configuration summary for $PACKAGE $GATTRIB_VERSION *****
273 == gattrib version: $GATTRIB_VERSION
274 == base gEDA version: $GEDA_VERSION
275 == libgeda library version: $LIBGEDA_VERSION
276 == data directory: $expandedGEDADATADIR
277 == rc directory: $expandedGEDARCDIR
278 == compiler flags: $GATTRIB_CFLAGS
279 == linker flags: $GATTRIB_LDFLAGS
280 == glib compiler flags: $GLIB_CFLAGS
281 == glib linker libs: $GLIB_LIBS
282 == glib library version: $GLIB_VERSION
283 == gtk compiler flags: $GTK_CFLAGS
284 == gtk linker libs: $GTK_LIBS
285 == gtk library version: $GTK_VERSION
287 ************************************************************