src/compat.h: correction in header guard define.
[geda-pcb/pcjc2.git] / configure.ac
blobbd74db3e63765fdce265008240d60aeed3640ec0
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])
5 AC_PREREQ([2.60])
6 AM_INIT_AUTOMAKE([1.9])
7 AC_GNU_SOURCE
8 AC_CONFIG_HEADERS([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.
20 pcb_sources="tarball"
21 AC_MSG_CHECKING([if you are building from a git checkout])
22 pcb_git_version=no
23 if test -f $srcdir/.gitignore ; then
24         pcb_git_version=yes
25         AC_MSG_RESULT([yes])
26         pcb_sources="GIT"
27 else
28         AC_MSG_RESULT([no])
30 AM_CONDITIONAL(GIT_VERSION, test x$pcb_git_version = xyes)
32 AC_MSG_CHECKING([if you are building from a anoncvs checkout])
33 pcb_cvs_version=no
34 if test -f $srcdir/CVS/Root ; then
35         pcb_cvs_version=yes
36         AC_MSG_RESULT([yes])
37         pcb_sources="CVS"
38 else
39         AC_MSG_RESULT([no])
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
50 docs_yesno=yes
51 AC_MSG_CHECKING([if the documentation should be built])
52 AC_ARG_ENABLE([doc],
53 [  --enable-doc            Build and install the documentation [[default=yes]]],
55 if test "X$enable_doc" = "Xno" ; then
56         DOC=""
57         AC_MSG_RESULT([no])
58         docs_yesno=no
59 else
60         DOC=doc
61         AC_MSG_RESULT([yes])
62         docs_yesno=yes
66 DOC=doc
67 AC_MSG_RESULT([yes])
68 docs_yesno=yes
70 AC_SUBST(DOC)
73 dnl determine host type
74 AC_CANONICAL_HOST
75 AC_MSG_CHECKING(for windows)
76 PCB_PATH_DELIMETER=":"
77 PCB_DIR_SEPARATOR_S="/"
78 PCB_DIR_SEPARATOR_C='/'
79 case $host in
80         *-*-mingw* )
81                 WIN32=yes
82                 CFLAGS="$CFLAGS ${MINGW_CFLAGS:--mms-bitfields -mwindows}"
83                 CPPFLAGS="$CPPFLAGS ${MINGW_CPPFLAGS}"
84                 ;;
86         * )
87                 WIN32=no
88                 ;;
89 esac
91 AC_MSG_RESULT($WIN32)
92 AC_SUBST(WIN32)
93 AM_CONDITIONAL(WIN32, test x$WIN32 = xyes)
94 if test "x$WIN32" = "xyes" ; then
95         PCB_PATH_DELIMETER=";"
96         PCB_DIR_SEPARATOR_S="\\\\"
97         PCB_DIR_SEPARATOR_C='\\'
100 AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_C,'$PCB_DIR_SEPARATOR_C',[Directory separator char])
101 AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_S,"$PCB_DIR_SEPARATOR_S",[Directory separator string])
102 AC_DEFINE_UNQUOTED(PCB_PATH_DELIMETER,"$PCB_PATH_DELIMETER",[Search path separator string])
105 dnl Checks for programs.
106 AC_PROG_CC
107 AC_PROG_CXX
109 if test "x$WIN32" = "xyes" ; then
110         AC_CHECK_TOOL(WINDRES, windres, [no])
111         if test "$WINDRES" = "no" ; then
112                 AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
113         fi
116 # i18n
117 GETTEXT_PACKAGE=$PACKAGE
118 AH_TEMPLATE([GETTEXT_PACKAGE], [Name of this program's gettext domain])
119 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"])
120 AC_SUBST(GETTEXT_PACKAGE)
122 AM_GNU_GETTEXT_VERSION([0.14])
123 AM_GNU_GETTEXT
124 IT_PROG_INTLTOOL([0.35.0])
126 AC_C_INLINE
127 AC_PROG_CC_STDC
128 AM_PROG_CC_C_O
129 AC_PROG_CPP
130 AC_PROG_AWK
131 AC_PROG_MKDIR_P
133 AM_PROG_LEX
134 AC_PATH_PROG(LEX_PATH, $LEX, [notfound])
135 if test "$LEX_PATH" = "notfound" ; then
136         AC_MSG_ERROR([Couldn't find a usable lex program.
137 Please install flex which is available from
138 ftp://ftp.gnu.org/pub/non-gnu/flex/
143 AC_PROG_YACC
144 AC_PATH_PROG(YACC_PATH, $YACC, [notfound])
145 if test "$YACC_PATH" = "notfound" ; then
146         AC_MSG_ERROR([Couldn't find a usable yacc program.
147 Please install bison which is available from
148 ftp://ftp.gnu.org/pub/gnu/bison/
152 AC_PROG_INSTALL
153 AC_PROG_RANLIB
156 # Used for building the icons
158 AC_PATH_PROG(XPMTOPPM, xpmtoppm, notfound)
159 AC_PATH_PROG(PPMTOWINICON, ppmtowinicon, notfound)
160 AC_PATH_PROG(CONVERT, convert, notfound)
162 ##########################################################################
165 if test "X$docs_yesno" = "Xyes" -a "X$pcb_git_version" = "Xyes" ; then
166    AC_PATH_PROG(MKINFO, makeinfo, no)
167    if test "X$MKINFO" != "Xno"; then
168       AC_MSG_CHECKING([for GNU makeinfo version >= 4.6])
169       v=`$MKINFO --version | grep "GNU texinfo"`
170       if test $? -ne 0; then
171          AC_MSG_RESULT([non-GNU])
172          MKINFO="no"
173       fi
174    fi
175    if test "X$MKINFO" != "Xno"; then
176       vmajor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\1/'`
177       vminor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
178       AC_MSG_RESULT([$vmajor.$vminor])
179       if test "$vmajor" -lt 4 \
180               || (test "$vmajor" -eq 4 && test "$vminor" -lt 6); then
181          MKINFO=no
182       fi
183    fi
184    if test "X$MKINFO" = "Xno"; then
185       AC_MSG_ERROR([You have requested a build
186 of the documentation.  For this to work, you must have version 4.6 or newer of
187 the GNU texinfo package.  You seem to have
191 Please update to a newer version of texinfo or disable building of
192 the documentation with --disable-doc
194    fi
196    AC_PATH_PROG(TEXI2DVI, texi2dvi, no)
197    if test "X$TEXI2DVI" = "Xno"; then
198       AC_MSG_ERROR([You have requested a build
199 of the documentation.  For this to work, you must have the texi2dvi program
200 installed.  Alternatively, you can disable building the documentation with
201 --disable-doc.])
202    fi
205         AC_PATH_PROG(PERL, perl, notfound)
206         if test "X$PERL" = "Xnotfound"; then
207                         AC_MSG_ERROR([You have requested a build
208 of the documentation.  For this to work, you must have perl installed.
209 Alternatively, you can disable building the documentation with
210 --disable-doc.
212         fi
215    AC_PATH_PROG([KPSEWHICH], [kpsewhich], [no])
216    if test "X$KPSEWHICH" = "Xno"; then
217       AC_MSG_ERROR([You have requested a build
218 of the documentation.  For this to work, you must have a functional install of
219 TeX and LaTeX.  kpsewhich is part of TeX.
220 Alternatively, you can disable building the documentation with
221 --disable-doc.])
222    fi
224    AC_MSG_CHECKING([If your TeX installation contains epsf.tex])
225    f=`$KPSEWHICH epsf.tex`
226    if test $? -eq 0 ; then
227         AC_MSG_RESULT([yes ($f)])
228    else
229         AC_MSG_RESULT([no])
230         AC_MSG_ERROR([You have requested a build
231 of the documentation.  For this to work, you must have a functional install of
232 TeX and LaTeX that includes epsf.tex.  On some linux distributions this is
233 part of the texlive-generic-recommended package.
234 Alternatively, you can disable building the documentation with
235 --disable-doc.])
236    fi
240 ##########################################################################
244 # FIXME:  for now, only try to add -rdynamic if we're using gcc.  We really
245 # need to figure out what the correct test is here.  In the mean time, this
246 # should let things build with SunPRO again.
247 if test "x$GCC" = "xyes"; then
248 AC_MSG_CHECKING([If the compiler accepts -rdynamic])
249 old_LDFLAGS="$LDFLAGS"
250 LDFLAGS="$LDFLAGS -rdynamic"
251 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
252         [AC_MSG_RESULT([yes])],
253         [LDFLAGS="$old_LDFLAGS"
254         AC_MSG_RESULT([no])
255         ])
258 # ------------- HID config -------------------
260 hid_guis=""
261 hid_printers=""
262 hid_exporters=""
263 hid_always=""
265 for hid in `cd $srcdir/src/hid; echo *`; do
266     F=$srcdir/src/hid/$hid/hid.conf
267     if test -f $F 
268     then
269     echo checking $F
270         . $F
271         case $type in
272           gui ) hid_guis="$hid_guis $hid" ;;
273           printer ) hid_printers="$hid_printers $hid" ;;
274           export ) hid_exporters="$hid_exporters $hid" ;;
275           always ) hid_always="$hid_always $hid" ;;
276         esac
277     fi
278 done
280 AC_MSG_CHECKING([for which gui to use])
281 AC_ARG_WITH([gui],
282 [  --with-gui=            Specify the GUI to use: batch gtk lesstif [[default=gtk]]],
284 [with_gui=gtk]
286 AC_MSG_RESULT([$with_gui])
287 case " $hid_guis no none " in
288      *\ $with_gui\ * ) HIDLIST="$with_gui" ;;
289      * ) AC_MSG_ERROR([$with_gui is not a valid gui]) ;;
290 esac
292 if test x"$with_gui" = x"none" -o x"$with_gui" = x"no"
293 then
294     HIDLIST=
297 AC_MSG_CHECKING([whether to enable toporouter])
298 AC_ARG_ENABLE([toporouter],
299  [AS_HELP_STRING([--enable-toporouter], [build toporouter [default=yes]]) ]
301 AS_CASE(["x$enable_toporouter"],[xyes | xno],,
302  [enable_toporouter=yes
305 AC_MSG_RESULT([$enable_toporouter])
306 AM_CONDITIONAL([WITH_TOPOROUTER], test $enable_toporouter != no)
308 if test "x$enable_toporouter" = "xyes"; then
309   this_error_text="
310     You have requested to build with the toporouter.  For this to work you
311     must have the GTS library installed, typically found in packages named
312     'libgts-dev' or similar.
314     Alternatively you can disable the toporouter with --disable-toporouter."
315   # Testing for gts.h requires glib.h, which is tested for later. To not take
316   # apart toporouter related stuff and because testing for the library makes
317   # reasonably sure that GTS is available, we omit a test for gts.h.
318   #AC_CHECK_HEADER(gts.h, , AC_MSG_ERROR($this_error_text), glib.h)
319   AC_SEARCH_LIBS(gts_object_class_new, gts, , AC_MSG_ERROR($this_error_text))
320   unset this_error_text
323 AC_MSG_CHECKING([whether to enable toporouter output])
324 AC_ARG_ENABLE([toporouter-output],
325  [AS_HELP_STRING([--enable-toporouter-output], [enable toporouter graphical output [default=no]]) ]
327 AS_CASE(["z$enable_toporouter_output"],[zyes | zno],,
328  [enable_toporouter_output=no]
330 AC_MSG_RESULT([$enable_toporouter_output])
331 AS_CASE([$enable_toporouter_output],[yes],
333   topo_output_enabled=1
334  ],
336   topo_output_enabled=0
339 AC_DEFINE_UNQUOTED([TOPO_OUTPUT_ENABLED], [$topo_output_enabled],
340  [Define to 1 to enable toporouter graphical output]
343 PKG_PROG_PKG_CONFIG()
345 if test "x$enable_toporouter_output" = "xyes"; then
346    PKG_CHECK_MODULES(CAIRO, cairo,,
347                      [AC_MSG_ERROR([Cannot find cairo, needed by the toporouter
348 Please review the following errors:
349 $CAIRO_PKG_ERRORS])]
350    )
353 AC_MSG_CHECKING([for whether to use DBUS])
354 AC_ARG_ENABLE([dbus],
355 [  --enable-dbus           Enable DBUS IPC],
356 [],[
357         case " $with_gui " in
358                 *\ gtk\ *)     enable_dbus=yes ;;
359                 *\ lesstif\ *) enable_dbus=yes ;;
360                 * )            enable_dbus=no ;;
361         esac
364 AC_MSG_RESULT([$enable_dbus])
365 AM_CONDITIONAL(WITH_DBUS, test x$enable_dbus = xyes)
367 if test "x$enable_dbus" = "xyes"; then
368         case " $with_gui " in
369                 *\ gtk\ *) ;;
370                 *\ lesstif\ *) ;;
371                 * ) AC_MSG_ERROR([DBUS enabled but only works with a mainloop capable GUI HID.
372 Either do not use --enable-dbus or enable the gtk or lesstif GUI HID.])
373         esac
374         
375         PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.61,
376                 [saved_LIBS="$LIBS"
377                  LIBS="$LIBS $DBUS_LIBS"
378                  AC_CHECK_FUNCS(dbus_watch_get_unix_fd)
379                  LIBS="$saved_LIBS" ],
380                 [AC_MSG_ERROR([Cannot find dbus-1 >= 0.61, install it and rerun ./configure
381 Please review the following errors:
382 $DBUS_PKG_ERRORS])]
383         )
384         DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
385         
386         AC_DEFINE([HAVE_DBUS], 1,
387                 [Define to 1 if DBUS IPC is to be compiled in])
392 AC_MSG_CHECKING([for whether to use GL drawing])
393 AC_ARG_ENABLE([gl],
394 [  --enable-gl           Enable GL drawing (with GTK HID)],
395 [],[
396         case " $with_gui " in
397                 *\ gtk\ *) enable_gl=yes;;
398                 * ) enable_gl=no;;
399         esac
401 AC_MSG_RESULT([$enable_gl])
402 AM_CONDITIONAL(USE_GL, test x$enable_gl = xyes)
404 if test "x$enable_gl" = "xyes"; then
405         case " $with_gui " in
406                 *\ gtk\ *) ;;
407                 * ) AC_MSG_ERROR([GL drawing enabled but only works with the GTK HID.
408 Either do not use --enable-gl or enable the gtk HID.])
409         ;;
410         esac
412         AX_CHECK_GL
413         AS_IF([test X$no_gl = Xyes],
414               [AC_MSG_FAILURE([OpenGL is required.])])
416         AX_CHECK_GLU
417         AS_IF([test X$no_glu = Xyes],
418               [AC_MSG_FAILURE([The OpenGL GLU library is required.])])
420         AC_DEFINE([ENABLE_GL], 1,
421                 [Define to 1 if GL support is to be compiled in])
424 AC_MSG_CHECKING([for which printer to use])
425 AC_ARG_WITH([printer],
426 [  --with-printer=        Specify the printer: lpr [[default=lpr]]],
427 [],[with_printer=lpr])
428 AC_MSG_RESULT([$with_printer])
429 case " $hid_printers " in
430      *\ $with_printer\ * )
431          HIDLIST="$HIDLIST $with_printer"
432          ;;
433      * ) AC_MSG_ERROR([$with_printer is not a valid printer]) ;;
434 esac
436 AC_MSG_CHECKING([for which exporters to use])
437 AC_ARG_WITH([exporters],
438 [  --with-exporters=       Enable export devices: bom gerber gcode nelma png ps [[default=bom gerber gcode nelma png ps]]],
439 [],[with_exporters=$hid_exporters])
440 AC_MSG_RESULT([$with_exporters])
441 for e in `echo $with_exporters | sed 's/,/ /g'`; do
442     case " $hid_exporters " in
443       *\ $e\ * )
444          HIDLIST="$HIDLIST $e"
445          ;;
446       * ) AC_MSG_ERROR([$e is not a valid exporter]) ;;
447     esac
448 done
450 if test "X$enable_jpeg" = "Xno" -a "X$enable_gif" = "Xno" -a "X$enable_png" = "Xno" ; then
451         case " ${HIDLIST} " in
452                 *\ png\ *)
453                         AC_MSG_ERROR([you have requested the png HID but turned off all output
454 formats!  If you do not want gif/jpeg/png output, use --with-exporters to list
455 which exporters you want and do not list png there.])
456                         ;;
458                 *)
459                         ;;
460         esac
463 for hid in $HIDLIST; do
464     F=$srcdir/src/hid/$hid/hid.conf
465     if test -f $F ; then
466         echo checking $hid dependencies
467         deps=
468         . $F
469         for dep in $deps; do
470             if test "X`echo $HIDLIST | grep $dep`" = "X"; then
471                 AC_MSG_ERROR([you have requested the $hid HID but not the $dep HID, which it depends on])
472             fi
473         done
474    fi
475 done
477 for e in $HIDLIST; do
478     HIDLIBS="$HIDLIBS lib$e.a"
479 done
481 AC_SUBST(HIDLIST)
482 AC_SUBST(HIDLIBS)
484 # ------------- end HID config -------------------
486 ######################################################################
488 # desktop integration
491 AC_PATH_PROG(SETENV, env, [])
492 AC_PATH_PROG(GTK_UPDATE_ICON_CACHE_BIN, gtk-update-icon-path, [true])
494 # Change default location for XDG files (MIME and Icons)
495 AC_ARG_WITH(xdgdatadir, [  --with-xdgdatadir=path  Change where the theme icons 
496 and mime registrations are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
498 # Change default location for KDE data files (KDE MIME registrations)
499 AC_ARG_WITH(kdedatadir, [  --with-kdedatadir=path  Change where the KDE mime reg
500 istrations are installed [[DATADIR]]], [opt_kdedatadir=$withval])
502 if test x$opt_xdgdatadir = x; then
503         # path was not specified with --with-xdgdatadir
504         XDGDATADIR='${datadir}'
505 else
506         # path WAS specified with --with-xdgdatadir
507         XDGDATADIR="$opt_xdgdatadir"
509 AC_SUBST(XDGDATADIR)
511 if test x$opt_kdedatadir = x; then
512         # path was not specified with --with-kdedatadir
513         KDEDATADIR='${datadir}'
514 else
515         # path WAS specified with --with-kdedatadir
516         KDEDATADIR="$opt_kdedatadir"
518 AC_SUBST(KDEDATADIR)
520 AC_ARG_ENABLE(update-desktop-database,
521         AC_HELP_STRING([--disable-update-desktop-database],
522         [do not update desktop database after installation]),,
523         enable_update_desktop_database=yes)
525 AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE, test x$enable_update_desktop_database = xyes)
527 if test x$enable_update_desktop_database = xyes ; then
528         AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
529         if test $UPDATE_DESKTOP_DATABASE = no; then
530         AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
531         fi
534 AC_ARG_ENABLE(update-mime-database,
535         AC_HELP_STRING([--disable-update-mime-database],
536         [do not update mime database after installation]),,
537         enable_update_mime_database=yes)
539 AM_CONDITIONAL(ENABLE_UPDATE_MIME_DATABASE, test x$enable_update_mime_database = xyes)
541 if test x$enable_update_mime_database = xyes ; then
542         AC_PATH_PROG(UPDATE_MIME_DATABASE, [update-mime-database], no)
543         if test $UPDATE_MIME_DATABASE = no; then
544         AC_MSG_ERROR([Cannot find update-mime-database, make sure it is installed and in your PATH, or configure with --disable-update-mime-database])
545         fi
549 ######################################################################
551 AC_PATH_PROGS(M4, gm4 m4, [none])
552 if test "X$M4" = "Xnone" ; then
553         AC_MSG_ERROR([Did not find a m4 executible.  You need to make sure
554         that m4 is installed on your system and that m4 is in your path])
556 AC_MSG_CHECKING([if $M4 has the division involving negative numbers bug])
557 pcb_m4_r=`echo "eval(-2/2)" | $M4`
558 if test "$pcb_m4_r" != "-1" ; then
559         AC_MSG_RESULT([yes])
560         AC_MSG_ERROR([It appears that $M4 has a bug involving division
561 with negative numbers.  In particular it just returned the result that
562 -2/2 = $pcb_m4_r instead of -1.  This is a known bug in GNU m4-1.4.9.  Please
563 install a non-broken m4.])
564 else
565         AC_MSG_RESULT([no])
569 AC_PATH_PROGS(WISH, wish wish85 wish8.5 wish83 wish8.3 wish80 wish8.0 cygwish83 cygwish80,[none])
570 if test "X$WISH" = "Xnone" ; then
571         AC_MSG_ERROR([Did not find the wish executible.  You need to make sure
572         that tcl is installed on your system and that wish is in your path])
575 AC_DEFINE_UNQUOTED(M4,$M4,[m4 executible])
576 GNUM4=$M4
577 AC_SUBST(GNUM4)
578 AC_DEFINE_UNQUOTED(GNUM4,"$M4",[m4 program used by pcb])
580 AC_PATH_PROG(PDFLATEX, pdflatex, notfound)
581 AM_CONDITIONAL(MISSING_PDFLATEX, test x$PDFLATEX = xnotfound)
583 AC_PATH_PROG(TEXI2DVI, texi2dvi, notfound)
584 AM_CONDITIONAL(MISSING_TEXI2DVI, test x$TEXI2DVI = xnotfound)
586 AC_PATH_PROG(PS2PDF, ps2pdf, notfound)
587 AM_CONDITIONAL(MISSING_PS2PDF, test x$PS2PDF = xnotfound)
589 # used to build some of the getting started guide
590 AC_PATH_PROG(GSCHEM, gschem, notfound)
591 AM_CONDITIONAL(MISSING_GSCHEM, test x$GSCHEM = xnotfound)
593 if test "X$docs_yesno" = "Xyes" -a "X$pcb_git_version" = "Xyes" ; then
594         if test "$PDFLATEX" = "notfound" -o "$TEXI2DVI" = "notfound" -o "$PS2PDF" = "notfound" ; then
595                 AC_MSG_ERROR([It appears that you are building from a source tree obtained
596 via git but you do not have the required tools installed to build the documentation.  Here
597 is a list of tools and the detected values:
598 PDFLATEX:  $PDFLATEX
599 TEXI2DVI:  $TEXI2DVI
600 PS2PDF:    $PS2PDF
601 GSCHEM:    $GSCHEM
603 Either make sure these tools are installed or disable building and installing the documentation
604 by using the --disable-doc configure option.
606         fi
609 ############################################################################
611 # These checks are for tools used by the testsuite.  It will not be fatal
612 # if these are missing because this is primarily for developer use.  It is
613 # possible that we might add some --enable flag in the future that forces
614 # full tools for development work.
616 # Check for ImageMagick tools used by the testsuite
617 AC_PATH_PROG(IM_ANIMATE, animate, notfound)
618 AC_PATH_PROG(IM_COMPARE, compare, notfound)
619 AC_PATH_PROG(IM_COMPOSITE, composite, notfound)
620 AC_PATH_PROG(IM_CONVERT, convert, notfound)
621 AC_PATH_PROG(IM_DISPLAY, display, notfound)
622 AC_PATH_PROG(IM_MONTAGE, montage, notfound)
623 missing_magick=""
624 test "${IM_ANIMATE}" != "notfound" || missing_magick="${missing_magick} animate"
625 test "${IM_COMPARE}" != "notfound" || missing_magick="${missing_magick} compare"
626 test "${IM_COMPOSITE}" != "notfound" || missing_magick="${missing_magick} composite"
627 test "${IM_CONVERT}" != "notfound" || missing_magick="${missing_magick} convert"
628 test "${IM_DISPLAY}" != "notfound" || missing_magick="${missing_magick} display"
629 test "${IM_MONTAGE}" != "notfound" || missing_magick="${missing_magick} montage"
631 AC_MSG_CHECKING([if all ImageMagick tools needed for the testsuite were found])
632 if test "X${missing_magick}" != "X" ; then
633     AC_MSG_RESULT([no.  The testsuite will be disabled because the following
634 tools from the ImageMagick suite were not found:
635 ${missing_magick}
636 No loss in pcb functionality should be experienced, you just will not
637 be able to run the full regression testsuite.
639     have_magick=no
640 else
641     AC_MSG_RESULT([yes])
642     have_magick=yes
645 have_test_tools=yes
647 test $have_magick = yes || have_test_tools=no
649 # the RS274-X export HID is partially checked by looking at the result with
650 # gerbv
651 AC_PATH_PROG(GERBV, gerbv, notfound)
652 test $GERBV != notfound || have_test_tools=no
655 AM_CONDITIONAL(HAVE_TEST_TOOLS, test x$have_test_tools = xyes)
656 AC_MSG_CHECKING([if all the requried testsuite tools were found])
657 if test x$have_test_tools = xyes ; then
658         AC_MSG_RESULT([yes])
659 else
660         AC_MSG_RESULT([no -- the testsuite will be disabled])
665 ############################################################################
668 dnl Checks for libraries.
669 AC_CHECK_LIB(m, sqrt)
670 AC_CHECK_LIB(dl, dlopen)
671 AC_CHECK_LIB(xnet, gethostbyname)
672 AC_CHECK_LIB(fl, yywrap)
673 AC_CHECK_FUNCS(strerror)
674 AC_CHECK_FUNCS(regcomp re_comp)
675 AC_CHECK_FUNCS(logf expf rint)
676 AC_CHECK_FUNCS(vsnprintf)
677 AC_CHECK_FUNCS(getpwuid getcwd)
678 AC_CHECK_FUNCS(rand random)
679 AC_CHECK_FUNCS(stat)
681 AC_CHECK_FUNCS(mkdtemp)
683 # normally used for all file i/o
684 AC_CHECK_FUNCS(popen)
686 # for lrealpath.c
687 AC_CHECK_FUNCS(realpath canonicalize_file_name)
688 libiberty_NEED_DECLARATION(canonicalize_file_name)
690 # for pcb_spawnvp in action.c on Windows
691 AC_CHECK_FUNCS(_spawnvp)
693 AC_HEADER_STDC
694 AC_CHECK_HEADERS(limits.h locale.h string.h sys/types.h regex.h pwd.h)
695 AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h sys/param.h sys/times.h sys/wait.h)
696 AC_CHECK_HEADERS(dlfcn.h)
698 if test "x${WIN32}" = "xyes" ; then
699         AC_CHECK_HEADERS(windows.h)
701 # Search for glib
702 PKG_CHECK_MODULES(GLIB, glib-2.0, ,
703                 [AC_MSG_RESULT([Note: cannot find glib-2.0.
704 You may want to review the following errors:
705 $GLIB_PKG_ERRORS])]
708 need_gdlib=no
709 with_gif=no
710 with_png=no
711 with_jpeg=no
713 for e in $HIDLIST; do
714     case $e in
715       lesstif )
716         AC_PATH_XTRA
717         save_CPPFLAGS="$CPPFLAGS"
718         CPPFLAGS="$X_CFLAGS"
719         AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS)
720         AC_CHECK_LIB(ICE, main, , , $X_LIBS)
721         AC_CHECK_LIB(SM, main, , , $X_LIBS)
722         AC_CHECK_LIB(Xext, main, , , $X_LIBS)
723         AC_CHECK_LIB(Xt, XtOpenDisplay, , , $X_LIBS)
724         AC_CHECK_LIB(Xmu, main, , , $X_LIBS)
725         AC_CHECK_LIB(Xpm, main, , , $X_LIBS)
726         AC_CHECK_LIB(Xm, XmCreateMainWindow, , , $X_LIBS)
727         CPPFLAGS="$save_CPPFLAGS"
728         case $ac_cv_lib_Xm_XmCreateMainWindow in
729           no )
730             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
731             ;;
732           * ) ;;
733         esac
734         AC_CHECK_HEADERS(Xm/Xm.h)
735         case $ac_cv_header_Xm_Xm_h in
736           no )
737             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
738             ;;
739           * ) ;;
740         esac
741         ;;
743       gtk )
744         # Check for pkg-config
745         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
746         if test "$PKG_CONFIG" = "no"; then
747                 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
748         fi
750         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0, ,
751                 [AC_MSG_ERROR([Cannot find gtk+ >= 2.18.0, install it and rerun ./configure
752 Please review the following errors:
753 $GTK_PKG_ERRORS])]
754         )
755         GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
756         GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
758         if test "x$enable_gl" = "xyes"; then
759                 # Check for GtkGLExt
760                 PKG_CHECK_MODULES(GTKGLEXT, gtkglext-1.0 >= 1.0.0, , [AC_MSG_ERROR([
761 *** Required version of gtkglext is not installed - please install first ***
762 Please review the following errors:
763 $GTKGLEXT_PKG_ERRORS])]
764                 )
765         GTKGLEXT_VER=`$PKG_CONFIG gtkglext-1.0 --modversion`
766         fi
768         ;;
770       png)
771         need_gdlib=yes
772         AC_MSG_CHECKING([if GIF output from the png HID is desired])
773         AC_ARG_ENABLE([gif],
774                 [  --disable-gif           Disable support for gif output when the png HID is used [[default=include gif support]]],
775                 [
776                 if test "X$enable_gif" != "Xno" ; then
777                         AC_MSG_RESULT([yes])
778                         with_gif=yes
779                 else
780                         AC_MSG_RESULT([no])
781                 fi
782                 ],
783                 [
784                 AC_MSG_RESULT([yes])
785                 with_gif=yes
786                 ])
788         AC_MSG_CHECKING([if JPEG output from the png HID is desired])
789         AC_ARG_ENABLE([jpeg],
790                 [  --disable-jpeg          Disable support for JPEG output when the png HID is used [[default=include JPEG support]]],
791                 [
792                 if test "X$enable_jpeg" != "Xno" ; then
793                         AC_MSG_RESULT([yes])
794                         with_jpeg=yes
795                 else
796                         AC_MSG_RESULT([no])
797                 fi
798                 ],
799                 [
800                 AC_MSG_RESULT([yes])
801                 with_jpeg=yes
802                 ])
804         AC_MSG_CHECKING([if PNG output from the png HID is desired])
805         AC_ARG_ENABLE([png],
806                 [  --disable-png           Disable support for PNG output when the png HID is used [[default=include PNG support]]],
807                 [
808                 if test "X$enable_png" != "Xno" ; then
809                         AC_MSG_RESULT([yes])
810                         with_png=yes
811                 else
812                         AC_MSG_RESULT([no])
813                 fi
814                 ],
815                 [
816                 AC_MSG_RESULT([yes])
817                 with_png=yes
818                 ])
819         ;;
821       gcode|nelma)
822         need_gdlib=yes
823         with_png=yes
824         ;;
826     esac
827 done
829 if test "$need_gdlib" = "yes"; then
830         # Check for gdlib-config for gd (www.boutell.com/gd)
831         AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, no)
832         if test "$GDLIB_CONFIG" = "no"; then
833                 AC_MSG_RESULT([Cannot find gdlib-config.
834 Make sure it is installed and in your PATH.
835 gdlib-config is part of the GD library available from www.boutell.com/gd.
836 This is needed for the png HID.  I will look for libgd anyway and maybe
837 you will get lucky.
839                 if test "$WIN32" != "yes" ; then
840                         AC_CHECK_LIB(gd,main,,
841                         AC_MSG_ERROR([[You have requested gcode, nelma, or png HIDs  but -lgd could not be found]]))
842                 else 
843                         AC_CHECK_LIB(bgd,main,,
844                         AC_MSG_ERROR([[You have requested gcode, nelma, or png HIDs  but -lbgd could not be found]]))
845                 fi
846         else
847                 if test "$WIN32" = "yes" ; then
848                         GD=bgd
849                 else
850                         GD=gd
851                 fi
852                 AC_MSG_CHECKING([for libgd cflags])
853                 GD_CFLAGS="`$GDLIB_CONFIG --cflags`"
854                 AC_MSG_RESULT([$GD_CFLAGS])
855                 AC_MSG_CHECKING([for libgd libs])
856                 GD_LIBS="`$GDLIB_CONFIG --ldflags` `$GDLIB_CONFIG --libs` -l${GD}"
857                 AC_MSG_RESULT([$GD_LIBS])
858         fi
859    
860         # since some linux systems evidently install gdlib-config but fail to
861         # install the headers (nice), check for the header too and fail if it
862         # is not there.
863         save_CPPFLAGS="$CPPFLAGS"
864         CPPFLAGS="$CPPFLAGS $GD_CFLAGS"
865         AC_CHECK_HEADERS(gd.h)
866         CPPFLASS="$save_CPPFLAGS"
867         case $ac_cv_header_gd_h in
868              no )
869                 AC_MSG_ERROR([
870 You evidentally do not have a complete installation of the GD library available from www.boutell.com/gd.
871 This is needed for the nelma and/or png HID.
873                 ;;
874              * ) ;;
875         esac
876         
877         # Some versions of gd (prior to the expiration of the
878         # patent related to gif compression) do not support
879         # gif output.  Check for that here.
880         save_LIBS="$LIBS"
881         LIBS="$save_LIBS $GD_LIBS $X_LIBS"
883         if test "X$with_gif" = "Xyes" ; then
884                 AC_CHECK_FUNCS(gdImageGif)
885                 if test "$ac_cv_func_gdImageGif" != "yes"; then
886                         AC_MSG_ERROR([Your gd installation does not appear to include gif support.
887 You may need to update your installation of gd or disable
888 gif export with --disable-gif])
889                 fi
890         fi
892         if test "X$with_jpeg" = "Xyes" ; then
893                 AC_CHECK_FUNCS(gdImageJpeg)
894                 if test "$ac_cv_func_gdImageJpeg" != "yes"; then
895                         AC_MSG_ERROR([Your gd installation does not appear to include JPEG support.
896 You may need to update your installation of gd or disable
897 JPEG export with --disable-jpeg])
898                 fi
899         fi
901         if test "X$with_png" = "Xyes" ; then
902                 AC_CHECK_FUNCS(gdImagePng)
903                 if test "$ac_cv_func_gdImagePng" != "yes"; then
904                         AC_MSG_ERROR([Your gd installation does not appear to include PNG support.
905 You may need to update your installation of gd or disable
906 PNG export with --disable-png])
907                 fi
908         fi
909         LIBS="$save_LIBS"
912 AM_CONDITIONAL(PNG, test x$with_png = xyes)
913 AM_CONDITIONAL(GIF, test x$with_gif = xyes)
915 # ------------- check if png previews should be built for pcblib-newlib
916 AC_MSG_CHECKING([if the m4lib to newlib export should create png previews])
917 AC_ARG_ENABLE(
918         [m4lib-png],
919         [  --enable-m4lib-png      Enable creating png previews for the m4 library],
920         [],[enable_m4lib_png=no])
921 AC_MSG_RESULT([$enable_m4lib_png])
922 AM_CONDITIONAL(PNG_PREVIEW, test x$enable_m4lib_png = xyes)
925 # Run away.... more ugly stuff here.  By default we don't actually build
926 # pcblib-newlib from pcblib unless we are building from cvs or git sources.
927 # The reason is it takes a while and requires the png HID.  The problem is,
928 # what if someone wants to use --enable-m4lib-png but the tarball was built
929 # without the previews.  Or, what if someone does not want the PNG previews
930 # but the person building the tarball included them.  Ugh!  So what the following
931 # code attempts to do is detect that mismatch situation.  Note that we only
932 # want to kick this code in when *not* building from git or cvs sources.
933 build_pcblib_newlib=no
934 if test "$pcb_sources" = "tarball" ; then
935         AC_MSG_CHECKING([If pcblib-newlib was built with png previews])
936         stamp=$srcdir/lib/pcblib-newlib.stamp
937         if test ! -f ${stamp} ; then
938                 AC_MSG_RESULT([unknown, missing ${stamp}])
939                 build_pcblib_newlib=yes
940         else
941                 if test "`cat ${stamp}`" = "png-preview=yes" ; then
942                         AC_MSG_RESULT([yes])
943                         # lib exists and built with preview.
944                         # if we don't want the preview, than rebuild
945                         if test x$enable_m4lib_png != xyes ; then
946                                 build_pcblib_newlib=yes
947                         fi
948                 else
949                         AC_MSG_RESULT([no])
950                         # lib exists and built without preview.
951                         # if we want the preview, than rebuild
952                         if test x$enable_m4lib_png = xyes ; then
953                                 build_pcblib_newlib=yes
954                         fi
955                 fi
956         fi
957 else
958         build_pcblib_newlib=yes
960 AC_MSG_CHECKING([If pcblib-newlib needs to be rebuilt])
961 AC_MSG_RESULT([$build_pcblib_newlib])
962 AM_CONDITIONAL(BUILD_PCBLIB_NEWLIB, test x$build_pcblib_newlib = xyes)
964 if test "X$cross_compiling" = "Xyes" ; then
965         # we are cross compiling so we will need a build host binary for pcb
966         AC_PATH_PROG(PCB, [pcb], [notfound])
967 else
968         PCB="\${top_builddir}/src/pcb"
970 AC_SUBST(PCB)
972 # now make see how essential it was that we have a pcb executable for the build
973 # host
974 if test "X$pcb_git_version" = "Xyes" ; then
975         if test "X$docs_yesno" = "Xyes" -o "X$enable_m4lib_png" = "Xyes" ; then
976                 if test "$PCB" = "notfound" ; then
977                         AC_MSG_ERROR([You have selected a build with m4lib png
978 previews enabled and/or with building the documentation enabled but you also
979 appear to be cross-compiling.  For this to work, you must have a pcb installed that
980 can run on this machine (the build machine) because it is needed for generating
981 library footprint png previews as well as some of the figures in the documentation.
982 If you wish to skip building the documentation and the footprint previews then add
983 --disable-doc --disable-m4lib-png
984 This will allow your cross build to work.])
985                 fi
986         fi
989 # ------------- Xrender -------------------
990 have_xrender=no
991 AC_CHECK_LIB(Xrender,XRenderQueryExtension,have_xrender=yes,have_xrender=no,$X_LIBS)
993 AC_ARG_ENABLE([xrender],
994 [  --disable-xrender       Compile and link with Xrender [default=yes]])
995 case "$have_xrender:$enable_xrender" in
996    no:* ) ;;
997    *:no ) ;;
998    * )
999      X_LIBS="-lXrender $X_LIBS"
1000      AC_DEFINE([HAVE_XRENDER], 1,
1001                 [Define to 1 if Xrender is available])
1002      ;;
1003 esac
1005 # ------------- Xinerama -------------------
1006 have_xinerama=no
1007 AC_CHECK_LIB(Xinerama,XineramaQueryExtension,have_xinerama=yes,have_xinerama=no,$X_LIBS)
1009 AC_ARG_ENABLE([xinerama],
1010 [  --disable-xinerama       Compile and link with Xinerama [default=yes]])
1011 case "$have_xinerama:$enable_xinerama" in
1012    no:* ) ;;
1013    *:no ) ;;
1014    * )
1015      X_LIBS="-lXinerama $X_LIBS"
1016      AC_DEFINE([HAVE_XINERAMA], 1,
1017                 [Define to 1 if Xinerama is available])
1018      ;;
1019 esac
1021 # ------------- dmalloc -------------------
1022 dnl dmalloc checks
1023 with_dmalloc=no
1024 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
1025 AC_ARG_ENABLE([dmalloc],
1026 [  --enable-dmalloc        Compile and link with dmalloc for malloc debugging [default=no]],
1028 if test "X$enable_dmalloc" != "Xno" ; then
1029         AC_MSG_RESULT([yes])
1030         AC_CHECK_HEADER(dmalloc.h,,
1031                 AC_MSG_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
1032         AC_CHECK_LIB(dmalloc,main,,
1033                 AC_MSG_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
1034         DMALLOC_LIBS="-ldmalloc"
1035         with_dmalloc=yes
1036 else
1037         AC_MSG_RESULT([no])
1038         DMALLOC_LIBS=""
1042         AC_MSG_RESULT([no])
1043         DMALLOC_LIBS=""
1046 # ------------- ElectricFence -------------------
1047 dnl ElectricFence checks
1048 with_efence=no
1049 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
1050 AC_ARG_ENABLE([efence],
1051 [  --enable-efence         Link with ElectricFence for malloc debugging [default=no]],
1053 if test "X$enable_efence" != "Xno" ; then
1054         AC_MSG_RESULT([yes])
1055         AC_CHECK_LIB(efence,main,,
1056                 AC_MSG_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
1057         with_efence=yes
1058 else
1059         AC_MSG_RESULT([no])
1063 AC_MSG_RESULT([no])
1066 # ------------- Enable Debug code -------------------
1067 AC_MSG_CHECKING([for whether to enable debugging code])
1068 AC_ARG_ENABLE([debug],
1069 [  --enable-debug          Enable debugging code],
1070 [],[enable_debug=no])
1072 AC_MSG_RESULT([$enable_debug])
1073 AM_CONDITIONAL(DEBUG_BUILD, test x$enable_debug = xyes)
1075 # ------------- mkdir required for win32 compatibility ------------
1076 # WIN32 mkdir takes only one argument, POSIX takes two.
1077 # #include "misc.h" where mkdir is required.
1078 m4_include([m4/m4_ax_func_mkdir.m4])
1079 AX_FUNC_MKDIR
1081 # ------------- Type used for "Coord" type -------------------
1083 AC_CHECK_HEADERS(stdint.h)
1084 AC_ARG_ENABLE([coord64],
1085 [  --enable-coord64        Force 64-bit coordinate types],
1086 [],[enable_coord64=no])
1087 AC_ARG_ENABLE([coord32],
1088 [  --enable-coord32        Force 32-bit coordinate types],
1089 [],[enable_coord32=no])
1091 COORDTYPE="long"
1093 echo "$enable_coord32:$enable_coord64:$ac_cv_header_stdint_h"
1094 case "$enable_coord32:$enable_coord64:$ac_cv_header_stdint_h" in
1095   yes:no:yes )
1096     COORD_TYPE="int32_t"
1097     COORD_MAX="INT32_MAX"
1098     ;;
1099   no:yes:yes )
1100     COORD_TYPE="int64_t"
1101     COORD_MAX="INT64_MAX"
1102     ;;
1103   yes:no:no  )
1104     COORD_TYPE="int"
1105     COORD_MAX="INT_MAX"
1106     ;;
1107   no:yes:no  )
1108     COORD_TYPE="long long"
1109     COORD_MAX="LLONG_MAX"
1110     ;;
1111   yes:yes:*  )
1112     AC_MSG_ERROR("*** cannot require both 32 and 64 bit coordinates")
1113     ;;
1114   *:*:*    )
1115     COORD_TYPE="long"
1116     COORD_MAX="LONG_MAX"
1117     ;;
1118 esac
1119 AC_DEFINE_UNQUOTED([COORD_TYPE],[$COORD_TYPE],
1120   [C type for Coordinates])
1121 AC_DEFINE_UNQUOTED([COORD_MAX],[$COORD_MAX],
1122   [Maximum value of coordinate type])
1124 # ------------- Complete set of CPPFLAGS and LIBS -------------------
1126 CPPFLAGS="$CPPFLAGS $X_CFLAGS $DBUS_CFLAGS $GLIB_CFLAGS $GTK_CFLAGS $GD_CFLAGS $CAIRO_CFLAGS $GTKGLEXT_CFLAGS $GLU_CFLAGS $GL_CFLAGS"
1127 LIBS="$LIBS $XM_LIBS $DBUS_LIBS $X_LIBS $GLIB_LIBS $GTK_LIBS $DMALLOC_LIBS $GD_LIBS $INTLLIBS $CAIRO_LIBS $GTKGLEXT_LIBS $GLU_LIBS $GL_LIBS"
1130 # if we have gcc then add -Wall
1131 if test "x$GCC" = "xyes"; then
1132         # see about adding some extra checks if the compiler takes them
1133         for flag in -Wall ; do
1134                 case " ${CFLAGS} " in
1135                         *\ ${flag}\ *)
1136                                 # flag is already present
1137                                 ;;
1138                         *)
1139                                 AC_MSG_CHECKING([if the compiler accepts ${flag}])
1140                                 ac_save_CFLAGS="$CFLAGS"
1141                                 CFLAGS="$CFLAGS ${flag}"
1142                                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1143                                         [AC_MSG_RESULT([yes])],
1144                                         [AC_MSG_RESULT([no])
1145                                          CFLAGS="$ac_save_CFLAGS"
1146                                         ]
1147                                 )
1148                                 ;;
1149                 esac
1150         done
1153 CXXFLAGS="$CFLAGS"
1155 # Now add C-specific flags
1156 if test "x$GCC" = "xyes"; then
1157         # see about adding some extra checks if the compiler takes them
1158         for flag in -Wdeclaration-after-statement ; do
1159                 case " ${CFLAGS} " in
1160                         *\ ${flag}\ *)
1161                                 # flag is already present
1162                                 ;;
1163                         *)
1164                                 AC_MSG_CHECKING([if the compiler accepts ${flag}])
1165                                 ac_save_CFLAGS="$CFLAGS"
1166                                 CFLAGS="$CFLAGS ${flag}"
1167                                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1168                                         [AC_MSG_RESULT([yes])],
1169                                         [AC_MSG_RESULT([no])
1170                                          CFLAGS="$ac_save_CFLAGS"
1171                                         ]
1172                                 )
1173                                 ;;
1174                 esac
1175         done
1178 # See if we are building gcc with C++.
1179 AC_ARG_ENABLE(build-with-cxx,
1180 [  --enable-build-with-cxx build with C++ compiler instead of C compiler],
1181 ENABLE_BUILD_WITH_CXX=$enableval,
1182 ENABLE_BUILD_WITH_CXX=no)
1184 case "$ENABLE_BUILD_WITH_CXX" in
1185   yes)
1186     CC_OR_CXX="$CXX"
1187     ;;
1188   no)
1189     CC_OR_CXX="$CC"
1190     ;;
1191 esac
1192 AC_SUBST(CC_OR_CXX)
1194 # font filename
1195 FONTFILENAME=${FONTFILENAME:-"default_font"}
1196 AC_SUBST(FONTFILENAME)
1197 AC_DEFINE_UNQUOTED(FONTFILENAME,"$FONTFILENAME",[File for default font])
1199 # standard autoconf variables
1200 CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\""
1201 CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\""
1202 CPPFLAGS="$CPPFLAGS -DHOST=\\\"\${host}\\\""
1204 # directory for old-style library and for fonts
1205 PCBLIBDIR=${datadir}/pcb
1206 AC_SUBST(PCBLIBDIR)
1207 #AC_DEFINE_UNQUOTED(PCBLIBDIR,"$PCBLIBDIR",[Library directory])
1208 CPPFLAGS="$CPPFLAGS -DPCBLIBDIR=\\\"$PCBLIBDIR\\\""
1210 # name for old-style library
1211 LIBRARYFILENAME=pcblib
1212 AC_SUBST(LIBRARYFILENAME)
1213 AC_DEFINE_UNQUOTED(LIBRARYFILENAME,"$LIBRARYFILENAME",[library file name])
1216 # directory for new library
1217 PCBTREEDIR=${datadir}/pcb/newlib
1218 PCBTREEPATH=${PCBTREEDIR}:${PCBLIBDIR}/pcblib-newlib
1219 PCBTREEDIR=${PCBTREEDIR:-"$PCBTREEDIR"}
1220 AC_SUBST(PCBTREEDIR)
1221 AC_SUBST(PCBTREEPATH)
1222 #AC_DEFINE_UNQUOTED(PCBTREEDIR,"$PCBLIB",[top directory for new style pcb library])
1223 CPPFLAGS="$CPPFLAGS -DPCBTREEDIR=\\\"$PCBTREEDIR\\\""
1224 CPPFLAGS="$CPPFLAGS -DPCBTREEPATH=\\\"$PCBTREEPATH\\\""
1226 # Figure out relative paths
1227 AC_MSG_CHECKING([for the bindir to pcblibdir relative path])
1228 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBLIBDIR:bindir_to_pcblibdir])
1229 adl_NORMALIZE_PATH([bindir_to_pcblibdir], [$PCB_DIR_SEPARATOR_S])
1230 AC_MSG_RESULT([$bindir_to_pcblibdir])
1231 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBLIBDIR, "$bindir_to_pcblibdir", [Relative path from bindir to pcblibdir])
1233 AC_MSG_CHECKING([for the bindir to pcbtreedir relative path])
1234 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBTREEDIR:bindir_to_pcbtreedir])
1235 adl_NORMALIZE_PATH([bindir_to_pcbtreedir], [$PCB_DIR_SEPARATOR_S])
1236 AC_MSG_RESULT([$bindir_to_pcbtreedir])
1237 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBTREEDIR, "$bindir_to_pcbtreedir", [Relative path from bindir to pcbtreedir])
1240 AC_MSG_CHECKING([for the bindir to exec_prefix relative path])
1241 adl_COMPUTE_RELATIVE_PATHS([bindir:exec_prefix:bindir_to_execprefix])
1242 adl_NORMALIZE_PATH([bindir_to_execprefix], [$PCB_DIR_SEPARATOR_S])
1243 AC_MSG_RESULT([$bindir_to_execprefix])
1244 AC_DEFINE_UNQUOTED(BINDIR_TO_EXECPREFIX, "$bindir_to_execprefix", [Relative path from bindir to exec_prefix])
1247 BTNMOD=${BTNMOD:-"Mod1"}
1248 AC_SUBST(BTNMOD)
1250 TOPDIRS=
1251 for dir in src lib newlib doc example tools tutorial README_FILES
1253    test -d $dir/. && TOPDIRS="$TOPDIRS $dir"
1254 done
1255 AC_SUBST(TOPDIRS)
1257 AC_CONFIG_FILES(Makefile data/Makefile intl/Makefile po/Makefile.in)
1259 if test -d $srcdir/README_FILES; then
1260    AC_CONFIG_FILES(README_FILES/Makefile)
1262 if test -d $srcdir/doc; then
1263    AC_CONFIG_FILES(doc/Makefile)
1265 if test -d $srcdir/doc/gs; then
1266    AC_CONFIG_FILES(doc/gs/Makefile)
1267    AC_CONFIG_FILES(doc/gs/gafrc)
1268    AC_CONFIG_FILES(doc/gs/gschemrc)
1270 if test -d $srcdir/example; then
1271    AC_CONFIG_FILES(example/Makefile)
1272    AC_CONFIG_FILES(example/libraries/Makefile)
1274 if test -d $srcdir/lib; then
1275    AC_CONFIG_FILES(lib/CreateLibraryContents.sh)
1276    AC_CONFIG_FILES(lib/CreateLibrary.sh)
1277    AC_CONFIG_FILES(lib/ListLibraryContents.sh)
1278    AC_CONFIG_FILES(lib/Makefile)
1279    AC_CONFIG_FILES(lib/QueryLibrary.sh)
1280    AC_CONFIG_FILES(lib/qfp-ui)
1282 if test -d $srcdir/newlib; then
1283    AC_CONFIG_FILES(newlib/2_pin_thru-hole_packages/Makefile)
1284    AC_CONFIG_FILES(newlib/Makefile)
1285    AC_CONFIG_FILES(newlib/connectors/Makefile)
1286    AC_CONFIG_FILES(newlib/crystal/Makefile)
1287    AC_CONFIG_FILES(newlib/electro-optics/Makefile)
1288    AC_CONFIG_FILES(newlib/headers/Makefile)
1289    AC_CONFIG_FILES(newlib/keystone/Makefile)
1290    AC_CONFIG_FILES(newlib/msp430/Makefile)
1291    AC_CONFIG_FILES(newlib/not_vetted_ingo/Makefile)
1292    AC_CONFIG_FILES(newlib/sockets/Makefile)
1293    AC_CONFIG_FILES(newlib/tests/Makefile)
1295 AC_CONFIG_FILES(src/Makefile)
1296 AC_CONFIG_FILES(src/icons/Makefile)
1297 if test -d $srcdir/tools; then
1298    AC_CONFIG_FILES(tools/Makefile)
1300 if test -d $srcdir/tutorial; then
1301    AC_CONFIG_FILES(tutorial/Makefile)
1304 dnl testsuite
1305 AC_CONFIG_FILES(tests/Makefile)
1307 dnl win32 build scripts
1308 AC_CONFIG_FILES(w32/Makefile)
1310 AC_OUTPUT
1312 with_gui=`echo $with_gui`
1313 with_printer=`echo $with_printer`
1314 with_exporters=`echo $with_exporters | sed 's/,/ /g'`
1316 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
1317 expandedKDEDATADIR=`eval "echo $KDEDATADIR"`
1319 AC_MSG_RESULT([
1320 ** Configuration summary for $PACKAGE $VERSION:
1322    Cross Compiling:          $cross_compiling
1323    CC:                       $CC
1324    CXX:                      $CXX
1325    CPPFLAGS:                 $CPPFLAGS
1326    CFLAGS:                   $CFLAGS
1327    CXXFLAGS:                 $CXXFLAGS
1328    LIBS:                     $LIBS
1329    PCB:                      $PCB
1331    GUI:                      $with_gui
1332    Printer:                  $with_printer
1333    Exporters:                $with_exporters
1334    Coordinate type:          $COORD_TYPE
1335    Source tree distribution: $pcb_sources
1336    Build documentation:      $docs_yesno
1337    Build toporouter:         $enable_toporouter
1338    Enable toporouter output: $enable_toporouter_output
1339    xdg data directory:       $expandedXDGDATADIR
1340    KDE data directory:       $expandedKDEDATADIR
1341    dmalloc debugging:        $with_dmalloc
1342    ElectricFence debugging:  $with_efence
1343    Regression tests enabled: $have_test_tools