Updated configure.ac[.in] and Makefile versions in prep for a release.
[geda-gaf/peter-b.git] / gschem / configure.ac.in
blob4cca3c917d199294ff0c32140f1a492e2b817473
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT
3 AC_CONFIG_SRCDIR([src/gschem.c])
4 AC_PREREQ(2.54)
6 PACKAGE=geda-gschem
7 DOTTED_VERSION=1.1.1
8 DATE_VERSION=20070708
9 echo Configuring $PACKAGE version $DOTTED_VERSION.$DATE_VERSION
11 # Initialize automake 
12 AM_INIT_AUTOMAKE($PACKAGE, $DOTTED_VERSION, no-define)
13 AM_CONFIG_HEADER([config.h])
15 # Call this to make autoconf and friends happy
16 AC_GNU_SOURCE
18 #########################################################################
19 # Command line flags start
20
21 # --disable-stroke : turn off stroke support
22 AC_ARG_ENABLE(stroke,
23     [  --disable-stroke       Disable stroke support (don't use LibStroke at all)], [ if test $enableval = "no"; then
24          no_stroke=yes
25         fi ])
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])
33
34 # Command line flags end
35 #########################################################################
37 #########################################################################
38
39 # Misc win32 / mingw checks and variables start
40 AC_CANONICAL_HOST
42 # Figure out if we are building on win32 and what environment.
43 case $host_os in
44   *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
45 esac
47 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
48    MINGW="yes"
49    PATHSEP=\\\\
50    OTHERPATHSEP=/
51 else
52    # Unix host
53    MINGW="no"
54    PATHSEP=/
55    OTHERPATHSEP=\\\\
58
59 # Misc win32 / mingw checks and variables end
60 #########################################################################
62 # Checks for programs.
63 AC_PROG_CC
64 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")    
65 AC_PROG_CPP
66 AC_PROG_MAKE_SET
68 ############################################################################
69 # Check for guile start
70 GUILE_FLAGS
72 # Check Guile version
73 guile_need_major=1
74 guile_need_minor=8
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.])
90 # Check for guile end
91 ############################################################################
93 ############################################################################
94 # Check for mics things start
95
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"
110 then
111    AC_PATH_X
112    AC_PATH_XTRA 
113     
114    X_EXTRA_LIBS="$X_EXTRA_LIBS"
115    X_LDFLAGS="$X_LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11 -lm"
117    _use_rpath=no
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]],
121        [
122         if test "X$enable_rpath" = "Xno" ; then
123            AC_MSG_RESULT([no])
124            _use_rpath=no
125         else
126            AC_MSG_RESULT([yes])
127            _use_rpath=yes
128         fi
129        ],
130        [
131            AC_MSG_RESULT([no])
132            _use_rpath=no
133        ])
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
138       # know...
139       xlib_path=""
140       for p in $X_LDFLAGS ; do
141             case $p in
142             -L*)
143                 xlib_path="$xlib_path $p"
144                 ;;
145                 esac
146       done
148       _save_LIBS=$LIBS
149       LIBS="$LIBS $X_LDFLAGS"
150       rpath=""
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()],
156           AC_MSG_RESULT([yes])
157             rpath=$fl, 
158             AC_MSG_RESULT([no]))
159             test -n "$rpath" && break
160       done
161       if test -n "$rpath"; then
162          X_LDFLAGS="$X_LDFLAGS $xlib_rpath"
163       fi
164       LIBS=$_save_LIBS
165    fi
170 # Check for X11 end
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"
187 then
189    AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
190    GTK_CFLAGS=$GTK24_CFLAGS
191    GTK_LIBS=$GTK24_LIBS
192    GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
194    # Search for glib
195    PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
196    if test "$GLIB24" != "yes"
197    then
198        AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
199    fi
200    GLIB_CFLAGS=$GLIB24_CFLAGS
201    GLIB_LIBS=$GLIB24_LIBS
202    GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
204    # Search for gthread
205    PKG_CHECK_MODULES(GTHREAD, gthread-2.0, GTHREAD="yes", no_GTHREAD="yes")
206    if test "$GTHREAD" = "yes"
207    then
208        AC_DEFINE(HAVE_GTHREAD, 1, [If gthread support is installed, define this])
209    fi
211 else
212    GTK_VERSION=""
215 if test "$GTK_VERSION" = ""
216 then
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", 
228                   no_LIBGEDA="yes")
230 if test "$LIBGEDA" = "yes" 
231 then
232    LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
233 else
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"
266        LIBSTROKE_CFLAGS=""
267    else
268        LIBSTROKE_LIBS="$LIBSTROKE_LIBS -lstroke"
269        # LIBSTROKE_CFLAGS set above
270    fi
273 if test "$no_stroke" = "yes"; then
274    echo "**                                **"
275    echo "** Disabling libstroke by request **"
276    echo "**                                **"
277    LIBSTROKE_LIB=""
278    LIBSTROKE_CFLAGS=""
279    LIBSTROKE="no"
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.
292 # search for Doxygen
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    **"
299    DOXYGEN=echo
301    # prevent from weaving the nw files
302    # but does not prevent from processing gschemdoc
303    builddoc=false
304 else 
305    # doxygen is available on the system.
306    # now checking if the tools for Texinfo files processing
307    # is installed.
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.
314    builddoc=true
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
329 # search for groff
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
342 AC_HEADER_STDC
343 AC_HEADER_SYS_WAIT
344 AC_HEADER_DIRENT
345 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
346                  stdarg.h assert.h fcntl.h errno.h sys/param.h)
348 # Check for locale.h
350 # Set USE_NLS
351 AM_NLS
352 AC_CHECK_HEADER([locale.h],
353                 [AC_DEFINE([HAVE_LOCALE_H], 1, [Define if you have locale.h])],
354                 [
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])
357                   fi
358                 ])
360 # Checks for typedefs, structures, and compiler characteristics.
361 AC_C_CONST
363 # Checks for library functions.
364 AC_TYPE_SIGNAL
365 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
367 AC_MSG_CHECKING([for optarg in unistd.h])
368 AC_TRY_COMPILE(
369 [#include <unistd.h>],
370 [ char *string = optarg; int i = optind; ],
371 optarg_found=yes,
372 optarg_found=no)
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 -------------------
387 dnl dmalloc checks
388 with_dmalloc="no"
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
394         AC_MSG_RESULT([yes])
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"
400         with_dmalloc="yes"
401 else
402         AC_MSG_RESULT([no])
403         DMALLOC_LIBS=""
407         AC_MSG_RESULT([no])
408         DMALLOC_LIBS=""
411 # ------------- ElectricFence -------------------
412 dnl ElectricFence checks
413 with_efence="no"
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
419         AC_MSG_RESULT([yes])
420         AC_CHECK_LIB(efence,main,,
421                 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
422         with_efence="yes"
423 else
424         AC_MSG_RESULT([no])
428 AC_MSG_RESULT([no])
432 #########################################################################
433 #########################################################################
434 # gEDA/gaf specific setup start
437 DATADIR=gEDA
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
444 else
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
454 else
455  dprefix=$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
463 AC_ARG_WITH(docdir,
464     [  --with-docdir      Where to store documentation if not default.],
465         gedadocdir=$withval)
466 expandgedadocdir=`echo $gedadocdir`
467 GEDADOCDIR=$expandgedadocdir
468 AC_SUBST(GEDADOCDIR)
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 
481 AM_GNU_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)
494 AC_SUBST(GEDARCDIR)
495 AC_SUBST(PATHSEP)
496 AC_SUBST(OTHERPATHSEP)
497 AC_SUBST(GUILEINTERP)
498 AC_SUBST(INDENT)
500 # Create all the necessary derived files
501 AC_CONFIG_FILES([Makefile 
502                 m4/Makefile 
503                 po/Makefile.in 
504                 intl/Makefile 
505                 src/Makefile
506                 include/Makefile
507                 scheme/Makefile
508                 bitmap/Makefile
509                 scripts/Makefile
510                 scripts/config.sh
511                 examples/Makefile
512                 docs/Makefile
513                 lib/Makefile
514                 tests/Makefile
515                 lib/system-gschemrc ])
518 AC_OUTPUT
520 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
521 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
522 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
524 AC_MSG_RESULT([
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
531    mingw build:                      $MINGW
532    data directory:                   $expandedGEDADATADIR
533    rc directory:                     $expandedGEDARCDIR
534    documentation directory:          $expandedGEDADOCDIR
535    dmalloc debugging:                $with_dmalloc
536    ElectricFence debugging:          $with_efence