Updated schematics to get rid of symbol warnings.
[geda-gaf/peter-b.git] / gschem / configure.ac.in
blobc494db91a1c2ebb54c66b51393eee17dfa83b690
1 # $Id$
3 # Process this file with autoconf to produce a configure script.
4 AC_INIT
5 AC_CONFIG_SRCDIR([src/gschem.c])
6 AC_PREREQ(2.54)
8 PACKAGE=geda-gschem
9 VERSION=20070216
10 echo Configuring $PACKAGE version $VERSION
12 # Initialize automake 
13 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
14 AM_CONFIG_HEADER([config.h])
16 # Initialize maintainer mode
17 AM_MAINTAINER_MODE
19 # Call this to make autoconf and friends happy
20 AC_GNU_SOURCE
22 #########################################################################
23 # Command line flags start
24
25 # --disable-stroke : turn off stroke support
26 AC_ARG_ENABLE(stroke,
27     [  --disable-stroke       Disable stroke support (don't use LibStroke at all)], [ if test $enableval = "no"; then
28          no_stroke=yes
29         fi ])
31 # --disable-gd : turn off libgd support
32 AC_ARG_ENABLE(gd,
33     [  --disable-gd        Disable libgd support (don't use libgd at all)], [ if test $enableval = "no"; then
34             no_gd=yes
35            fi ])
37 # Change default location for rc files
38 AC_ARG_WITH(rcdir, [  --with-rcdir=path       Change where the system-*rc files are installed], [opt_rcdir=$withval])
40 # Allow the user to specify where there libstroke library lives
41 AC_ARG_WITH(stroke, [  --with-stroke=DIR       Tell configure where to find libstroke], [opt_stroke=$withval])
43
44 # Command line flags end
45 #########################################################################
47 #########################################################################
48
49 # Misc win32 / mingw checks and variables start
50 AC_CANONICAL_HOST
52 # Figure out if we are building on win32 and what environment.
53 case $host_os in
54   *mingw32* ) echo "Configuring for mingw"; MINGW=yes ;;
55 esac
57 if ! test "$MINGW" = "no" -o "$MINGW"x = x; then
58    MINGW="yes"
59    PATHSEP=\\\\
60    OTHERPATHSEP=/
61 else
62    # Unix host
63    MINGW="no"
64    PATHSEP=/
65    OTHERPATHSEP=\\\\
68
69 # Misc win32 / mingw checks and variables end
70 #########################################################################
72 # Checks for programs.
73 AC_PROG_CC
74 AM_CONDITIONAL(CCISGCC, test "$GCC" = "yes")    
75 AC_PROG_CPP
76 AC_PROG_MAKE_SET
78 ############################################################################
79 # Check for guile start
80 # Do a very basic guile test, as the bulk of the flags will come from 
81 # libgeda.pc
83 GUILE_FLAGS
85 # Manually search for guile-config.  This is provided by GUILE_PROGS, but
86 # guile-1.4 does not have GUILE_PROGS, so we have to do it manually.
87 AC_PATH_PROG(GUILE_CONFIG,guile-config)
88 if test "$GUILE_CONFIG" = "" ; then
89     AC_MSG_ERROR([guile-config required but not found])
91 AC_SUBST(GUILE_CONFIG)
93 GUILE_VERSION=`$GUILE_CONFIG info guileversion`
96 # Check for guile end
97 ############################################################################
99 ############################################################################
100 # Check for mics things start
102 # Checking for rint in math library
103 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT, 1, [If your math library has rint in it, define this]), no_RINT="yes")
105 # Checking for dynamic lib
106 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
108 # Check for mics things start
109 ############################################################################
111 ############################################################################
112 # Check for X11 start
115 if test "$MINGW" = "no"
116 then
117    AC_PATH_X
118    AC_PATH_XTRA 
119     
120    X_EXTRA_LIBS="$X_EXTRA_LIBS"
121    X_LDFLAGS="$X_LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11 -lm"
123    _use_rpath=no
124    AC_MSG_CHECKING([if hardcoding of the X11 runtime library path is desired])
125    AC_ARG_ENABLE([rpath],
126        [  --enable-rpath         Enable hardcoding the X11 runtime library path [default=disabled]],
127        [
128         if test "X$enable_rpath" = "Xno" ; then
129            AC_MSG_RESULT([no])
130            _use_rpath=no
131         else
132            AC_MSG_RESULT([yes])
133            _use_rpath=yes
134         fi
135        ],
136        [
137            AC_MSG_RESULT([no])
138            _use_rpath=no
139        ])
141    if test "X$_use_rpath" = "Xyes" ; then
142       # Try to figure out if we need -Rpath for finding X11 libs
143       # at runtime.  Why autoconf doesn't already do this, I don't
144       # know...
145       xlib_path=""
146       for p in $X_LDFLAGS ; do
147             case $p in
148             -L*)
149                 xlib_path="$xlib_path $p"
150                 ;;
151                 esac
152       done
154       _save_LIBS=$LIBS
155       LIBS="$LIBS $X_LDFLAGS"
156       rpath=""
157       for fl in "-Wl,-rpath " "-Wl,--rpath " "-rpath " "--rpath " "-Wl,-R" "-R" "-R " ; do
158           xlib_rpath=`echo $xlib_path | sed "s/-L/$fl/g"`
159           LIBS="$_save_LIBS $X_LIBS $xlib_rpath"
160           AC_MSG_CHECKING([if the compiler accepts ${fl}path for runtime libraries])
161           AC_LINK_IFELSE([AC_LANG_PROGRAM()],
162           AC_MSG_RESULT([yes])
163             rpath=$fl, 
164             AC_MSG_RESULT([no]))
165             test -n "$rpath" && break
166       done
167       if test -n "$rpath"; then
168          X_LDFLAGS="$X_LDFLAGS $xlib_rpath"
169       fi
170       LIBS=$_save_LIBS
171    fi
176 # Check for X11 end
177 ############################################################################
179 ############################################################################
180 # Check for gtk+ 2.4 start
183 # Check for pkg-config
184 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
185 if test $PKG_CONFIG = no; then
186    AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
189 PKG_CHECK_MODULES(GTK24, gtk+-2.0 >= 2.4.0, GTK24="yes", no_GTK24="yes")
191 # This next bit of code figures out what gtk we need to use.
192 if test "$GTK24" = "yes"
193 then
195    AC_DEFINE(HAS_GTK24, 1, [If gtk+ 2.4.x has been installed, define this])
196    GTK_CFLAGS=$GTK24_CFLAGS
197    GTK_LIBS=$GTK24_LIBS
198    GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
200    # Search for glib
201    PKG_CHECK_MODULES(GLIB24, glib-2.0 >= 2.4.0, GLIB24="yes", no_GLIB24="yes")
202    if test "$GLIB24" != "yes"
203    then
204        AC_MSG_ERROR([Cannot find glib 2.4.x, install it and rerun ./configure.])
205    fi
206    GLIB_CFLAGS=$GLIB24_CFLAGS
207    GLIB_LIBS=$GLIB24_LIBS
208    GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
210 else
211    GTK_VERSION=""
214 if test "$GTK_VERSION" = ""
215 then
216    AC_MSG_ERROR([Cannot find gtk+ 2.4.x or later, please install gtk+.])
220 # Check for gtk+ 2.4 end
221 ############################################################################
223 ############################################################################
224 # Check for libgeda start
226 PKG_CHECK_MODULES(LIBGEDA, libgeda >= $VERSION, LIBGEDA="yes", 
227                   no_LIBGEDA="yes")
229 if test "$LIBGEDA" = "yes" 
230 then
231    LIBGEDA_VERSION=`$PKG_CONFIG libgeda --modversion`
232 else
233    AC_MSG_ERROR([libgeda detection error: $LIBGEDA_PKG_ERRORS])
237 # Check for libgeda end
238 ############################################################################
240 ############################################################################
241 # Check for libgd start
242 # Do some very simple tests, as we just need to know if libgeda was
243 # built with libgd support.
246 if test "X$no_gd" != "Xyes"; then
247         AC_MSG_CHECKING([if libgeda was compiled with gdlib])
248         haslibgd=`$PKG_CONFIG --variable=LIBGEDA_HASGD libgeda`
249         if test "$haslibgd" != "yes"; then
250                 AC_MSG_WARN([libgeda was not built with libgd png support.
251 gschem will use the builtin png support.  If you want libgd png support, you 
252 must recompile libgeda with gdlib support.])
253                 LIBGD=no
254         else
255                 AC_MSG_RESULT([yes])
256                 LIBGD=yes
257                 AC_DEFINE(HAS_LIBGD, 1, [If gd has been installed, define this])
258         fi
259 else
260         LIBGD=no
265 # Check for libgd end
266 ############################################################################
269 ############################################################################
270 # Check for libstroke start
273 # user specified --with-stroke
274 if eval "test x$opt_stroke != x"; then
275    LIBSTROKE_LIBS="-L$opt_stroke/lib"
276    LIBSTROKE_CFLAGS="-I$opt_stroke/include"
279 # only check if the user has not disable strokes
280 if test "$no_stroke" != "yes"; then
281    save_cppflags="$CPPFLAGS"
282    save_ldflags="$LDFLAGS"
283    CPPFLAGS="$CPPFLAGS $LIBSTROKE_CFLAGS"
284    LDFLAGS="$LDFLAGS $LIBSTROKE_LIBS"
285    AC_CHECK_LIB(stroke, stroke_init, LIBSTROKE="yes", LIBSTROKE="no")
286    CPPFLAGS="$save_cppflags"
287    LDFLAGS="$save_ldflags"
290 if test "$LIBSTROKE" = "yes"; then
291    AC_DEFINE(HAS_LIBSTROKE, 1, [Define if you have libstroke installed])
292    if eval "test x$opt_stroke = x"; then
293        LIBSTROKE_LIBS="-lstroke"
294        LIBSTROKE_CFLAGS=""
295    else
296        LIBSTROKE_LIBS="$LIBSTROKE_LIBS -lstroke"
297        # LIBSTROKE_CFLAGS set above
298    fi
301 if test "$no_stroke" = "yes"; then
302    echo "**                                **"
303    echo "** Disabling libstroke by request **"
304    echo "**                                **"
305    LIBSTROKE_LIB=""
306    LIBSTROKE_CFLAGS=""
307    LIBSTROKE="no"
311 # Check for libstroke end
312 ############################################################################
314 ############################################################################
315 # Check for doxygen, indent start
317 # Doxygen is a utility for generating html and latex documentation
318 # from c source code files.
320 # search for Doxygen
321 AC_PATH_PROG(DOXYGEN, doxygen, no, ${PATH})
323 if test "$DOXYGEN" = "no"; then 
324    # doxygen is not available on the system
325    echo "** Cannot find Doxygen! **"
326    echo "**   Documentation creation disabled    **"
327    DOXYGEN=echo
329    # prevent from weaving the nw files
330    # but does not prevent from processing gschemdoc
331    builddoc=false
332 else 
333    # doxygen is available on the system.
334    # now checking if the tools for Texinfo files processing
335    # is installed.
336    # The docs can be either processed to produce dvi, html or info
337    # with texi2dvi, texi2html or makeinfo respectively
338    # Note : these tests on makeinfo and texi2dvi are no more 
339    #        needed as automake makes them for us
341    # enable the creation of html and latex documents.
342    builddoc=true
345 # depending on variable builddoc, weaving is performed or not
346 # using conditionnal in docs/Makefile.in
347 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
349 # search for indent
350 AC_PATH_PROG(INDENT, indent, no, ${PATH})
352 if ! test "$INDENT" = "no"; then 
353    indentversion=`$INDENT --version | grep GNU`
354 else 
355    indentversion=
358 if test "$INDENT" = "no" -o "$indentversion"x = x; then 
359   AC_PATH_PROG(GINDENT, gindent, no, ${PATH})
360   if test "$GINDENT" = "no"; then 
361     echo "** Cannot find GNU indent or gindent, C code formatting disabled **"
362     INDENT=echo
363   else
364     INDENT=$GINDENT
365   fi
369 # Check for doxygen, indent end
370 #########################################################################
372 #########################################################################
373 # Check for groff start
376 # search for groff
377 AC_PATH_PROG(GROFF, groff, no, ${PATH})
378 if test $GROFF = "no"; then
379         echo "Cannot find groff, some documentation will not be created."
383 # Check for groff end
384 #########################################################################
386 #########################################################################
387 # Checks for header files start
389 AC_HEADER_STDC
390 AC_HEADER_SYS_WAIT
391 AC_HEADER_DIRENT
392 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
393                  stdarg.h assert.h fcntl.h errno.h sys/param.h)
395 # Checks for typedefs, structures, and compiler characteristics.
396 AC_C_CONST
398 # Checks for library functions.
399 AC_TYPE_SIGNAL
400 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
402 AC_MSG_CHECKING([for optarg in unistd.h])
403 AC_TRY_COMPILE(
404 [#include <unistd.h>],
405 [ char *string = optarg; int i = optind; ],
406 optarg_found=yes,
407 optarg_found=no)
408 AC_MSG_RESULT($optarg_found)
410 if test $optarg_found = yes; then
411     AC_DEFINE(OPTARG_IN_UNISTD, 1, [Define if you have optarg in unistd.h])
415 # Checks for header files end
416 #########################################################################
418 #########################################################################
421 # ------------- dmalloc -------------------
422 dnl dmalloc checks
423 with_dmalloc="no"
424 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
425 AC_ARG_ENABLE([dmalloc],
426 [  --enable-dmalloc        Compile and link with dmalloc for malloc debugging [[default=no]]],
428 if test "X$enable_dmalloc" != "Xno" ; then
429         AC_MSG_RESULT([yes])
430         AC_CHECK_HEADER(dmalloc.h,,
431                 AC_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
432         AC_CHECK_LIB(dmalloc,main,,
433                 AC_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
434         DMALLOC_LIBS="-ldmalloc"
435         with_dmalloc="yes"
436 else
437         AC_MSG_RESULT([no])
438         DMALLOC_LIBS=""
442         AC_MSG_RESULT([no])
443         DMALLOC_LIBS=""
446 # ------------- ElectricFence -------------------
447 dnl ElectricFence checks
448 with_efence="no"
449 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
450 AC_ARG_ENABLE([efence],
451 [  --enable-efence         Link with ElectricFence for malloc debugging [[default=no]]],
453 if test "X$enable_efence" != "Xno" ; then
454         AC_MSG_RESULT([yes])
455         AC_CHECK_LIB(efence,main,,
456                 AC_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
457         with_efence="yes"
458 else
459         AC_MSG_RESULT([no])
463 AC_MSG_RESULT([no])
467 #########################################################################
468 #########################################################################
469 # gEDA/gaf specific setup start
472 DATADIR=gEDA
473 GEDADATADIR=$datadir/$DATADIR
475 if eval "test x$opt_rcdir = x"; then
476         # path was not specified with --with-rcdir
477         AC_DEFINE_UNQUOTED(GEDARCDIR, "none", [gEDA/gaf's rc directory])
478         GEDARCDIR=$GEDADATADIR
479 else
480         # path WAS specified with --with-rcdir
481         AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir", [gEDA/gaf's rc directory])
482         GEDARCDIR="$opt_rcdir"
485 # Expand the prefix variable
486 # I don't like the way this is done, but it works (I hope).
487 if eval "test x$prefix = xNONE"; then
488  dprefix=$ac_default_prefix
489 else
490  dprefix=$prefix
493 gedatopdir=$dprefix/share/$DATADIR
494 expandgedadatadir=`echo $gedatopdir`
496 gedadocdir=$dprefix/share/doc/geda-doc
497 # --with-docdir : tells where to store documentation if not default
498 AC_ARG_WITH(docdir,
499     [  --with-docdir      Where to store documentation if not default.],
500         gedadocdir=$withval)
501 expandgedadocdir=`echo $gedadocdir`
502 GEDADOCDIR=$expandgedadocdir
503 AC_SUBST(GEDADOCDIR)
505 # this has to be expanded ( no ${prefix} ) --
506 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir", [gEDA/gaf's data directory])
507 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Currently running version of gEDA/gaf])
510 # gEDA/gaf specify things which need to setup
511 #########################################################################
513 # Initialized gettext 
514 AM_GNU_GETTEXT
515 AM_GNU_GETTEXT_VERSION([%INSTALLED_GETTEXT_VERSION%])
517 # Finally create the final CFLAGS and LDFLAGS for use in the makefiles
518 GSCHEM_CFLAGS="$LIBSTROKE_CFLAGS $LIBGEDA_CFLAGS"
519 GSCHEM_LDFLAGS="$LIBSTROKE_LIBS $LIBGEDA_LIBS $GTK_LIBS $X_LDFLAGS $DMALLOC_LIBS" 
521 # Makefile.in variable substitution
522 AC_SUBST(GSCHEM_CFLAGS)
523 AC_SUBST(GSCHEM_LDFLAGS)
524 AC_SUBST(GEDADATADIR)
525 AC_SUBST(GEDARCDIR)
526 AC_SUBST(PATHSEP)
527 AC_SUBST(OTHERPATHSEP)
528 AC_SUBST(GUILEINTERP)
529 AC_SUBST(INDENT)
531 # Create all the necessary derived files
532 AC_CONFIG_FILES([Makefile 
533                 m4/Makefile 
534                 po/Makefile.in 
535                 intl/Makefile 
536                 src/Makefile
537                 include/Makefile
538                 scheme/Makefile
539                 bitmap/Makefile
540                 scripts/Makefile
541                 examples/Makefile
542                 docs/Makefile
543                 lib/Makefile
544                 tests/Makefile
545                 lib/system-gschemrc ])
548 AC_OUTPUT
550 expandedGEDADATADIR=`eval "echo $GEDADATADIR"`
551 expandedGEDARCDIR=`eval "echo $GEDARCDIR"`
552 expandedGEDADOCDIR=`eval "echo $GEDADOCDIR"`
554 AC_MSG_RESULT([
555 ** Configuration summary for $PACKAGE $VERSION:
557    GTK+ library version:             $GTK_VERSION
558    GUILE library version:            $GUILE_VERSION
559    libgeda library version:          $LIBGEDA_VERSION
560    libstroke library:                $LIBSTROKE
561    libgd library:                    $LIBGD
562    mingw build:                      $MINGW
563    data directory:                   $expandedGEDADATADIR
564    rc directory:                     $expandedGEDARCDIR
565    documentation directory:          $expandedGEDADOCDIR
566    dmalloc debugging:                $with_dmalloc
567    ElectricFence debugging:          $with_efence