1dnl configuration script for gerbv 2dnl 3dnl gEDA - GNU Electronic Design Automation 4dnl This file is part of gerbv. 5dnl 6dnl Copyright (C) 2000-2001 Stefan Petersen (spe@stacken.kth.se) 7dnl 8dnl $Id$ 9dnl 10dnl This program is free software; you can redistribute it and/or modify 11dnl it under the terms of the GNU General Public License as published by 12dnl the Free Software Foundation; either version 2 of the License, or 13dnl (at your option) any later version. 14dnl 15dnl This program is distributed in the hope that it will be useful, 16dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 17dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18dnl GNU General Public License for more details. 19dnl 20dnl You should have received a copy of the GNU General Public License 21dnl along with this program; if not, write to the Free Software 22dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA 23 24 25AC_INIT([gerbv], [2.7.0]) 26AC_CONFIG_SRCDIR([src/gerbv.c]) 27AC_PREREQ([2.59]) 28AM_INIT_AUTOMAKE([1.9]) 29AC_GNU_SOURCE 30AC_CONFIG_MACRO_DIR([m4]) 31 32dnl Create a configuration header 33AM_CONFIG_HEADER([config.h]) 34 35dnl Initialize maintainer mode 36AM_MAINTAINER_MODE 37 38dnl Internationalisation 39#AM_NLS 40#AM_GNU_GETTEXT 41#AM_GNU_GETTEXT_VERSION([0.19]) 42#AX_DESKTOP_I18N 43 44dnl man-page internationalization 45AC_PATH_PROG([po4a_gettextize],[po4a-gettextize]) 46AC_PATH_PROG([po4a_translate],[po4a-translate]) 47if test -z "$po4a_gettextize" -o -z "$po4a_translate" ; then 48 AC_MSG_WARN([po4a was not found. If you want to change and compile \ 49internationalized documentation, please install po4a]) 50else 51 have_po4a=yes 52fi 53 54dnl po4a depend on onsgmls (opensp) or nsgmls (sp) 55AC_PATH_PROG([onsgmls],[onsgmls]) 56if test -n "$onsgmls" ; then 57 have_onsgmls=yes 58fi 59 60AC_PATH_PROG([nsgmls],[nsgmls]) 61if test -n "$nsgmls" ; then 62 have_nsgmls=yes 63fi 64 65if test "x$have_nsgmls" = "x" -a "x$have_onsgmls" = "x"; then 66 AC_MSG_WARN([no onsgmls nor nsgmls was found. If you want to change \ 67and compile internationalized documentation, please install opensp or sp]) 68fi 69 70AM_CONDITIONAL(HAVE_PO4A, 71 test "x$have_po4a" = "xyes" -a "x$have_onsgmls" = "xyes" -o \ 72 "x$have_po4a" = "xyes" -a "x$have_nsgmls" = "xyes") 73 74############################################################ 75# 76# Checks for cygwin/mingw32 77# 78 79AC_CANONICAL_HOST 80 81 82# if you want -mno-cygwin, then add it to MINGW_CFLAGS or CYGWIN_CFLAGS 83# in your configure environment. After all you may or may not 84# want to always force -mno-cygwin on all users. 85AC_MSG_CHECKING([for windows]) 86WIN32=${WIN32:-no} 87case $host_os in 88 *cygwin* ) 89 CFLAGS="$CFLAGS ${CYGWIN_CFLAGS}" 90 CPPFLAGS="$CPPFLAGS ${CYGWIN_CPPFLAGS}" 91 ;; 92 93 *mingw32* ) 94 WIN32=yes 95 CFLAGS="$CFLAGS ${MINGW_CFLAGS:--mms-bitfields -mwindows}" 96 CPPFLAGS="$CPPFLAGS ${MINGW_CPPFLAGS:--mms-bitfields -mwindows}" 97 ;; 98esac 99 100AC_MSG_RESULT([$WIN32]) 101AC_SUBST(WIN32) 102AM_CONDITIONAL(WIN32, test x$WIN32 = xyes) 103 104GERBV_PATH_DELIMETER=":" 105GERBV_DIR_SEPARATOR_S="/" 106GERBV_DIR_SEPARATOR_C='/' 107if test "x$WIN32" = "xyes" ; then 108 GERBV_PATH_DELIMETER=";" 109 GERBV_DIR_SEPARATOR_S="\\\\" 110 GERBV_DIR_SEPARATOR_C='\\' 111fi 112 113AC_DEFINE_UNQUOTED(GERBV_DIR_SEPARATOR_C,'$GERBV_DIR_SEPARATOR_C',[Directory separator char]) 114AC_DEFINE_UNQUOTED(GERBV_DIR_SEPARATOR_S,"$GERBV_DIR_SEPARATOR_S",[Directory separator string]) 115AC_DEFINE_UNQUOTED(GERBV_PATH_DELIMETER,"$_PATH_DELIMETER",[Search path separator string]) 116 117 118# 119# 120############################################################ 121 122############################################################ 123# 124# Checks for our configure args 125# 126 127dnl --enable-debug 128debug=0 129AC_ARG_ENABLE(debug, 130 [ --enable-debug Enable fairly verbose debug output], 131 [ 132 if test $enableval = "yes"; then 133 debug=1 134 fi 135 ], 136 [ 137 debug=0 138 ]) 139AC_DEFINE_UNQUOTED(DEBUG, $debug, [Define to 1 to enable debugging code]) 140AC_DEFINE_UNQUOTED(GERBV_DEFAULT_BORDER_COEFF, 0.05, [Default border coefficient for export]) 141 142dnl --enable-unit-mm : Set default unit for coordinates in status bar to mm 143AC_ARG_ENABLE(unit-mm, 144 [ --enable-unit-mm Set default unit for coordinates in status bar to mm], 145 [ 146 if test "$enableval" = "yes"; then 147 default_unit="mm" 148 fi 149 ]) 150if test "$default_unit" = "mm"; then 151 AC_DEFINE(GERBV_DEFAULT_UNIT, GERBV_MMS, [Default unit to display in statusbar]) 152else 153 AC_DEFINE(GERBV_DEFAULT_UNIT, GERBV_MILS, [Default unit to display in statusbar]) 154fi 155 156# 157# 158############################################################ 159 160 161############################################################ 162# 163# Preliminary checks 164# 165 166dnl Build time sanity check... (?) 167AM_SANITY_CHECK 168 169dnl Checks for programs. 170AC_PROG_CC 171AC_PROG_CC_C99 172if test "x$enable_dxf " != "xno" ; then 173AC_PROG_CXX 174fi 175AC_PROG_MAKE_SET 176AC_PROG_INSTALL 177AC_PROG_LIBTOOL 178 179if test "x$WIN32" = "xyes" ; then 180 AC_CHECK_TOOL(WINDRES, windres, no) 181 if test "$WINDRES" = "no"; then 182 AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.]) 183 fi 184fi 185 186# if we have gcc then add -Wall 187if test "x$GCC" = "xyes"; then 188 if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then 189 CFLAGS="$CFLAGS -Wall" 190 fi 191fi 192 193# Check for ImageMagick tools used by the testsuite 194AC_PATH_PROG(IM_ANIMATE, animate, notfound) 195AC_PATH_PROG(IM_COMPARE, compare, notfound) 196AC_PATH_PROG(IM_COMPOSITE, composite, notfound) 197AC_PATH_PROG(IM_CONVERT, convert, notfound) 198AC_PATH_PROG(IM_DISPLAY, display, notfound) 199AC_PATH_PROG(IM_MONTAGE, montage, notfound) 200missing_magick="" 201test "${IM_ANIMATE}" != "notfound" || missing_magick="${missing_magick} animate" 202test "${IM_COMPARE}" != "notfound" || missing_magick="${missing_magick} compare" 203test "${IM_COMPOSITE}" != "notfound" || missing_magick="${missing_magick} composite" 204test "${IM_CONVERT}" != "notfound" || missing_magick="${missing_magick} convert" 205test "${IM_DISPLAY}" != "notfound" || missing_magick="${missing_magick} display" 206test "${IM_MONTAGE}" != "notfound" || missing_magick="${missing_magick} montage" 207 208AC_MSG_CHECKING([if all ImageMagick tools needed for the testsuite were found]) 209if test "X${missing_magick}" != "X" ; then 210 AC_MSG_RESULT([no. The testsuite will be disabled because the following 211tools from the ImageMagick suite were not found: 212${missing_magick} 213No loss in gerbv functionality should be experienced, you just will not 214be able to run the regression testsuite. 215]) 216 have_magick=no 217else 218 AC_MSG_RESULT([yes]) 219 have_magick=yes 220fi 221AM_CONDITIONAL(HAVE_MAGICK, test x$have_magick = xyes) 222 223# Check for pkg-config 224AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 225if test "$PKG_CONFIG" = "no"; then 226 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH]) 227fi 228 229# Check GSettings support 230GLIB_GSETTINGS 231 232# 233# 234# 235############################################################ 236 237############################################################ 238# 239# Library checks 240# 241 242AC_CHECK_LIB(m, sin) 243 244# used by src/dynload.c (part of tinyscheme) 245AC_CHECK_LIB(dl, dlopen) 246 247# 248# 249############################################################ 250 251############################################################ 252# 253# GTK and cairo checks 254# 255 256 257PKG_CHECK_MODULES(CAIRO, cairo >= 1.2.0, , [AC_MSG_ERROR([ 258*** Cairo > 1.2.0 required but not found. *** 259Please review the following errors: 260$CAIRO_PKG_ERRORS])] 261) 262 263CAIRO_VER=`$PKG_CONFIG cairo --modversion` 264 265PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0, , [AC_MSG_ERROR([ 266*** GTK >= 2.18.0 is required but was not found. Please review 267the following errors: 268$GTK_PKG_ERRORS])] 269) 270 271GTK_VER=`$PKG_CONFIG gtk+-2.0 --modversion` 272 273# 274# 275############################################################ 276 277############################################################ 278# 279# dxflib 280with_dxf=no 281AC_MSG_CHECKING([if dxf should be enabled]) 282AC_ARG_ENABLE([dxf], 283[ --enable-dxf Enable DXF via dxflib [[default=no]]], 284[ 285if test "X$enable_dxf " != "Xno" ; then 286 AC_MSG_RESULT([yes]) 287 AC_CHECK_LIB(dxflib,main,, 288 AC_MSG_ERROR([You have requested DXF support but -ldxflib could not be found])) 289 with_dxf=yes 290 291 AC_MSG_CHECKING([dxflib version]) 292 AC_LANG([C++]) 293 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 294#include <string.h> 295#include <dxflib/dl_dxf.h> 296#ifndef DL_VERSION 297# define DL_VERSION "undefined" 298#endif 299 ]], [[ 300if (!strncmp("2.2.", DL_VERSION, 4) 301 || !strncmp("2.5.", DL_VERSION, 4) 302 || !strncmp("3.12.", DL_VERSION, 5)) 303 return 0; 304 305return 1; 306 ]])], 307 AC_MSG_RESULT([yes]), 308 AC_MSG_ERROR([untested dxflib version])) 309else 310 AC_MSG_RESULT([no]) 311fi 312], 313[ 314AC_MSG_RESULT([no]) 315]) 316AM_CONDITIONAL(DXF, test x$with_dxf = xyes) 317 318# 319# 320############################################################ 321 322############################################################ 323# 324# ElectricFence 325with_efence=no 326AC_MSG_CHECKING([if ElectricFence debugging should be enabled]) 327AC_ARG_ENABLE([efence], 328[ --enable-efence Link with ElectricFence for malloc debugging [default=no]], 329[ 330if test "X$enable_efence" != "Xno" ; then 331 AC_MSG_RESULT([yes]) 332 AC_CHECK_LIB(efence,main,, 333 AC_MSG_ERROR([You have requested ElectricFence debugging but -lefence could not be found])) 334 with_efence=yes 335else 336 AC_MSG_RESULT([no]) 337fi 338], 339[ 340AC_MSG_RESULT([no]) 341]) 342 343# 344# 345############################################################ 346 347###################################################################### 348# 349# desktop integration 350# 351 352AC_PATH_PROG(SETENV, env, []) 353AC_PATH_PROG(GTK_UPDATE_ICON_CACHE_BIN, gtk-update-icon-path, [true]) 354 355# Change default location for XDG files (MIME and Icons) 356AC_ARG_WITH(xdgdatadir, [ --with-xdgdatadir=path Change where the theme icons 357and mime registrations are installed [[DATADIR]]], [opt_xdgdatadir=$withval]) 358 359if test x$opt_xdgdatadir = x; then 360 # path was not specified with --with-xdgdatadir 361 XDGDATADIR='${datadir}' 362else 363 # path WAS specified with --with-xdgdatadir 364 XDGDATADIR="$opt_xdgdatadir" 365fi 366AC_SUBST(XDGDATADIR) 367 368AC_ARG_ENABLE(update-desktop-database, 369 AC_HELP_STRING([--disable-update-desktop-database], 370 [do not update desktop database after installation]),, 371 enable_update_desktop_database=yes) 372 373AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE, test x$enable_update_desktop_database = xyes) 374 375if test x$enable_update_desktop_database = xyes ; then 376 AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no) 377 if test $UPDATE_DESKTOP_DATABASE = no; then 378 AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database]) 379 fi 380fi 381 382# 383###################################################################### 384 385AC_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) 386 387AC_CHECK_FUNCS(getopt_long) 388AC_CHECK_FUNCS(strlwr) 389 390# for lrealpath.c 391AC_CHECK_FUNCS(realpath canonicalize_file_name) 392libiberty_NEED_DECLARATION(canonicalize_file_name) 393 394 395CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS $GTK_CFLAGS $CAIRO_CFLAGS" 396LIBS="$LIBS $GDK_PIXBUF_LIBS $GTK_LIBS $CAIRO_LIBS" 397 398CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" 399 400############################################################ 401# 402# scheme configure stuff 403# 404 405AC_DEFINE([STANDALONE], [0],[Scheme interpreter not used standalone]) 406AC_DEFINE([USE_DL],[1],[Dynamic linking in Scheme interpreter]) 407AC_DEFINE([SUN_DL],[1],[DL Sun method]) 408AC_DEFINE([USE_MATH],[1],[Math in Scheme interpreter]) 409AC_DEFINE([USE_ASCII_NAMES],[1],[ASCII names in Scheme interpreter]) 410AC_DEFINE([USE_COLON_HOOKS],[1],[Colon Hooks in Scheme interpreter]) 411AC_DEFINE([USE_STRING_HOOKS],[1],[String Hooks in Scheme interpreter]) 412AC_DEFINE([USE_INTERFACE],[1],[Use extension interface of Scheme interpreter]) 413 414# 415# 416############################################################ 417 418############################################################ 419# 420# Figure out relative paths 421# 422 423# standard autoconf variables 424CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\"" 425CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\"" 426 427# these relative paths will be used to help locate init.scm 428# in the event that the installation directory is relocated. 429 430AC_MSG_CHECKING([for the bindir to datadir relative path]) 431adl_COMPUTE_RELATIVE_PATHS([bindir:datadir:bindir_to_datadir]) 432adl_NORMALIZE_PATH([bindir_to_datadir], [$GERBV_DIR_SEPARATOR_S]) 433AC_MSG_RESULT([$bindir_to_datadir]) 434AC_DEFINE_UNQUOTED(BINDIR_TO_DATADIR, "$bindir_to_datadir", [Relative path from bindir to datadir]) 435 436PKGDATADIR=${datadir}/${PACKAGE} 437AC_MSG_CHECKING([for the bindir to pkgdatadir relative path]) 438adl_COMPUTE_RELATIVE_PATHS([bindir:PKGDATADIR:bindir_to_pkgdatadir]) 439adl_NORMALIZE_PATH([bindir_to_pkgdatadir], [$GERBV_DIR_SEPARATOR_S]) 440AC_MSG_RESULT([$bindir_to_pkgdatadir]) 441AC_DEFINE_UNQUOTED(BINDIR_TO_PKGDATADIR, "$bindir_to_pkgdatadir", [Relative path from bindir to pkgdatadir]) 442 443AC_MSG_CHECKING([for the bindir to exec_prefix relative path]) 444adl_COMPUTE_RELATIVE_PATHS([bindir:exec_prefix:bindir_to_execprefix]) 445adl_NORMALIZE_PATH([bindir_to_execprefix], [$GERBV_DIR_SEPARATOR_S]) 446AC_MSG_RESULT([$bindir_to_execprefix]) 447AC_DEFINE_UNQUOTED(BINDIR_TO_EXECPREFIX, "$bindir_to_execprefix", [Relative path from bindir to exec_prefix]) 448 449 450# 451# 452############################################################ 453 454AC_OUTPUT( Makefile \ 455 src/Makefile \ 456 src/libgerbv.pc \ 457 scheme/Makefile \ 458 \ 459 share/glib-2.0/schemas/Makefile \ 460 desktop/Makefile \ 461 \ 462 doc/PNG-print/Makefile \ 463 doc/eagle/Makefile \ 464 doc/html/Makefile \ 465 doc/example-code/Makefile \ 466 doc/Makefile \ 467 man/Makefile \ 468 \ 469 \ 470 example/eaglecad1/Makefile \ 471 example/nollezappare/Makefile \ 472 example/numpres/Makefile \ 473 example/jj/Makefile \ 474 example/dan/Makefile \ 475 example/ekf2/Makefile \ 476 example/exposure/Makefile \ 477 example/am-test/Makefile \ 478 example/cslk/Makefile \ 479 example/orcad/Makefile \ 480 example/Mentor-BoardStation/Makefile \ 481 example/pick-and-place/Makefile \ 482 example/polarity/Makefile \ 483 example/thermal/Makefile \ 484 example/trailing/Makefile \ 485 example/Makefile \ 486 \ 487 test/Makefile \ 488 test/golden/Makefile \ 489 test/inputs/Makefile \ 490 \ 491 win32/Makefile \ 492 ) 493 494expandedXDGDATADIR=`eval "echo $XDGDATADIR"` 495 496AC_MSG_RESULT([ 497** Configuration summary for $PACKAGE $VERSION: 498 499 PREFIX: $PREFIX 500 xdg data directory: $expandedXDGDATADIR 501 502 CPPFLAGS: $CPPFLAGS 503 CFLAGS: $CFLAGS 504 LDFLAGS: $LDFLAGS 505 LIBS: $LIBS 506 507 GTK Version: $GTK_VER 508 Cairo Version: $CAIRO_VER 509 510 DXF via dxflib: $with_dxf 511 512 Electric Fence Debugging: $with_efence 513 514 ImageMagick: $have_magick 515 (for test suite) 516]) 517 518