1 # Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([src/gschem.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 # Call this to make autoconf and friends happy
18 #########################################################################
19 # Command line flags start
21 # --disable-stroke : turn off stroke support
23 [ --disable-stroke Disable stroke support (don't use LibStroke at all)], [ if test $enableval = "no"; then
27 # Change default location for rc files
28 AC_ARG_WITH(rcdir, [ --with-rcdir=path Change where the system-*rc files are installed], [opt_rcdir=$withval])
30 # Allow the user to specify where there libstroke library lives
31 AC_ARG_WITH(stroke, [ --with-stroke=DIR Tell configure where to find libstroke], [opt_stroke=$withval])
34 # Command line flags end
35 #########################################################################
37 #########################################################################
39 # Misc win32 / mingw checks and variables start
42 # Figure out if we are building on win32 and what environment.
44 *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
47 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
59 # Misc win32 / mingw checks and variables end
60 #########################################################################
62 # Checks for programs.
64 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")
68 ############################################################################
69 # Check for guile start
75 guile_need_version="$guile_need_major[].$guile_need_minor.0"
77 AC_MSG_CHECKING([Guile version >= $guile_need_version])
78 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
80 guile_major=`echo "$GUILE_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
81 guile_minor=`echo "$GUILE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
82 AC_MSG_RESULT($GUILE_VERSION)
84 if test $guile_need_major -gt $guile_major \
85 || test $guile_need_minor -gt $guile_minor; then
86 AC_MSG_ERROR([Guile version >= $guile_need_version is required.])
91 ############################################################################
93 ############################################################################
94 # Check for mics things start
96 # Checking for rint in math library
97 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
99 # Checking for dynamic lib
100 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
102 # Check for mics things start
103 ############################################################################
105 ############################################################################
106 # Check for X11 start
109 if test "$MINGW" = "no"
114 X_EXTRA_LIBS="$X_EXTRA_LIBS"
115 X_LDFLAGS="$X_LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11 -lm"
118 AC_MSG_CHECKING([if hardcoding of the X11 runtime library path is desired])
119 AC_ARG_ENABLE([rpath],
120 [ --enable-rpath Enable hardcoding the X11 runtime library path [default=disabled]],
122 if test "X$enable_rpath" = "Xno" ; then
135 if test "X$_use_rpath" = "Xyes" ; then
136 # Try to figure out if we need -Rpath for finding X11 libs
137 # at runtime. Why autoconf doesn't already do this, I don't
140 for p in $X_LDFLAGS ; do
143 xlib_path="$xlib_path $p"
149 LIBS="$LIBS $X_LDFLAGS"
151 for fl in "-Wl,-rpath " "-Wl,--rpath " "-rpath " "--rpath " "-Wl,-R" "-R" "-R " ; do
152 xlib_rpath=`echo $xlib_path | sed "s/-L/$fl/g"`
153 LIBS="$_save_LIBS $X_LIBS $xlib_rpath"
154 AC_MSG_CHECKING([if the compiler accepts ${fl}path for runtime libraries])
155 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
159 test -n "$rpath" && break
161 if test -n "$rpath"; then
162 X_LDFLAGS="$X_LDFLAGS $xlib_rpath"
171 ############################################################################
173 ############################################################################
174 # Check for gtk+ 2.4 start
177 # Check for pkg-config
178 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
179 if test $PKG_CONFIG = no; then
180 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
183 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
185 # This next bit of code figures out what gtk we need to use.
186 if test "$GTK24" = "yes"
189 AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
190 GTK_CFLAGS=$GTK24_CFLAGS
192 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
195 PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
196 if test "$GLIB24" != "yes"
198 AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
200 GLIB_CFLAGS=$GLIB24_CFLAGS
201 GLIB_LIBS=$GLIB24_LIBS
202 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
205 PKG_CHECK_MODULES(GTHREAD, gthread-2.0, GTHREAD="yes", no_GTHREAD="yes")
206 if test "$GTHREAD" = "yes"
208 AC_DEFINE(HAVE_GTHREAD, 1, [If gthread support is installed, define this])
215 if test "$GTK_VERSION" = ""
217 AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
221 # Check for gtk+ 2.4 end
222 ############################################################################
224 ############################################################################
225 # Check for libgeda start
227 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $DATE_VERSION, LIBGEDA="yes",
230 if test "$LIBGEDA" = "yes"
232 LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
234 AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
238 # Check for libgeda end
239 ############################################################################
241 ############################################################################
242 # Check for libstroke start
245 # user specified --with-stroke
246 if eval "test x$opt_stroke != x"; then
247 LIBSTROKE_LIBS="-L$opt_stroke/lib"
248 LIBSTROKE_CFLAGS="-I$opt_stroke/include"
251 # only check if the user has not disable strokes
252 if test "$no_stroke" != "yes"; then
253 save_cppflags="$CPPFLAGS"
254 save_ldflags="$LDFLAGS"
255 CPPFLAGS="$CPPFLAGS $LIBSTROKE_CFLAGS"
256 LDFLAGS="$LDFLAGS $LIBSTROKE_LIBS"
257 AC_CHECK_LIB(stroke, stroke_init, LIBSTROKE="yes", LIBSTROKE="no")
258 CPPFLAGS="$save_cppflags"
259 LDFLAGS="$save_ldflags"
262 if test "$LIBSTROKE" = "yes"; then
263 AC_DEFINE(HAS_LIBSTROKE, 1, [Define if you have libstroke installed])
264 if eval "test x$opt_stroke = x"; then
265 LIBSTROKE_LIBS="-lstroke"
268 LIBSTROKE_LIBS="$LIBSTROKE_LIBS -lstroke"
269 # LIBSTROKE_CFLAGS set above
273 if test "$no_stroke" = "yes"; then
275 echo "** Disabling libstroke by request **"
283 # Check for libstroke end
284 ############################################################################
286 ############################################################################
287 # Check for doxygen start
289 # Doxygen is a utility for generating html and latex documentation
290 # from c source code files.
293 AC_PATH_PROG(DOXYGEN, doxygen, no, ${PATH})
295 if test "$DOXYGEN" = "no"; then
296 # doxygen is not available on the system
297 echo "** Cannot find Doxygen! **"
298 echo "** Documentation creation disabled **"
301 # prevent from weaving the nw files
302 # but does not prevent from processing gschemdoc
305 # doxygen is available on the system.
306 # now checking if the tools for Texinfo files processing
308 # The docs can be either processed to produce dvi, html or info
309 # with texi2dvi, texi2html or makeinfo respectively
310 # Note : these tests on makeinfo and texi2dvi are no more
311 # needed as automake makes them for us
313 # enable the creation of html and latex documents.
317 # depending on variable builddoc, weaving is performed or not
318 # using conditionnal in docs/Makefile.in
319 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
322 # Check for doxygen end
323 #########################################################################
325 #########################################################################
326 # Check for groff start
330 AC_PATH_PROG(GROFF, groff, no, ${PATH})
331 if test $GROFF = "no"; then
332 echo "Cannot find groff, some documentation will not be created."
336 # Check for groff end
337 #########################################################################
339 #########################################################################
340 # Checks for header files start
345 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
346 stdarg.h assert.h fcntl.h errno.h sys/param.h)
352 AC_CHECK_HEADER([locale.h],
353 [AC_DEFINE([HAVE_LOCALE_H], 1, [Define if you have locale.h])],
355 if test "$USE_NLS" = "yes"; then
356 AC_MSG_ERROR([Cannot find useful locale.h, and nls support is enabled. Try compiling with --disable-nls])
360 # Checks for typedefs, structures, and compiler characteristics.
363 # Checks for library functions.
365 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
367 AC_MSG_CHECKING([for optarg in unistd.h])
369 [#include <unistd.h>],
370 [ char *string = optarg; int i = optind; ],
373 AC_MSG_RESULT($optarg_found)
375 if test $optarg_found = yes; then
376 AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
380 # Checks for header files end
381 #########################################################################
383 #########################################################################
386 # ------------- dmalloc -------------------
389 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
390 AC_ARG_ENABLE([dmalloc],
391 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [[default=no]]],
393 if test "X$enable_dmalloc" != "Xno" ; then
395 AC_CHECK_HEADER(dmalloc.h,,
396 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
397 AC_CHECK_LIB(dmalloc,main,,
398 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
399 DMALLOC_LIBS="-ldmalloc"
411 # ------------- ElectricFence -------------------
412 dnl ElectricFence checks
414 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
415 AC_ARG_ENABLE([efence],
416 [ --enable-efence Link with ElectricFence for malloc debugging [[default=no]]],
418 if test "X$enable_efence" != "Xno" ; then
420 AC_CHECK_LIB(efence,main,,
421 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
432 #########################################################################
433 #########################################################################
434 # gEDA/gaf specific setup start
438 GEDADATADIR=$datadir/$DATADIR
440 if eval "test x$opt_rcdir = x"; then
441 # path was not specified with --with-rcdir
442 AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
443 GEDARCDIR=$GEDADATADIR
445 # path WAS specified with --with-rcdir
446 AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
447 GEDARCDIR="$opt_rcdir"
450 # Expand the prefix variable
451 # I don't like the way this is done, but it works (I hope).
452 if eval "test x$prefix = xNONE"; then
453 dprefix=$ac_default_prefix
458 gedatopdir=$dprefix/share/$DATADIR
459 expandgedadatadir=`echo $gedatopdir`
461 gedadocdir=$dprefix/share/doc/geda-doc
462 # --with-docdir : tells where to store documentation if not default
464 [ --with-docdir Where to store documentation if not default.],
466 expandgedadocdir=`echo $gedadocdir`
467 GEDADOCDIR=$expandgedadocdir
470 # this has to be expanded ( no ${prefix} ) --
471 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
472 AC_DEFINE_UNQUOTED(DATE_VERSION, "$DATE_VERSION", [Currently running date version of gEDA/gaf])
473 AC_DEFINE_UNQUOTED(DOTTED_VERSION, "$DOTTED_VERSION", [Currently running dotted version of gEDA/gaf])
474 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this program's package])
477 # gEDA/gaf specify things which need to setup
478 #########################################################################
480 # Initialized gettext
482 AM_GNU_GETTEXT_VERSION([%INSTALLED_GETTEXT_VERSION%])
484 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
485 GSCHEM_CFLAGS="$LIBSTROKE_CFLAGS $LIBGEDA_CFLAGS $GTHREAD_CFLAGS"
486 GSCHEM_LDFLAGS="$LIBSTROKE_LIBS $LIBGEDA_LIBS $GTK_LIBS $X_LDFLAGS $DMALLOC_LIBS $GTHREAD_LIBS"
488 # Makefile.in variable substitution
489 AC_SUBST(DATE_VERSION)
490 AC_SUBST(DOTTED_VERSION)
491 AC_SUBST(GSCHEM_CFLAGS)
492 AC_SUBST(GSCHEM_LDFLAGS)
493 AC_SUBST(GEDADATADIR)
496 AC_SUBST(OTHERPATHSEP)
497 AC_SUBST(GUILEINTERP)
500 # Create all the necessary derived files
501 AC_CONFIG_FILES([Makefile
515 lib/system-gschemrc ])
520 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
521 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
522 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
525 ** Configuration summary for $PACKAGE $DOTTED_VERSION.$DATE_VERSION:
527 GTK+ library version: $GTK_VERSION
528 GUILE library version: $GUILE_VERSION
529 libgeda library version: $LIBGEDA_VERSION
530 libstroke library: $LIBSTROKE
532 data directory: $expandedGEDADATADIR
533 rc directory: $expandedGEDARCDIR
534 documentation directory: $expandedGEDADOCDIR
535 dmalloc debugging: $with_dmalloc
536 ElectricFence debugging: $with_efence