1 # Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/gnetlist.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])
24 # Force a specific version of gtk+
25 AC_ARG_WITH(gtk12, [ --with-gtk12 Force the use of gtk+ 1.2.x], [opt_gtkver=1.2])
28 # Command line flags end
29 #########################################################################
31 # Checks for programs.
35 AC_PATH_PROGS(AWK, nawk gawk mawk awk, )
37 #########################################################################
39 # Misc win32 / mingw checks and variables start
42 # Figure out if we are building on win32 and what environment.
44 *cygwin* ) AC_MSG_ERROR([Building gEDA/gaf under cygwin is not supported]) ;;
45 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
48 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
60 # Misc win32 / mingw checks and variables end
61 #########################################################################
63 ############################################################################
64 # Check for mics things start
66 # Checking for rint in math library
67 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
69 # Checking for dynamic lib
70 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
72 # Check for mics things start
73 ############################################################################
75 ############################################################################
76 # Check for gtk+ 1.2 and 2.2 start
79 # Check for pkg-config
80 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
81 if test $PKG_CONFIG = no; then
82 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
85 # Search for gtk+ 2.2.x first (only if we are not forcing the gtk+ to 1.2)
86 if test "$opt_gtkver" != "1.2"
88 PKG_CHECK_MODULES(GTK22, gtk+-2.0 >= 2.2.0, GTK22="yes", no_GTK22="yes")
91 # This next bit of code figures out what gtk we need to use.
92 if test "$GTK22" = "yes" -a "$opt_gtkver" != "1.2"
95 AC_DEFINE(HAS_GTK22, 1, [If gtk+ 2.2.x has been installed, define this])
96 GTK_CFLAGS=$GTK22_CFLAGS
98 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
101 PKG_CHECK_MODULES(GLIB22, glib-2.0 >= 2.2.0, GLIB22="yes", no_GLIB22="yes")
102 if test "$GLIB22" != "yes"
104 AC_MSG_ERROR([Cannot find glib 2.2.x, install it and rerun ./configure.])
106 GLIB_CFLAGS=$GLIB22_CFLAGS
107 GLIB_LIBS=$GLIB22_LIBS
108 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
112 # Search for gtk+ 1.2 now
113 PKG_CHECK_MODULES(GTK12, gtk+ >= 1.2.3, GTK12="yes", no_GTK12="yes")
115 AC_DEFINE(HAS_GTK12, 1, [If gtk+ 1.2.x has been installed, define this])
116 GTK_CFLAGS=$GTK12_CFLAGS
118 GTK_VERSION=`$PKG_CONFIG gtk+ --modversion`
121 PKG_CHECK_MODULES(GLIB12, glib >= 1.2.3, GLIB12="yes", no_GLIB12="yes")
122 if test "$GLIB12" != "yes"
124 AC_MSG_ERROR([Cannot find glib >= 1.2.3, install it and rerun ./configure.])
126 GLIB_CFLAGS=$GLIB12_CFLAGS
127 GLIB_LIBS=$GLIB12_LIBS
128 GLIB_VERSION=`$PKG_CONFIG glib --modversion`
131 if test "$GTK_VERSION" = ""
133 AC_MSG_ERROR([Cannot find gtk+ 2.2.x or gtk+ 1.2.x, install one of them.])
137 # Check for gtk+ 1.2 and 2.2 end
138 ############################################################################
140 ############################################################################
141 # Check for libgeda start
143 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $VERSION, LIBGEDA="yes",
146 if test "$LIBGEDA" = "yes"
148 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
150 AC_MSG_ERROR([Cannot find libgeda (or libgeda.pc), please install libgeda])
154 # Check for libgeda end
155 ############################################################################
157 #########################################################################
158 # Checks for header files start
163 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
164 stdarg.h assert.h fcntl.h errno.h)
166 # Checks for typedefs, structures, and compiler characteristics.
169 # Checks for library functions.
171 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
173 AC_MSG_CHECKING([for optarg in unistd.h])
175 [#include <unistd.h>],
176 [ char *string = optarg; int i = optind; ],
179 AC_MSG_RESULT($optarg_found)
181 if test $optarg_found = yes; then
182 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
186 # Checks for header files start
187 #########################################################################
189 #########################################################################
190 # Check for groff start
194 AC_PATH_PROG(GROFF, groff, no, ${PATH})
195 if test $GROFF = "no"; then
196 echo "Cannot find groff, some documentation will not be created."
200 # Check for groff end
201 #########################################################################
203 #########################################################################
204 # gEDA/gaf specify setup start
208 GEDADATADIR=$datadir/$DATADIR
210 if eval "test x$opt_rcdir = x"; then
211 # path not was specified with --with-rcdir
212 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
213 GEDARCDIR=$GEDADATADIR
215 # path WAS specified with --with-rcdir
216 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
217 GEDARCDIR="$opt_rcdir"
220 # Expand the prefix variable
221 # I don't like the way this is done, but it works (I hope).
222 if eval "test x$prefix = xNONE"; then
223 dprefix=$ac_default_prefix
228 gedatopdir=$dprefix/share/$DATADIR
229 expandgedadatadir=`echo $gedatopdir`
231 gedadocdir=$dprefix/share/doc/geda-doc
232 # --with-docdir : tells where to store documentation if not default
234 [ --with-docdir Where to store documentation if not default.],
236 expandgedadocdir=`echo $gedadocdir`
237 GEDADOCDIR=$expandgedadocdir
240 # this has to be expanded ( no ${prefix} ) --
241 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
242 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Currently running version of gEDA/gaf])
245 # gEDA/gaf specify things which need to setup
246 #########################################################################
248 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
249 GNETLIST_CFLAGS="$LIBGEDA_CFLAGS"
250 GNETLIST_LDFLAGS="$LIBGEDA_LIBS"
252 # Makefile.in variable substitution
253 AC_SUBST(GNETLIST_CFLAGS)
254 AC_SUBST(GNETLIST_LDFLAGS)
256 AC_SUBST(GEDADATADIR)
258 AC_SUBST(OTHERPATHSEP)
260 # Create all the necessary derived files
261 AC_CONFIG_FILES([Makefile
267 tests/hierarchy/Makefile
270 examples/vams/Makefile
271 examples/vams/sch/Makefile
272 examples/vams/sym/Makefile
273 examples/vams/vhdl/Makefile
274 examples/vams/vhdl/basic-vhdl/Makefile
275 examples/vams/vhdl/new-vhdl/Makefile
276 examples/switcap/Makefile
281 lib/system-gnetlistrc ])
282 AC_CONFIG_COMMANDS([sw2asc-chmod],[[chmod +x scripts/sw2asc]],[[]])
286 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
287 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
288 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
291 ** Configuration summary for $PACKAGE $VERSION:
293 GTK+ library version: $GTK_VERSION
294 libgeda library version: $LIBGEDA_VERSION
296 data directory: $expandedGEDADATADIR
297 rc directory: $expandedGEDARCDIR
298 documentation directory: $expandedGEDADOCDIR