1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([pcb], [1.99z])
4 AC_CONFIG_SRCDIR([src/draw.c])
6 AM_INIT_AUTOMAKE([1.9])
8 AM_CONFIG_HEADER([config.h])
10 ##########################################################################
12 # Try to figure out if we are building from git sources.
13 # If we are then unless building of the documentation has
14 # been disabled then just require the user have all the right
15 # tools. Users building from a tarball won't need latex, makeinfo,
16 # etc. but if you're already downloading development sources, then
17 # it is not unreasonable to require development tools. What motivated
18 # this is that using maintainer mode proved to cause regular confusion.
21 AC_MSG_CHECKING([if you are building from a git checkout])
23 if test -f $srcdir/.gitignore ; then
30 AM_CONDITIONAL(GIT_VERSION, test x$pcb_git_version = xyes)
32 AC_MSG_CHECKING([if you are building from a anoncvs checkout])
34 if test -f $srcdir/CVS/Root ; then
41 AM_CONDITIONAL(CVS_VERSION, test x$pcb_cvs_version = xyes)
42 AM_CONDITIONAL(GIT_OR_CVS_VERSION, test x$pcb_git_version = xyes -o x$pcb_cvs_version = xyes)
45 ##########################################################################
47 # See if we are supposed to build the docs
51 AC_MSG_CHECKING([if the documentation should be built])
53 [ --enable-doc Build and install the documentation [[default=yes]]],
55 if test "X$enable_doc" = "Xno" ; then
73 AC_MSG_CHECKING([if maintainer mode is required])
74 if test "$docs_yesno" = "yes" -a "$pcb_git_version" = "yes" ; then
75 AC_MSG_RESULT([yes -- the documentation build is enabled and your sources are from git])
76 enable_maintainer_mode=yes
84 dnl determine host type
86 AC_MSG_CHECKING(for windows)
87 PCB_PATH_DELIMETER=":"
88 PCB_DIR_SEPARATOR_S="/"
89 PCB_DIR_SEPARATOR_C='/'
92 CFLAGS="$CFLAGS ${CYGWIN_CFLAGS}"
93 CPPFLAGS="$CPPFLAGS ${CYGWIN_CPPFLAGS}"
98 CFLAGS="$CFLAGS ${MINGW_CFLAGS:--mms-bitfields -mwindows}"
99 CPPFLAGS="$CPPFLAGS ${MINGW_CPPFLAGS:--mms-bitfields -mwindows}"
107 AC_MSG_RESULT($WIN32)
109 AM_CONDITIONAL(WIN32, test x$WIN32 = xyes)
110 if test "x$WIN32" = "xyes" ; then
111 PCB_PATH_DELIMETER=";"
112 PCB_DIR_SEPARATOR_S="\\\\"
113 PCB_DIR_SEPARATOR_C='\\'
116 AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_C,'$PCB_DIR_SEPARATOR_C',[Directory separator char])
117 AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_S,"$PCB_DIR_SEPARATOR_S",[Directory separator string])
118 AC_DEFINE_UNQUOTED(PCB_PATH_DELIMETER,"$PCB_PATH_DELIMETER",[Search path separator string])
121 dnl Checks for programs.
124 if test "x$WIN32" = "xyes" ; then
125 AC_CHECK_TOOL(WINDRES, windres, [no])
126 if test "$WINDRES" = "no" ; then
127 AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
132 GETTEXT_PACKAGE=$PACKAGE
133 AH_TEMPLATE([GETTEXT_PACKAGE], [Name of this program's gettext domain])
134 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"])
135 AC_SUBST(GETTEXT_PACKAGE)
137 AM_GNU_GETTEXT_VERSION([0.14])
139 IT_PROG_INTLTOOL([0.35.0])
148 AC_PATH_PROG(LEX_PATH, $LEX, [notfound])
149 if test "$LEX_PATH" = "notfound" ; then
150 AC_MSG_ERROR([Couldn't find a usable lex program.
151 Please install flex which is available from
152 ftp://ftp.gnu.org/pub/non-gnu/flex/
158 AC_PATH_PROG(YACC_PATH, $YACC, [notfound])
159 if test "$YACC_PATH" = "notfound" ; then
160 AC_MSG_ERROR([Couldn't find a usable yacc program.
161 Please install bison which is available from
162 ftp://ftp.gnu.org/pub/gnu/bison/
170 # Used for building the icons
172 AC_PATH_PROG(XPMTOPPM, xpmtoppm, notfound)
173 AC_PATH_PROG(PPMTOWINICON, ppmtowinicon, notfound)
174 AC_PATH_PROG(CONVERT, convert, notfound)
176 ##########################################################################
179 if test "X$docs_yesno" = "Xyes" -a "X$pcb_git_version" = "Xyes" ; then
180 AC_PATH_PROG(MKINFO, makeinfo, no)
181 if test "X$MKINFO" != "Xno"; then
182 AC_MSG_CHECKING([for GNU makeinfo version >= 4.6])
183 v=`$MKINFO --version | grep "GNU texinfo"`
184 if test $? -ne 0; then
185 AC_MSG_RESULT([non-GNU])
189 if test "X$MKINFO" != "Xno"; then
190 vmajor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\1/'`
191 vminor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
192 AC_MSG_RESULT([$vmajor.$vminor])
193 if test "$vmajor" -lt 4 \
194 || (test "$vmajor" -eq 4 && test "$vminor" -lt 6); then
198 if test "X$MKINFO" = "Xno"; then
199 AC_MSG_ERROR([You have requested a build
200 of the documentation. For this to work, you must have version 4.6 or newer of
201 the GNU texinfo package. You seem to have
205 Please update to a newer version of texinfo or disable building of
206 the documentation with --disable-doc
210 AC_PATH_PROG(TEXI2DVI, texi2dvi, no)
211 if test "X$TEXI2DVI" = "Xno"; then
212 AC_MSG_ERROR([You have requested a build
213 of the documentation. For this to work, you must have the texi2dvi program
214 installed. Alternatively, you can disable building the documentation with
219 AC_PATH_PROG(PERL, perl, notfound)
220 if test "X$PERL" = "Xnotfound"; then
221 AC_MSG_ERROR([You have requested a build
222 of the documentation. For this to work, you must have perl installed.
223 Alternatively, you can disable building the documentation with
229 ##########################################################################
233 # FIXME: for now, only try to add -rdynamic if we're using gcc. We really
234 # need to figure out what the correct test is here. In the mean time, this
235 # should let things build with SunPRO again.
236 if test "x$GCC" = "xyes"; then
237 AC_MSG_CHECKING([If the compiler accepts -rdynamic])
238 old_LDFLAGS="$LDFLAGS"
239 LDFLAGS="$LDFLAGS -rdynamic"
240 AC_LINK_IFELSE([int main(){}],
241 [AC_MSG_RESULT([yes])],
242 [LDFLAGS="$old_LDFLAGS"
247 # ------------- HID config -------------------
254 for hid in `cd $srcdir/src/hid; echo *`; do
255 F=$srcdir/src/hid/$hid/hid.conf
261 gui ) hid_guis="$hid_guis $hid" ;;
262 printer ) hid_printers="$hid_printers $hid" ;;
263 export ) hid_exporters="$hid_exporters $hid" ;;
264 always ) hid_always="$hid_always $hid" ;;
269 AC_MSG_CHECKING([for which gui to use])
271 [ --with-gui= Specify the GUI to use: batch gtk lesstif [[default=gtk]]],
275 AC_MSG_RESULT([$with_gui])
276 case " $hid_guis no none " in
277 *\ $with_gui\ * ) HIDLIST="$with_gui" ;;
278 * ) AC_MSG_ERROR([$with_gui is not a valid gui]) ;;
281 if test x"$with_gui" = x"none" -o x"$with_gui" = x"no"
286 AC_MSG_CHECKING([whether to enable toporouter])
287 AC_ARG_ENABLE([toporouter],
288 [AS_HELP_STRING([--enable-toporouter], [build toporouter [default=yes]]) ]
290 AS_CASE(["x$enable_toporouter"],[xyes | xno],,
291 [enable_toporouter=yes
294 AC_MSG_RESULT([$enable_toporouter])
295 AM_CONDITIONAL([WITH_TOPOROUTER], test $enable_toporouter != no)
297 AC_MSG_CHECKING([whether to enable toporouter output])
298 AC_ARG_ENABLE([toporouter-output],
299 [AS_HELP_STRING([--enable-toporouter-output], [enable toporouter graphical output [default=no]]) ]
301 AS_CASE(["z$enable_toporouter_output"],[zyes | zno],,
302 [enable_toporouter_output=no]
304 AC_MSG_RESULT([$enable_toporouter_output])
305 AS_CASE([$enable_toporouter_output],[yes],
307 topo_output_enabled=1
310 topo_output_enabled=0
313 AC_DEFINE_UNQUOTED([TOPO_OUTPUT_ENABLED], [$topo_output_enabled],
314 [Define to 1 to enable toporouter graphical output]
317 PKG_PROG_PKG_CONFIG()
319 if test "x$enable_toporouter_output" = "xyes"; then
320 PKG_CHECK_MODULES(CAIRO, cairo,,
321 [AC_MSG_ERROR([Cannot find cairo, needed by the toporouter
322 Please review the following errors:
327 AC_MSG_CHECKING([for whether to use DBUS])
328 AC_ARG_ENABLE([dbus],
329 [ --enable-dbus Enable DBUS IPC],
332 AC_MSG_RESULT([$enable_dbus])
333 AM_CONDITIONAL(WITH_DBUS, test x$enable_dbus = xyes)
335 if test "x$enable_dbus" = "xyes"; then
336 case " $with_gui " in
339 * ) AC_MSG_ERROR([DBUS enabled but only works with a mainloop capable GUI HID.
340 Either do not use --enable-dbus or enable the gtk or lesstif GUI HID.])
343 PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.61,
345 LIBS="$LIBS $DBUS_LIBS"
346 AC_CHECK_FUNCS(dbus_watch_get_unix_fd)
347 LIBS="$saved_LIBS" ],
348 [AC_MSG_ERROR([Cannot find dbus-1 >= 0.61, install it and rerun ./configure
349 Please review the following errors:
352 DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
354 AC_DEFINE([HAVE_DBUS], 1,
355 [Define to 1 if DBUS IPC is to be compiled in])
359 AC_MSG_CHECKING([for which printer to use])
360 AC_ARG_WITH([printer],
361 [ --with-printer= Specify the printer: lpr [[default=lpr]]],
362 [],[with_printer=lpr])
363 AC_MSG_RESULT([$with_printer])
364 case " $hid_printers " in
365 *\ $with_printer\ * )
366 HIDLIST="$HIDLIST $with_printer"
368 * ) AC_MSG_ERROR([$with_printer is not a valid printer]) ;;
371 AC_MSG_CHECKING([for which exporters to use])
372 AC_ARG_WITH([exporters],
373 [ --with-exporters= Enable export devices: bom gerber nelma png ps [[default=bom gerber nelma png ps]]],
374 [],[with_exporters=$hid_exporters])
375 AC_MSG_RESULT([$with_exporters])
376 for e in `echo $with_exporters | sed 's/,/ /g'`; do
377 case " $hid_exporters " in
379 HIDLIST="$HIDLIST $e"
381 * ) AC_MSG_ERROR([$e is not a valid exporter]) ;;
385 if test "X$enable_jpeg" = "Xno" -a "X$enable_gif" = "Xno" -a "X$enable_png" = "Xno" ; then
386 case " ${HIDLIST} " in
388 AC_MSG_ERROR([you have requested the png HID but turned off all output
389 formats! If you do not want gif/jpeg/png output, use --with-exporters to list
390 which exporters you want and do not list png there.])
398 for hid in $HIDLIST; do
399 F=$srcdir/src/hid/$hid/hid.conf
401 echo checking $hid depedencies
405 if test "X`echo $HIDLIST | grep $dep`" = "X"; then
406 AC_MSG_ERROR([you have requested the $hid HID but not the $dep HID, which it depends on])
412 for e in $HIDLIST; do
413 HIDLIBS="$HIDLIBS lib$e.a"
419 # ------------- end HID config -------------------
421 ######################################################################
423 # desktop integration
426 AC_PATH_PROG(SETENV, env, [])
427 AC_PATH_PROG(GTK_UPDATE_ICON_CACHE_BIN, gtk-update-icon-path, [true])
429 # Change default location for XDG files (MIME and Icons)
430 AC_ARG_WITH(xdgdatadir, [ --with-xdgdatadir=path Change where the theme icons
431 and mime registrations are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
433 # Change default location for KDE data files (KDE MIME registrations)
434 AC_ARG_WITH(kdedatadir, [ --with-kdedatadir=path Change where the KDE mime reg
435 istrations are installed [[DATADIR]]], [opt_kdedatadir=$withval])
437 if test x$opt_xdgdatadir = x; then
438 # path was not specified with --with-xdgdatadir
439 XDGDATADIR='${datadir}'
441 # path WAS specified with --with-xdgdatadir
442 XDGDATADIR="$opt_xdgdatadir"
446 if test x$opt_kdedatadir = x; then
447 # path was not specified with --with-kdedatadir
448 KDEDATADIR='${datadir}'
450 # path WAS specified with --with-kdedatadir
451 KDEDATADIR="$opt_kdedatadir"
455 AC_ARG_ENABLE(update-desktop-database,
456 AC_HELP_STRING([--disable-update-desktop-database],
457 [do not update desktop database after installation]),,
458 enable_update_desktop_database=yes)
460 AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE, test x$enable_update_desktop_database = xyes)
462 if test x$enable_update_desktop_database = xyes ; then
463 AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
464 if test $UPDATE_DESKTOP_DATABASE = no; then
465 AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
469 AC_ARG_ENABLE(update-mime-database,
470 AC_HELP_STRING([--disable-update-mime-database],
471 [do not update mime database after installation]),,
472 enable_update_mime_database=yes)
474 AM_CONDITIONAL(ENABLE_UPDATE_MIME_DATABASE, test x$enable_update_mime_database = xyes)
476 if test x$enable_update_mime_database = xyes ; then
477 AC_PATH_PROG(UPDATE_MIME_DATABASE, [update-mime-database], no)
478 if test $UPDATE_MIME_DATABASE = no; then
479 AC_MSG_ERROR([Cannot find update-mime-database, make sure it is installed and in your PATH, or configure with --disable-update-mime-database])
484 ######################################################################
486 AC_PATH_PROGS(M4, gm4 m4, [none])
487 if test "X$M4" = "Xnone" ; then
488 AC_MSG_ERROR([Did not find a m4 executible. You need to make sure
489 that m4 is installed on your system and that m4 is in your path])
491 AC_MSG_CHECKING([if $M4 has the division involving negative numbers bug])
492 pcb_m4_r=`echo "eval(-2/2)" | $M4`
493 if test "$pcb_m4_r" != "-1" ; then
495 AC_MSG_ERROR([It appears that $M4 has a bug involving division
496 with negative numbers. In particular it just returned the result that
497 -2/2 = $pcb_m4_r instead of -1. This is a known bug in GNU m4-1.4.9. Please
498 install a non-broken m4.])
504 AC_PATH_PROGS(WISH, wish wish83 wish8.3 wish80 wish8.0 cygwish83 cygwish80,[none])
505 if test "X$WISH" = "Xnone" ; then
506 AC_MSG_ERROR([Did not find the wish executible. You need to make sure
507 that tcl is installed on your system and that wish is in your path])
510 AC_DEFINE_UNQUOTED(M4,$M4,[m4 executible])
513 AC_DEFINE_UNQUOTED(GNUM4,"$M4",[m4 program used by pcb])
515 AC_PATH_PROG(LATEX, latex, notfound)
516 AM_CONDITIONAL(MISSING_LATEX, test x$LATEX = xnotfound)
518 AC_PATH_PROG(PDFLATEX, pdflatex, notfound)
519 AM_CONDITIONAL(MISSING_PDFLATEX, test x$PDFLATEX = xnotfound)
521 AC_PATH_PROG(DVIPS, dvips, notfound)
522 AM_CONDITIONAL(MISSING_DVIPS, test x$DVIPS = xnotfound)
524 AC_PATH_PROG(TEXI2DVI, texi2dvi, notfound)
525 AM_CONDITIONAL(MISSING_TEXI2DVI, test x$TEXI2DVI = xnotfound)
527 AC_PATH_PROG(PS2PDF, ps2pdf, notfound)
528 AM_CONDITIONAL(MISSING_PS2PDF, test x$PS2PDF = xnotfound)
530 # used to build some of the getting started guide
531 AC_PATH_PROG(GSCHEM, gschem, notfound)
532 AM_CONDITIONAL(MISSING_GSCHEM, test x$GSCHEM = xnotfound)
534 if test "X$docs_yesno" = "Xyes" -a "X$pcb_git_version" = "Xyes" ; then
535 if test "$LATEX" = "notfound" -o "$PDFLATEX" = "notfound" -o "$DVIPS" = "notfound" -o "$TEXI2DVI" = "notfound" -o "$PS2PDF" = "notfound" ; then
536 AC_MSG_ERROR([It appears that you are building from a source tree obtained
537 via git but you do not have the required tools installed to build the documentation. Here
538 is a list of tools and the detected values:
546 Either make sure these tools are installed or disable building and installing the documentation
547 by using the --disable-doc configure option.
552 ############################################################################
554 # These checks are for tools used by the testsuite. It will not be fatal
555 # if these are missing because this is primarily for developer use. It is
556 # possible that we might add some --enable flag in the future that forces
557 # full tools for development work.
559 # Check for ImageMagick tools used by the testsuite
560 AC_PATH_PROG(IM_ANIMATE, animate, notfound)
561 AC_PATH_PROG(IM_COMPARE, compare, notfound)
562 AC_PATH_PROG(IM_COMPOSITE, composite, notfound)
563 AC_PATH_PROG(IM_CONVERT, convert, notfound)
564 AC_PATH_PROG(IM_DISPLAY, display, notfound)
565 AC_PATH_PROG(IM_MONTAGE, montage, notfound)
567 test "${IM_ANIMATE}" != "notfound" || missing_magick="${missing_magick} animate"
568 test "${IM_COMPARE}" != "notfound" || missing_magick="${missing_magick} compare"
569 test "${IM_COMPOSITE}" != "notfound" || missing_magick="${missing_magick} composite"
570 test "${IM_CONVERT}" != "notfound" || missing_magick="${missing_magick} convert"
571 test "${IM_DISPLAY}" != "notfound" || missing_magick="${missing_magick} display"
572 test "${IM_MONTAGE}" != "notfound" || missing_magick="${missing_magick} montage"
574 AC_MSG_CHECKING([if all ImageMagick tools needed for the testsuite were found])
575 if test "X${missing_magick}" != "X" ; then
576 AC_MSG_RESULT([no. The testsuite will be disabled because the following
577 tools from the ImageMagick suite were not found:
579 No loss in pcb functionality should be experienced, you just will not
580 be able to run the full regression testsuite.
590 test $have_magick = yes || have_test_tools=no
592 # the RS274-X export HID is partially checked by looking at the result with
594 AC_PATH_PROG(GERBV, gerbv, notfound)
595 test $GERBV != notfound || have_test_tools=no
598 AM_CONDITIONAL(HAVE_TEST_TOOLS, test x$have_test_tools = xyes)
599 AC_MSG_CHECKING([if all the requried testsuite tools were found])
600 if test x$have_test_tools = xyes ; then
603 AC_MSG_RESULT([no -- the testsuite will be disabled])
608 ############################################################################
611 dnl Checks for libraries.
612 AC_CHECK_LIB(m, sqrt)
613 AC_CHECK_LIB(dl, dlopen)
614 AC_CHECK_LIB(xnet, gethostbyname)
615 AC_CHECK_LIB(fl, yywrap)
616 AC_CHECK_FUNCS(strerror)
617 AC_CHECK_FUNCS(regcomp re_comp)
618 AC_CHECK_FUNCS(logf expf rint)
619 AC_CHECK_FUNCS(vsnprintf)
620 AC_CHECK_FUNCS(getpwuid gethostname getcwd)
621 AC_CHECK_FUNCS(random)
624 AC_CHECK_FUNCS(mkdtemp)
626 # normally used for all file i/o
627 AC_CHECK_FUNCS(popen)
630 AC_CHECK_FUNCS(realpath canonicalize_file_name)
631 libiberty_NEED_DECLARATION(canonicalize_file_name)
634 AC_CHECK_HEADERS(limits.h locale.h string.h sys/types.h regex.h pwd.h)
635 AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h sys/param.h sys/times.h sys/wait.h)
636 AC_CHECK_HEADERS(dlfcn.h)
638 if test "x${WIN32}" = "xyes" ; then
639 AC_CHECK_HEADERS(windows.h)
642 PKG_CHECK_MODULES(GLIB, glib-2.0, ,
643 [AC_MSG_RESULT([Note: cannot find glib-2.0.
644 You may want to review the following errors:
648 for e in $HIDLIST; do
652 CPPFLAGS="$CFLAGS $X_CFLAGS"
653 AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS)
654 AC_CHECK_LIB(ICE, main, , , $X_LIBS)
655 AC_CHECK_LIB(SM, main, , , $X_LIBS)
656 AC_CHECK_LIB(Xext, main, , , $X_LIBS)
657 AC_CHECK_LIB(Xt, XtOpenDisplay, , , $X_LIBS)
658 AC_CHECK_LIB(Xmu, main, , , $X_LIBS)
659 AC_CHECK_LIB(Xpm, main, , , $X_LIBS)
660 AC_CHECK_LIB(Xm, XmCreateMainWindow, , , $X_LIBS)
661 case $ac_cv_lib_Xm_XmCreateMainWindow in
663 AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
667 AC_CHECK_HEADERS(Xm/Xm.h)
668 case $ac_cv_header_Xm_Xm_h in
670 AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
677 # Check for pkg-config
678 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
679 if test "$PKG_CONFIG" = "no"; then
680 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
683 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0, ,
684 [AC_MSG_ERROR([Cannot find gtk+ >= 2.4.0, install it and rerun ./configure
685 Please review the following errors:
688 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
690 # if we are building for gtk >= 2.8.0, we can use gdk_display_warp_pointer()
691 # otherwise we need XWarpPointer and we'll pull in the required headers with
692 # gdk/gdkx.h and we'll need to link with X11
693 if ! $PKG_CONFIG gtk+-2.0 --atleast-version=2.8.0 ; then
694 CPPFLAGS="$CFLAGS $GTK_CFLAGS"
695 AC_CHECK_HEADERS([gdk/gdkx.h])
698 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
702 # Check for gdlib-config for gd (www.boutell.com/gd)
703 AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, no)
704 if test "$GDLIB_CONFIG" = "no"; then
705 AC_MSG_RESULT([Cannot find gdlib-config.
706 Make sure it is installed and in your PATH.
707 gdlib-config is part of the GD library available from www.boutell.com/gd.
708 This is needed for the png HID. I will look for libgd anyway and maybe
711 if test "$WIN32" != "yes" ; then
712 AC_CHECK_LIB(gd,main,,
713 AC_MSG_ERROR([You have requested the nelma and/or png HID but -lgd could not be found]))
715 AC_CHECK_LIB(bgd,main,,
716 AC_MSG_ERROR([You have requested the nelma and/or png HID but -lbgd could not be found]))
719 if test "$WIN32" = "yes" ; then
724 AC_MSG_CHECKING([for libgd cflags])
725 GD_CFLAGS="`$GDLIB_CONFIG --cflags`"
726 AC_MSG_RESULT([$GD_CFLAGS])
727 AC_MSG_CHECKING([for libgd libs])
728 GD_LIBS="`$GDLIB_CONFIG --ldflags` `$GDLIB_CONFIG --libs` -l${GD}"
729 AC_MSG_RESULT([$GD_LIBS])
732 # since some linux systems evidently install gdlib-config but fail to
733 # install the headers (nice), check for the header too and fail if it
735 CFLAGS="$CFLAGS $GD_CFLAGS"
736 CPPFLAGS="$CPPFLAGS $GD_CFLAGS"
737 AC_CHECK_HEADERS(gd.h)
738 case $ac_cv_header_gd_h in
741 You evidentally do not have a complete installation of the GD library available from www.boutell.com/gd.
742 This is needed for the nelma and/or png HID.
748 # Some versions of gd (prior to the expiration of the
749 # patent related to gif compression) do not support
750 # gif output. Check for that here.
752 LIBS="$save_LIBS $GD_LIBS $X_LIBS"
754 AC_MSG_CHECKING([if GIF output from the png HID is desired])
756 [ --disable-gif Disable support for gif output when the png HID is used [[default=include gif support]]],
758 if test "X$enable_gif" != "Xno" ; then
770 if test "X$with_gif" = "Xyes" ; then
771 AC_CHECK_FUNCS(gdImageGif)
772 if test "$ac_cv_func_gdImageGif" != "yes"; then
773 AC_MSG_ERROR([Your gd installation does not appear to include gif support.
774 You may need to update your installation of gd or disable
775 gif export with --disable-gif])
779 AC_MSG_CHECKING([if JPEG output from the png HID is desired])
780 AC_ARG_ENABLE([jpeg],
781 [ --disable-jpeg Disable support for JPEG output when the png HID is used [[default=include JPEG support]]],
783 if test "X$enable_jpeg" != "Xno" ; then
795 if test "X$with_jpeg" = "Xyes" ; then
796 AC_CHECK_FUNCS(gdImageJpeg)
797 if test "$ac_cv_func_gdImageJpeg" != "yes"; then
798 AC_MSG_ERROR([Your gd installation does not appear to include JPEG support.
799 You may need to update your installation of gd or disable
800 JPEG export with --disable-jpeg])
805 AC_MSG_CHECKING([if PNG output from the png HID is desired])
807 [ --disable-png Disable support for PNG output when the png HID is used [[default=include PNG support]]],
809 if test "X$enable_png" != "Xno" ; then
821 if test "X$with_png" = "Xyes" ; then
822 AC_CHECK_FUNCS(gdImagePng)
823 if test "$ac_cv_func_gdImagePng" != "yes"; then
824 AC_MSG_ERROR([Your gd installation does not appear to include PNG support.
825 You may need to update your installation of gd or disable
826 PNG export with --disable-png])
836 AM_CONDITIONAL(PNG, test x$with_png = xyes)
837 AM_CONDITIONAL(GIF, test x$with_gif = xyes)
839 # ------------- check if png previews should be built for pcblib-newlib
840 AC_MSG_CHECKING([if the m4lib to newlib export should create png previews])
843 [ --enable-m4lib-png Enable creating png previews for the m4 library],
844 [],[enable_m4lib_png=no])
845 AC_MSG_RESULT([$enable_m4lib_png])
846 AM_CONDITIONAL(PNG_PREVIEW, test x$enable_m4lib_png = xyes)
849 # Run away.... more ugly stuff here. By default we don't actually build
850 # pcblib-newlib from pcblib unless we are building from cvs or git sources.
851 # The reason is it takes a while and requires the png HID. The problem is,
852 # what if someone wants to use --enable-m4lib-png but the tarball was built
853 # without the previews. Or, what if someone does not want the PNG previews
854 # but the person building the tarball included them. Ugh! So what the following
855 # code attempts to do is detect that mismatch situation. Note that we only
856 # want to kick this code in when *not* building from git or cvs sources.
857 build_pcblib_newlib=no
858 if test "$pcb_sources" = "tarball" ; then
859 AC_MSG_CHECKING([If pcblib-newlib was built with png previews])
860 stamp=$srcdir/lib/pcblib-newlib.stamp
861 if test ! -f ${stamp} ; then
862 AC_MSG_RESULT([unknown, missing ${stamp}])
863 build_pcblib_newlib=yes
865 if test "`cat ${stamp}`" = "png-preview=yes" ; then
867 # lib exists and built with preview.
868 # if we don't want the preview, than rebuild
869 if test x$enable_m4lib_png != xyes ; then
870 build_pcblib_newlib=yes
874 # lib exists and built without preview.
875 # if we want the preview, than rebuild
876 if test x$enable_m4lib_png = xyes ; then
877 build_pcblib_newlib=yes
882 build_pcblib_newlib=yes
884 AC_MSG_CHECKING([If pcblib-newlib needs to be rebuilt])
885 AC_MSG_RESULT([$build_pcblib_newlib])
886 AM_CONDITIONAL(BUILD_PCBLIB_NEWLIB, test x$build_pcblib_newlib = xyes)
888 if test "X$cross_compiling" = "Xyes" ; then
889 # we are cross compiling so we will need a build host binary for pcb
890 AC_PATH_PROG(PCB, [pcb], [notfound])
892 PCB="\${top_builddir}/src/pcb"
896 # now make see how essential it was that we have a pcb executable for the build
898 if test "X$pcb_git_version" = "Xyes" ; then
899 if test "X$docs_yesno" = "Xyes" -o "X$enable_m4lib_png" = "Xyes" ; then
900 if test "$PCB" = "notfound" ; then
901 AC_MSG_ERROR([You have selected a build with m4lib png
902 previews enabled and/or with building the documentation enabled but you also
903 appear to be cross-compiling. For this to work, you must have a pcb installed that
904 can run on this machine (the build machine) because it is needed for generating
905 library footprint png previews as well as some of the figures in the documentation.
906 If you wish to skip building the documentation and the footprint previews then add
907 --disable-doc --disable-m4lib-png
908 This will allow your cross build to work.])
913 # ------------- Xrender -------------------
915 AC_CHECK_LIB(Xrender,XRenderQueryExtension,have_xrender=yes,have_xrender=no,$X_LIBS)
917 AC_ARG_ENABLE([xrender],
918 [ --disable-xrender Compile and link with Xrender [default=yes]])
919 case "$have_xrender:$enable_xrender" in
923 X_LIBS="-lXrender $X_LIBS"
924 AC_DEFINE([HAVE_XRENDER], 1,
925 [Define to 1 if Xrender is available])
929 # ------------- dmalloc -------------------
932 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
933 AC_ARG_ENABLE([dmalloc],
934 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [default=no]],
936 if test "X$enable_dmalloc" != "Xno" ; then
938 AC_CHECK_HEADER(dmalloc.h,,
939 AC_MSG_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
940 AC_CHECK_LIB(dmalloc,main,,
941 AC_MSG_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
942 DMALLOC_LIBS="-ldmalloc"
954 # ------------- ElectricFence -------------------
955 dnl ElectricFence checks
957 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
958 AC_ARG_ENABLE([efence],
959 [ --enable-efence Link with ElectricFence for malloc debugging [default=no]],
961 if test "X$enable_efence" != "Xno" ; then
963 AC_CHECK_LIB(efence,main,,
964 AC_MSG_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
974 # ------------- Enable Debug code -------------------
975 AC_MSG_CHECKING([for whether to enable debugging code])
976 AC_ARG_ENABLE([debug],
977 [ --enable-debug Enable debugging code],
978 [],[enable_debug=no])
980 AC_MSG_RESULT([$enable_debug])
981 AM_CONDITIONAL(DEBUG_BUILD, test x$enable_debug = xyes)
984 # ------------- Complete set of CFLAGS and LIBS -------------------
986 CFLAGS="$CFLAGS $X_CFLAGS $DBUS_CFLAGS $GLIB_CFLAGS $GTK_CFLAGS $CAIRO_CFLAGS"
987 LIBS="$LIBS $XM_LIBS $DBUS_LIBS $X_LIBS $GLIB_LIBS $GTK_LIBS $DMALLOC_LIBS $GD_LIBS $INTLLIBS $CAIRO_LIBS"
990 # if we have gcc then add -Wall
991 if test "x$GCC" = "xyes"; then
992 # see about adding some extra checks if the compiler takes them
993 for flag in -Wall -Wdeclaration-after-statement ; do
994 case " ${CFLAGS} " in
996 # flag is already present
999 AC_MSG_CHECKING([if the compiler accepts ${flag}])
1000 ac_save_CFLAGS="$CFLAGS"
1001 CFLAGS="$CFLAGS ${flag}"
1002 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1003 [AC_MSG_RESULT([yes])],
1004 [AC_MSG_RESULT([no])
1005 CFLAGS="$ac_save_CFLAGS"
1014 FONTFILENAME=${FONTFILENAME:-"default_font"}
1015 AC_SUBST(FONTFILENAME)
1016 AC_DEFINE_UNQUOTED(FONTFILENAME,"$FONTFILENAME",[File for default font])
1018 # standard autoconf variables
1019 CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\""
1020 CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\""
1021 CPPFLAGS="$CPPFLAGS -DHOST=\\\"\${host}\\\""
1023 # directory for old-style library and for fonts
1024 PCBLIBDIR=${datadir}/pcb
1026 #AC_DEFINE_UNQUOTED(PCBLIBDIR,"$PCBLIBDIR",[Library directory])
1027 CPPFLAGS="$CPPFLAGS -DPCBLIBDIR=\\\"$PCBLIBDIR\\\""
1029 # name for old-style library
1030 LIBRARYFILENAME=pcblib
1031 AC_SUBST(LIBRARYFILENAME)
1032 AC_DEFINE_UNQUOTED(LIBRARYFILENAME,"$LIBRARYFILENAME",[library file name])
1035 # directory for new library
1036 PCBTREEDIR=${datadir}/pcb/newlib
1037 PCBTREEPATH=${PCBTREEDIR}:${PCBLIBDIR}/pcblib-newlib
1038 PCBTREEDIR=${PCBTREEDIR:-"$PCBTREEDIR"}
1039 AC_SUBST(PCBTREEDIR)
1040 AC_SUBST(PCBTREEPATH)
1041 #AC_DEFINE_UNQUOTED(PCBTREEDIR,"$PCBLIB",[top directory for new style pcb library])
1042 CPPFLAGS="$CPPFLAGS -DPCBTREEDIR=\\\"$PCBTREEDIR\\\""
1043 CPPFLAGS="$CPPFLAGS -DPCBTREEPATH=\\\"$PCBTREEPATH\\\""
1045 # Figure out relative paths
1046 AC_MSG_CHECKING([for the bindir to pcblibdir relative path])
1047 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBLIBDIR:bindir_to_pcblibdir])
1048 adl_NORMALIZE_PATH([bindir_to_pcblibdir], [$PCB_DIR_SEPARATOR_S])
1049 AC_MSG_RESULT([$bindir_to_pcblibdir])
1050 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBLIBDIR, "$bindir_to_pcblibdir", [Relative path from bindir to pcblibdir])
1052 AC_MSG_CHECKING([for the bindir to pcbtreedir relative path])
1053 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBTREEDIR:bindir_to_pcbtreedir])
1054 adl_NORMALIZE_PATH([bindir_to_pcbtreedir], [$PCB_DIR_SEPARATOR_S])
1055 AC_MSG_RESULT([$bindir_to_pcbtreedir])
1056 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBTREEDIR, "$bindir_to_pcbtreedir", [Relative path from bindir to pcbtreedir])
1059 AC_MSG_CHECKING([for the bindir to exec_prefix relative path])
1060 adl_COMPUTE_RELATIVE_PATHS([bindir:exec_prefix:bindir_to_execprefix])
1061 adl_NORMALIZE_PATH([bindir_to_execprefix], [$PCB_DIR_SEPARATOR_S])
1062 AC_MSG_RESULT([$bindir_to_execprefix])
1063 AC_DEFINE_UNQUOTED(BINDIR_TO_EXECPREFIX, "$bindir_to_execprefix", [Relative path from bindir to exec_prefix])
1066 BTNMOD=${BTNMOD:-"Mod1"}
1070 for dir in src lib newlib doc example tools tutorial README_FILES
1072 test -d $dir/. && TOPDIRS="$TOPDIRS $dir"
1076 AC_CONFIG_FILES(Makefile data/Makefile intl/Makefile po/Makefile.in)
1078 if test -d $srcdir/README_FILES; then
1079 AC_CONFIG_FILES(README_FILES/Makefile)
1081 if test -d $srcdir/doc; then
1082 AC_CONFIG_FILES(doc/Makefile)
1084 if test -d $srcdir/doc/gs; then
1085 AC_CONFIG_FILES(doc/gs/Makefile)
1086 AC_CONFIG_FILES(doc/gs/gafrc)
1087 AC_CONFIG_FILES(doc/gs/gschemrc)
1089 if test -d $srcdir/example; then
1090 AC_CONFIG_FILES(example/Makefile)
1091 AC_CONFIG_FILES(example/libraries/Makefile)
1093 if test -d $srcdir/lib; then
1094 AC_CONFIG_FILES(lib/CreateLibraryContents.sh)
1095 AC_CONFIG_FILES(lib/CreateLibrary.sh)
1096 AC_CONFIG_FILES(lib/ListLibraryContents.sh)
1097 AC_CONFIG_FILES(lib/Makefile)
1098 AC_CONFIG_FILES(lib/QueryLibrary.sh)
1099 AC_CONFIG_FILES(lib/qfp-ui)
1101 if test -d $srcdir/newlib; then
1102 AC_CONFIG_FILES(newlib/2_pin_thru-hole_packages/Makefile)
1103 AC_CONFIG_FILES(newlib/Makefile)
1104 AC_CONFIG_FILES(newlib/connectors/Makefile)
1105 AC_CONFIG_FILES(newlib/crystal/Makefile)
1106 AC_CONFIG_FILES(newlib/electro-optics/Makefile)
1107 AC_CONFIG_FILES(newlib/headers/Makefile)
1108 AC_CONFIG_FILES(newlib/keystone/Makefile)
1109 AC_CONFIG_FILES(newlib/msp430/Makefile)
1110 AC_CONFIG_FILES(newlib/not_vetted_ingo/Makefile)
1111 AC_CONFIG_FILES(newlib/sockets/Makefile)
1112 AC_CONFIG_FILES(newlib/tests/Makefile)
1114 AC_CONFIG_FILES(src/Makefile)
1115 AC_CONFIG_FILES(src/icons/Makefile)
1116 if test -d $srcdir/tools; then
1117 AC_CONFIG_FILES(tools/Makefile)
1119 if test -d $srcdir/tutorial; then
1120 AC_CONFIG_FILES(tutorial/Makefile)
1124 AC_CONFIG_FILES(tests/inputs/Makefile)
1125 AC_CONFIG_FILES(tests/golden/Makefile)
1126 AC_CONFIG_FILES(tests/golden/hid_bom1/Makefile)
1127 AC_CONFIG_FILES(tests/golden/hid_bom2/Makefile)
1128 AC_CONFIG_FILES(tests/golden/hid_bom3/Makefile)
1129 AC_CONFIG_FILES(tests/golden/hid_bom4/Makefile)
1130 AC_CONFIG_FILES(tests/golden/hid_gerber1/Makefile)
1131 AC_CONFIG_FILES(tests/golden/hid_gerber2/Makefile)
1132 AC_CONFIG_FILES(tests/golden/hid_png1/Makefile)
1133 AC_CONFIG_FILES(tests/Makefile)
1135 dnl win32 build scripts
1136 AC_CONFIG_FILES(win32/Makefile)
1140 with_gui=`echo $with_gui`
1141 with_printer=`echo $with_printer`
1142 with_exporters=`echo $with_exporters | sed 's/,/ /g'`
1144 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
1145 expandedKDEDATADIR=`eval "echo $KDEDATADIR"`
1148 ** Configuration summary for $PACKAGE $VERSION:
1151 Printer: $with_printer
1152 Exporters: $with_exporters
1153 Source tree distribution: $pcb_sources
1154 Build documentation: $docs_yesno
1155 Build toporouter: $enable_toporouter
1156 Enable toporouter output: $enable_toporouter_output
1157 xdg data directory: $expandedXDGDATADIR
1158 KDE data directory: $expandedKDEDATADIR
1159 dmalloc debugging: $with_dmalloc
1160 ElectricFence debugging: $with_efence
1162 Cross Compiling: $cross_compiling