Check for dlopen in -ldl. This is used by the TinyScheme dynamic
[geda-gerbv.git] / configure.ac
blob180b910bfb18eaa91989053478b1387d70cd2692
1 dnl configuration script for gerbv
2 dnl
3 dnl  gEDA - GNU Electronic Design Automation
4 dnl  This file is part of gerbv.
5 dnl
6 dnl    Copyright (C) 2000-2001 Stefan Petersen (spe@stacken.kth.se)
7 dnl
8 dnl  $Id$
9 dnl
10 dnl  This program is free software; you can redistribute it and/or modify
11 dnl  it under the terms of the GNU General Public License as published by
12 dnl  the Free Software Foundation; either version 2 of the License, or
13 dnl  (at your option) any later version.
14 dnl
15 dnl  This program is distributed in the hope that it will be useful,
16 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 dnl  GNU General Public License for more details.
19 dnl
20 dnl  You should have received a copy of the GNU General Public License
21 dnl  along with this program; if not, write to the Free Software
22 dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
25 AC_INIT([gerbv], [2.5A])
26 AC_CONFIG_SRCDIR([src/gerbv.c])
27 AC_PREREQ([2.59])
28 AM_INIT_AUTOMAKE([1.9])
30 dnl Create a configuration header 
31 AM_CONFIG_HEADER([config.h])
33 dnl Initialize maintainer mode
34 AM_MAINTAINER_MODE
37 ############################################################
39 # Checks for cygwin/mingw32
42 AC_CANONICAL_HOST
45 # if you want -mno-cygwin, then add it to MINGW_CFLAGS or CYGWIN_CFLAGS
46 # in your configure environment.  After all you may or may not
47 # want to always force -mno-cygwin on all users.
48 AC_MSG_CHECKING([for windows])
49 WIN32=${WIN32:-no}
50 case $host_os in
51         *cygwin*  )
52                 CFLAGS="$CFLAGS ${CYGWIN_CFLAGS}"
53                 CPPFLAGS="$CPPFLAGS ${CYGWIN_CPPFLAGS}"
54                 ;;
56         *mingw32* )
57                 WIN32=yes
58                 CFLAGS="$CFLAGS ${MINGW_CFLAGS:--mms-bitfields -mwindows}"
59                 CPPFLAGS="$CPPFLAGS ${MINGW_CPPFLAGS:--mms-bitfields -mwindows}"
60                 ;;
61 esac
63 AC_MSG_RESULT([$WIN32])
64 AC_SUBST(WIN32)
65 AM_CONDITIONAL(WIN32, test x$WIN32 = xyes)
67 GERBV_PATH_DELIMETER=":"
68 GERBV_DIR_SEPARATOR_S="/"
69 GERBV_DIR_SEPARATOR_C='/'
70 if test "x$WIN32" = "xyes" ; then
71    GERBV_PATH_DELIMETER=";"
72    GERBV_DIR_SEPARATOR_S="\\\\"
73    GERBV_DIR_SEPARATOR_C='\\'
76 AC_DEFINE_UNQUOTED(GERBV_DIR_SEPARATOR_C,'$GERBV_DIR_SEPARATOR_C',[Directory separator char])
77 AC_DEFINE_UNQUOTED(GERBV_DIR_SEPARATOR_S,"$GERBV_DIR_SEPARATOR_S",[Directory separator string])
78 AC_DEFINE_UNQUOTED(GERBV_PATH_DELIMETER,"$_PATH_DELIMETER",[Search path separator string])
83 ############################################################
85 ############################################################
86
87 # Checks for our configure args
90 dnl --enable-debug
91 debug=0
92 AC_ARG_ENABLE(debug,
93     [  --enable-debug          Enable fairly verbose debug output],
94     [
95         if test $enableval = "yes"; then
96                 debug=1
97         fi
98     ],
99     [
100         debug=0
101     ])
102 AC_DEFINE_UNQUOTED(DEBUG, $debug, [Define to 1 to enable debugging code])
104 dnl --enable-unit-mm : Set default unit for coordinates in status bar to mm
105 AC_ARG_ENABLE(unit-mm,
106     [  --enable-unit-mm        Set default unit for coordinates in status bar to mm],
107     [
108         if test "$enableval" = "yes"; then
109                 default_unit="mm"
110         fi
111     ])
112 if test "$default_unit" = "mm"; then
113         AC_DEFINE(GERBV_DEFAULT_UNIT, GERBV_MMS, [Default unit to display in statusbar])
114 else
115         AC_DEFINE(GERBV_DEFAULT_UNIT, GERBV_MILS, [Default unit to display in statusbar])
120 ############################################################
123 ############################################################
125 # Preliminary checks
128 dnl Build time sanity check... (?)
129 AM_SANITY_CHECK
131 dnl Checks for programs.
132 AC_PROG_CC
133 AC_PROG_MAKE_SET
134 AC_PROG_INSTALL
135 AC_PROG_LIBTOOL
137 if test "x$WIN32" = "xyes" ; then
138         AC_CHECK_TOOL(WINDRES, windres, no)
139         if test "$WINDRES" = "no"; then
140                 AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
141         fi
144 # if we have gcc then add -Wall
145 if test "x$GCC" = "xyes"; then
146         if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
147                 CFLAGS="$CFLAGS -Wall"
148         fi
151 # Check for ImageMagick tools used by the testsuite
152 AC_PATH_PROG(IM_ANIMATE, animate, notfound)
153 AC_PATH_PROG(IM_COMPARE, compare, notfound)
154 AC_PATH_PROG(IM_COMPOSITE, composite, notfound)
155 AC_PATH_PROG(IM_CONVERT, convert, notfound)
156 AC_PATH_PROG(IM_DISPLAY, display, notfound)
157 AC_PATH_PROG(IM_MONTAGE, montage, notfound)
158 missing_magick=""
159 test "${IM_ANIMATE}" != "notfound" || missing_magick="${missing_magick} animate"
160 test "${IM_COMPARE}" != "notfound" || missing_magick="${missing_magick} compare"
161 test "${IM_COMPOSITE}" != "notfound" || missing_magick="${missing_magick} composite"
162 test "${IM_CONVERT}" != "notfound" || missing_magick="${missing_magick} convert"
163 test "${IM_DISPLAY}" != "notfound" || missing_magick="${missing_magick} display"
164 test "${IM_MONTAGE}" != "notfound" || missing_magick="${missing_magick} montage"
166 AC_MSG_CHECKING([if all ImageMagick tools needed for the testsuite were found])
167 if test "X${missing_magick}" != "X" ; then
168         AC_MSG_RESULT([no.  The testsuite will be disabled because the following
169 tools from the ImageMagick suite were not found:
170 ${missing_magick}
171 No loss in gerbv functionality should be experienced, you just will not
172 be able to run the regression testsuite.
174         have_magick=no
175 else
176         AC_MSG_RESULT([yes])
177         have_magick=yes
179 AM_CONDITIONAL(HAVE_MAGICK, test x$have_magick = xyes)
181 # Check for pkg-config
182 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
183 if test "$PKG_CONFIG" = "no"; then
184         AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
185 fi      
190 ############################################################
192 ############################################################
194 # Library checks
197 AC_CHECK_LIB(m, sin)
199 # used by src/dynload.c (part of tinyscheme)
200 AC_CHECK_LIB(dl, dlopen)
204 ############################################################
206 ############################################################
208 # GTK and cairo checks
212 PKG_CHECK_MODULES(CAIRO, cairo >= 1.2.0, , [AC_MSG_ERROR([
213 *** Cairo > 1.2.0 required but not found. ***
214 Please review the following errors:
215 $CAIRO_PKG_ERRORS])]
218 CAIRO_VER=`$PKG_CONFIG cairo --modversion`
220 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0, , [AC_MSG_ERROR([
221 *** GTK >= 2.4.0 is required but was not found.  Please review
222 the following errors:
223 $GTK_PKG_ERRORS])]
226 GTK_VER=`$PKG_CONFIG gtk+-2.0 --modversion`
230 ############################################################
233 ############################################################
235 # ElectricFence
236 with_efence=no
237 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
238 AC_ARG_ENABLE([efence], 
239 [  --enable-efence         Link with ElectricFence for malloc debugging [default=no]],
241 if test "X$enable_efence" != "Xno" ; then
242         AC_MSG_RESULT([yes])
243         AC_CHECK_LIB(efence,main,,
244         AC_MSG_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
245                 with_efence=yes
246 else    
247         AC_MSG_RESULT([no])
248 fi      
251 AC_MSG_RESULT([no])
256 ############################################################
258 ######################################################################
260 # desktop integration
263 AC_PATH_PROG(SETENV, env, [])
264 AC_PATH_PROG(GTK_UPDATE_ICON_CACHE_BIN, gtk-update-icon-path, [true])
266 # Change default location for XDG files (MIME and Icons)
267 AC_ARG_WITH(xdgdatadir, [  --with-xdgdatadir=path  Change where the theme icons 
268 and mime registrations are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
270 if test x$opt_xdgdatadir = x; then
271         # path was not specified with --with-xdgdatadir
272         XDGDATADIR='${datadir}'
273 else
274         # path WAS specified with --with-xdgdatadir
275         XDGDATADIR="$opt_xdgdatadir"
277 AC_SUBST(XDGDATADIR)
279 AC_ARG_ENABLE(update-desktop-database,
280         AC_HELP_STRING([--disable-update-desktop-database],
281         [do not update desktop database after installation]),,
282         enable_update_desktop_database=yes)
284 AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE, test x$enable_update_desktop_database = xyes)
286 if test x$enable_update_desktop_database = xyes ; then
287         AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
288         if test $UPDATE_DESKTOP_DATABASE = no; then
289         AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
290         fi
294 ######################################################################
296 AC_CHECK_HEADERS(unistd.h getopt.h string.h sys/mman.h sys/types.h sys/stat.h stdlib.h regex.h libgen.h time.h)
298 AC_CHECK_FUNCS(getopt_long)
299 AC_CHECK_FUNCS(strlwr)
301 # for lrealpath.c
302 AC_CHECK_FUNCS(realpath canonicalize_file_name)
303 libiberty_NEED_DECLARATION(canonicalize_file_name)
306 CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS $GTK_CFLAGS $CAIRO_CFLAGS"
307 LIBS="$LIBS $GDK_PIXBUF_LIBS $GTK_LIBS $CAIRO_LIBS"
310 ############################################################
312 # scheme configure stuff
315 AC_DEFINE([STANDALONE], [0],[Scheme interpreter not used standalone])
316 AC_DEFINE([USE_DL],[1],[Dynamic linking in Scheme interpreter])
317 AC_DEFINE([SUN_DL],[1],[DL Sun method])
318 AC_DEFINE([USE_MATH],[1],[Math in Scheme interpreter])
319 AC_DEFINE([USE_ASCII_NAMES],[1],[ASCII names in Scheme interpreter])
320 AC_DEFINE([USE_COLON_HOOKS],[1],[Colon Hooks in Scheme interpreter])
321 AC_DEFINE([USE_STRING_HOOKS],[1],[String Hooks in Scheme interpreter])
322 AC_DEFINE([USE_INTERFACE],[1],[Use extension interface of Scheme interpreter])
326 ############################################################
328 ############################################################
330 # Figure out relative paths
333 # standard autoconf variables
334 CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\""
335 CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\""
337 # these relative paths will be used to help locate init.scm
338 # in the event that the installation directory is relocated.
340 AC_MSG_CHECKING([for the bindir to datadir relative path])
341 adl_COMPUTE_RELATIVE_PATHS([bindir:datadir:bindir_to_datadir])
342 adl_NORMALIZE_PATH([bindir_to_datadir], [$GERBV_DIR_SEPARATOR_S])
343 AC_MSG_RESULT([$bindir_to_datadir])
344 AC_DEFINE_UNQUOTED(BINDIR_TO_DATADIR, "$bindir_to_datadir", [Relative path from bindir to datadir])
346 PKGDATADIR=${datadir}/${PACKAGE}
347 AC_MSG_CHECKING([for the bindir to pkgdatadir relative path])
348 adl_COMPUTE_RELATIVE_PATHS([bindir:PKGDATADIR:bindir_to_pkgdatadir])
349 adl_NORMALIZE_PATH([bindir_to_pkgdatadir], [$GERBV_DIR_SEPARATOR_S])
350 AC_MSG_RESULT([$bindir_to_pkgdatadir])
351 AC_DEFINE_UNQUOTED(BINDIR_TO_PKGDATADIR, "$bindir_to_pkgdatadir", [Relative path from bindir to pkgdatadir])
353 AC_MSG_CHECKING([for the bindir to exec_prefix relative path])
354 adl_COMPUTE_RELATIVE_PATHS([bindir:exec_prefix:bindir_to_execprefix])
355 adl_NORMALIZE_PATH([bindir_to_execprefix], [$GERBV_DIR_SEPARATOR_S])
356 AC_MSG_RESULT([$bindir_to_execprefix])
357 AC_DEFINE_UNQUOTED(BINDIR_TO_EXECPREFIX, "$bindir_to_execprefix", [Relative path from bindir to exec_prefix])
362 ############################################################
364 AC_OUTPUT(      Makefile \
365                 desktop/Makefile \
366                 doc/PNG-print/Makefile \
367                 doc/eagle/Makefile \
368                 doc/html/Makefile \
369                 doc/example-code/Makefile \
370                 doc/Makefile \
371                 example/eaglecad1/Makefile \
372                 example/nollezappare/Makefile \
373                 example/numpres/Makefile \
374                 example/jj/Makefile \
375                 example/dan/Makefile \
376                 example/ekf2/Makefile \
377                 example/exposure/Makefile \
378                 example/am-test/Makefile \
379                 example/cslk/Makefile \
380                 example/orcad/Makefile \
381                 example/Mentor-BoardStation/Makefile \
382                 example/pick-and-place/Makefile \
383                 example/polarity/Makefile \
384                 example/thermal/Makefile \
385                 example/trailing/Makefile \
386                 example/Makefile \
387                 man/Makefile \
388                 scheme/Makefile \
389                 src/Makefile \
390                 src/libgerbv.pc \
391                 win32/Makefile \
392                 test/Makefile \
393                 test/golden/Makefile \
394                 test/inputs/Makefile )
395         
396 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
398 AC_MSG_RESULT([
399 ** Configuration summary for $PACKAGE $VERSION:
401    PREFIX:                   $PREFIX
402    xdg data directory:       $expandedXDGDATADIR
404    CPPFLAGS:                 $CPPFLAGS
405    CFLAGS:                   $CFLAGS
406    LDFLAGS:                  $LDFLAGS
407    LIBS:                     $LIBS
409    GTK Version:              $GTK_VER
410    Cairo Version:            $CAIRO_VER
412    Electric Fence Debugging: $with_efence