Default STEP export to board only
[geda-pcb/pcjc2/v2.git] / configure.ac
blob1474533e84b90416b6f94902679af9acb4298136
1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([pcb], m4_esyscmd([git describe --abbrev=8 --always --tags | awk -F'-' '{printf "%s-%s", $1, $3}']))
4 AC_CONFIG_SRCDIR([src/draw.c])
5 AC_PREREQ([2.69])
6 AM_INIT_AUTOMAKE([1.9])
7 AC_GNU_SOURCE
8 AC_CONFIG_HEADERS([config.h])
10 m4_include(configure.ac.system) dnl checks for system functions, headers, libs
12 ##########################################################################
14 # Try to figure out if we are building from git sources.
15 # If we are then unless building of the documentation has
16 # been disabled then just require the user have all the right
17 # tools.  Users building from a tarball won't need latex, makeinfo,
18 # etc. but if you're already downloading development sources, then
19 # it is not unreasonable to require development tools.  What motivated
20 # this is that using maintainer mode proved to cause regular confusion.
22 pcb_sources="tarball"
23 AC_MSG_CHECKING([if you are building from a git checkout])
24 pcb_git_version=no
25 if test -f $srcdir/.gitignore ; then
26         pcb_git_version=yes
27         AC_MSG_RESULT([yes])
28         pcb_sources="GIT"
29 else
30         AC_MSG_RESULT([no])
32 AM_CONDITIONAL(GIT_VERSION, test x$pcb_git_version = xyes)
34 AC_MSG_CHECKING([if you are building from a anoncvs checkout])
35 pcb_cvs_version=no
36 if test -f $srcdir/CVS/Root ; then
37         pcb_cvs_version=yes
38         AC_MSG_RESULT([yes])
39         pcb_sources="CVS"
40 else
41         AC_MSG_RESULT([no])
43 AM_CONDITIONAL(CVS_VERSION, test x$pcb_cvs_version = xyes)
44 AM_CONDITIONAL(GIT_OR_CVS_VERSION, test x$pcb_git_version = xyes -o x$pcb_cvs_version = xyes)
47 ##########################################################################
49 # See if we are supposed to build the docs
52 docs_yesno=yes
53 AC_MSG_CHECKING([if the documentation should be built])
54 AC_ARG_ENABLE([doc],
55 [  --enable-doc            Build and install the documentation [[default=yes]]],
57 if test "X$enable_doc" = "Xno" ; then
58         DOC=""
59         AC_MSG_RESULT([no])
60         docs_yesno=no
61 else
62         DOC=doc
63         AC_MSG_RESULT([yes])
64         docs_yesno=yes
68 DOC=doc
69 AC_MSG_RESULT([yes])
70 docs_yesno=yes
72 AC_SUBST(DOC)
75 dnl determine host type
76 AC_CANONICAL_HOST
77 AC_MSG_CHECKING(for windows)
78 PCB_PATH_DELIMETER=":"
79 PCB_DIR_SEPARATOR_S="/"
80 PCB_DIR_SEPARATOR_C='/'
81 case $host in
82         *-*-mingw* )
83                 WIN32=yes
84                 CFLAGS="$CFLAGS ${MINGW_CFLAGS:--mms-bitfields -mwindows}"
85                 CPPFLAGS="$CPPFLAGS ${MINGW_CPPFLAGS}"
86                 ;;
88         * )
89                 WIN32=no
90                 ;;
91 esac
93 AC_MSG_RESULT($WIN32)
94 AC_SUBST(WIN32)
95 AM_CONDITIONAL(WIN32, test x$WIN32 = xyes)
96 if test "x$WIN32" = "xyes" ; then
97         PCB_PATH_DELIMETER=";"
98         PCB_DIR_SEPARATOR_S="\\\\"
99         PCB_DIR_SEPARATOR_C='\\'
102 AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_C,'$PCB_DIR_SEPARATOR_C',[Directory separator char])
103 AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_S,"$PCB_DIR_SEPARATOR_S",[Directory separator string])
104 AC_DEFINE_UNQUOTED(PCB_PATH_DELIMETER,"$PCB_PATH_DELIMETER",[Search path separator string])
107 dnl Checks for programs.
108 AC_PROG_CC
109 AC_PROG_CXX
111 if test "x$WIN32" = "xyes" ; then
112         AC_CHECK_TOOL(WINDRES, windres, [no])
113         if test "$WINDRES" = "no" ; then
114                 AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
115         fi
118 # i18n
119 GETTEXT_PACKAGE=$PACKAGE
120 AH_TEMPLATE([GETTEXT_PACKAGE], [Name of this program's gettext domain])
121 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"])
122 AC_SUBST(GETTEXT_PACKAGE)
124 AM_GNU_GETTEXT_VERSION([0.19.3])
125 AM_GNU_GETTEXT
127 AC_MSG_CHECKING([if $MSGFMT understands msgctxt (message context)])
128 cat > conftest.po <<EOF
129 [#]line __oline__ "configure"
130 [#]. -- Info tab
131 [#]: myfile.c:lineno
132 msgctxt "tab"
133 msgid "Info"
134 msgstr ""
136 if ($MSGFMT -o conftest.gmo conftest.po >/dev/null; exit) 2>&AS_MESSAGE_LOG_FD
137 then
139   AC_MSG_RESULT([yes])
140 else
141   AC_MSG_RESULT([no])
142   AC_MSG_ERROR([It appears that your gettext tools ($MSGFMT) is too old.
143 You should install a newer gettext tools (>= 0.19.3 suggested).  You may
144 specify the location of the msgfmt executible with MSGFMT=/path/to/msgfmt
145 on the configure command line.
148 rm -f conftest.po conftest.gmo
150 IT_PROG_INTLTOOL([0.35.0])
152 AC_C_INLINE
153 AC_PROG_CC_STDC
154 AC_PROG_CC_C99
155 AM_PROG_CC_C_O
156 AC_PROG_CPP
158 AC_MSG_CHECKING([that C compiler supports C99])
159 if test "X$ac_cv_prog_cc_c99" = "Xno"; then
160   AC_MSG_RESULT([no])
161   AC_MSG_ERROR([A C99-compliant compiler is requred])
162 else
163   AC_MSG_RESULT([yes])
166 AC_PROG_AWK
167 AC_PROG_MKDIR_P
169 AM_PROG_LEX
170 AC_PATH_PROG(LEX_PATH, $LEX, [notfound])
171 if test "$LEX_PATH" = "notfound" ; then
172         AC_MSG_ERROR([Couldn't find a usable lex program.
173 Please install flex which is available from
174 ftp://ftp.gnu.org/pub/non-gnu/flex/
179 AC_PROG_YACC
180 AC_PATH_PROG(YACC_PATH, $YACC, [notfound])
181 if test "$YACC_PATH" = "notfound" ; then
182         AC_MSG_ERROR([Couldn't find a usable yacc program.
183 Please install bison which is available from
184 ftp://ftp.gnu.org/pub/gnu/bison/
188 AC_PROG_INSTALL
189 AC_PROG_RANLIB
192 # Used for building the icons
194 AC_PATH_PROG(XPMTOPPM, xpmtoppm, notfound)
195 AC_PATH_PROG(PPMTOWINICON, ppmtowinicon, notfound)
196 AC_PATH_PROG(CONVERT, convert, notfound)
198 ##########################################################################
201 if test "X$docs_yesno" = "Xyes" -a "X$pcb_git_version" = "Xyes" ; then
202    AC_PATH_PROG(MKINFO, makeinfo, no)
203    if test "X$MKINFO" != "Xno"; then
204       AC_MSG_CHECKING([for GNU makeinfo version >= 4.6])
205       v=`$MKINFO --version | grep "GNU texinfo"`
206       if test $? -ne 0; then
207          AC_MSG_RESULT([non-GNU])
208          MKINFO="no"
209       fi
210    fi
211    if test "X$MKINFO" != "Xno"; then
212       vmajor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\1/'`
213       vminor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
214       AC_MSG_RESULT([$vmajor.$vminor])
215       if test "$vmajor" -lt 4 \
216               || (test "$vmajor" -eq 4 && test "$vminor" -lt 6); then
217          MKINFO=no
218       fi
219    fi
220    if test "X$MKINFO" = "Xno"; then
221       AC_MSG_ERROR([You have requested a build
222 of the documentation.  For this to work, you must have version 4.6 or newer of
223 the GNU texinfo package.  You seem to have
227 Please update to a newer version of texinfo or disable building of
228 the documentation with --disable-doc
230    fi
232    AC_PATH_PROG(TEXI2DVI, texi2dvi, no)
233    if test "X$TEXI2DVI" = "Xno"; then
234       AC_MSG_ERROR([You have requested a build
235 of the documentation.  For this to work, you must have the texi2dvi program
236 installed.  Alternatively, you can disable building the documentation with
237 --disable-doc.])
238    fi
241         AC_PATH_PROG(PERL, perl, notfound)
242         if test "X$PERL" = "Xnotfound"; then
243                         AC_MSG_ERROR([You have requested a build
244 of the documentation.  For this to work, you must have perl installed.
245 Alternatively, you can disable building the documentation with
246 --disable-doc.
248         fi
251    AC_PATH_PROG([KPSEWHICH], [kpsewhich], [no])
252    if test "X$KPSEWHICH" = "Xno"; then
253       AC_MSG_ERROR([You have requested a build
254 of the documentation.  For this to work, you must have a functional install of
255 TeX and LaTeX.  kpsewhich is part of TeX.
256 Alternatively, you can disable building the documentation with
257 --disable-doc.])
258    fi
260    AC_MSG_CHECKING([If your TeX installation contains epsf.tex])
261    f=`$KPSEWHICH epsf.tex`
262    if test $? -eq 0 ; then
263         AC_MSG_RESULT([yes ($f)])
264    else
265         AC_MSG_RESULT([no])
266         AC_MSG_ERROR([You have requested a build
267 of the documentation.  For this to work, you must have a functional install of
268 TeX and LaTeX that includes epsf.tex.  On some linux distributions this is
269 part of the texlive-generic-recommended package.  On NetBSD this is is part
270 of the tex-epsf package.
271 Alternatively, you can disable building the documentation with
272 --disable-doc.])
273    fi
277 ##########################################################################
281 # FIXME:  for now, only try to add -rdynamic if we're using gcc.  We really
282 # need to figure out what the correct test is here.  In the mean time, this
283 # should let things build with SunPRO again.
284 if test "x$GCC" = "xyes"; then
285 AC_MSG_CHECKING([If the compiler accepts -rdynamic])
286 old_LDFLAGS="$LDFLAGS"
287 LDFLAGS="$LDFLAGS -rdynamic"
288 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
289         [AC_MSG_RESULT([yes])],
290         [LDFLAGS="$old_LDFLAGS"
291         AC_MSG_RESULT([no])
292         ])
295 # ------------- HID config -------------------
297 hid_guis=""
298 hid_printers=""
299 hid_exporters=""
300 hid_always=""
302 for hid in `cd $srcdir/src/hid; echo *`; do
303     F=$srcdir/src/hid/$hid/hid.conf
304     if test -f $F 
305     then
306     echo checking $F
307         . $F
308         case $type in
309           gui ) hid_guis="$hid_guis $hid" ;;
310           printer ) hid_printers="$hid_printers $hid" ;;
311           export ) hid_exporters="$hid_exporters $hid" ;;
312           always ) hid_always="$hid_always $hid" ;;
313         esac
314     fi
315 done
317 AC_MSG_CHECKING([for which gui to use])
318 AC_ARG_WITH([gui],
319 [  --with-gui=            Specify the GUI to use: batch gtk lesstif [[default=gtk]]],
321 [with_gui=gtk]
323 AC_MSG_RESULT([$with_gui])
324 case " $hid_guis no none " in
325      *\ $with_gui\ * ) HIDLIST="$with_gui" ;;
326      * ) AC_MSG_ERROR([$with_gui is not a valid gui]) ;;
327 esac
329 if test x"$with_gui" = x"none" -o x"$with_gui" = x"no"
330 then
331     HIDLIST=
334 AC_MSG_CHECKING([whether to enable toporouter])
335 AC_ARG_ENABLE([toporouter],
336  [AS_HELP_STRING([--enable-toporouter], [build toporouter [default=yes]]) ]
338 AS_CASE(["x$enable_toporouter"],[xyes | xno],,
339  [enable_toporouter=yes
342 AC_MSG_RESULT([$enable_toporouter])
343 AM_CONDITIONAL([WITH_TOPOROUTER], test $enable_toporouter != no)
345 AC_MSG_CHECKING([whether to enable toporouter output])
346 AC_ARG_ENABLE([toporouter-output],
347  [AS_HELP_STRING([--enable-toporouter-output], [enable toporouter graphical output [default=no]]) ]
349 AS_CASE(["z$enable_toporouter_output"],[zyes | zno],,
350  [enable_toporouter_output=no]
352 AC_MSG_RESULT([$enable_toporouter_output])
353 AS_CASE([$enable_toporouter_output],[yes],
355   topo_output_enabled=1
356  ],
358   topo_output_enabled=0
361 AC_DEFINE_UNQUOTED([TOPO_OUTPUT_ENABLED], [$topo_output_enabled],
362  [Define to 1 to enable toporouter graphical output]
365 PKG_PROG_PKG_CONFIG()
367 if test "x$enable_toporouter_output" = "xyes"; then
368    PKG_CHECK_MODULES(CAIRO, cairo,,
369                      [AC_MSG_ERROR([Cannot find cairo, needed by the toporouter
370 Please review the following errors:
371 $CAIRO_PKG_ERRORS])]
372    )
375 AC_MSG_CHECKING([for whether to use DBUS])
376 AC_ARG_ENABLE([dbus],
377 [  --enable-dbus           Enable DBUS IPC],
378 [],[
379         case " $with_gui " in
380                 *\ gtk\ *)     enable_dbus=yes ;;
381                 *\ lesstif\ *) enable_dbus=yes ;;
382                 * )            enable_dbus=no ;;
383         esac
386 AC_MSG_RESULT([$enable_dbus])
387 AM_CONDITIONAL(WITH_DBUS, test x$enable_dbus = xyes)
389 if test "x$enable_dbus" = "xyes"; then
390         case " $with_gui " in
391                 *\ gtk\ *) ;;
392                 *\ lesstif\ *) ;;
393                 * ) AC_MSG_ERROR([DBUS enabled but only works with a mainloop capable GUI HID.
394 Either do not use --enable-dbus or enable the gtk or lesstif GUI HID.])
395         esac
396         
397         PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.61,
398                 [saved_LIBS="$LIBS"
399                  LIBS="$LIBS $DBUS_LIBS"
400                  AC_CHECK_FUNCS(dbus_watch_get_unix_fd)
401                  LIBS="$saved_LIBS" ],
402                 [AC_MSG_ERROR([Cannot find dbus-1 >= 0.61, install it and rerun ./configure
403 Please review the following errors:
404 $DBUS_PKG_ERRORS])]
405         )
406         DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
407         
408         AC_DEFINE([HAVE_DBUS], 1,
409                 [Define to 1 if DBUS IPC is to be compiled in])
414 AC_MSG_CHECKING([for whether to use GL drawing])
415 AC_ARG_ENABLE([gl],
416 [  --enable-gl           Enable GL drawing (with GTK HID)],
417 [],[
418         case " $with_gui " in
419                 *\ gtk\ *) enable_gl=yes;;
420                 * ) enable_gl=no;;
421         esac
423 AC_MSG_RESULT([$enable_gl])
424 AM_CONDITIONAL(USE_GL, test x$enable_gl = xyes)
426 if test "x$enable_gl" = "xyes"; then
427         case " $with_gui " in
428                 *\ gtk\ *) ;;
429                 * ) AC_MSG_ERROR([GL drawing enabled but only works with the GTK HID.
430 Either do not use --enable-gl or enable the gtk HID.])
431         ;;
432         esac
434         AX_CHECK_GL
435         AS_IF([test X$no_gl = Xyes],
436               [AC_MSG_FAILURE([OpenGL is required.])])
438         AX_CHECK_GLU
439         AS_IF([test X$no_glu = Xyes],
440               [AC_MSG_FAILURE([The OpenGL GLU library is required.])])
442         AC_DEFINE([ENABLE_GL], 1,
443                 [Define to 1 if GL support is to be compiled in])
446 AC_MSG_CHECKING([for which printer to use])
447 AC_ARG_WITH([printer],
448 [  --with-printer=        Specify the printer: lpr [[default=lpr]]],
449 [],[with_printer=lpr])
450 AC_MSG_RESULT([$with_printer])
451 case " $hid_printers " in
452      *\ $with_printer\ * )
453          HIDLIST="$HIDLIST $with_printer"
454          ;;
455      * ) AC_MSG_ERROR([$with_printer is not a valid printer]) ;;
456 esac
458 AC_MSG_CHECKING([for which exporters to use])
459 AC_ARG_WITH([exporters],
460 [  --with-exporters=       Enable export devices: bom gerber gcode nelma png ps ipcd356 [[default=bom gerber gcode nelma png ps ipcd356]]],
461 [],[with_exporters=$hid_exporters])
462 AC_MSG_RESULT([$with_exporters])
463 for e in `echo $with_exporters | sed 's/,/ /g'`; do
464     case " $hid_exporters " in
465       *\ $e\ * )
466          HIDLIST="$HIDLIST $e"
467          ;;
468       * ) AC_MSG_ERROR([$e is not a valid exporter]) ;;
469     esac
470 done
472 if test "X$enable_jpeg" = "Xno" -a "X$enable_gif" = "Xno" -a "X$enable_png" = "Xno" ; then
473         case " ${HIDLIST} " in
474                 *\ png\ *)
475                         AC_MSG_ERROR([you have requested the png HID but turned off all output
476 formats!  If you do not want gif/jpeg/png output, use --with-exporters to list
477 which exporters you want and do not list png there.])
478                         ;;
480                 *)
481                         ;;
482         esac
485 # Location of STEPcode sources to build against
486 AC_ARG_WITH(stepcodedir, [  --with-stepcodedir=path  Change where the STEPcode source tree is located [[]]], [stepcodedir=$withval])
488 if test x$stepcodedir = x ; then
489         case " ${HIDLIST} " in
490                 *\ step\ *)
491                         AC_MSG_ERROR([you have requested the STEP export HID but not specified the location
492 of the STEPcode sources to build against])
493                         ;;
495                 *)
496                         ;;
497         esac
499 STEPCODEDIR=$stepcodedir
500 AC_SUBST(STEPCODEDIR)
502 for hid in $HIDLIST; do
503     F=$srcdir/src/hid/$hid/hid.conf
504     if test -f $F ; then
505         echo checking $hid dependencies
506         deps=
507         . $F
508         for dep in $deps; do
509             if test "X`echo $HIDLIST | grep $dep`" = "X"; then
510                 AC_MSG_ERROR([you have requested the $hid HID but not the $dep HID, which it depends on])
511             fi
512         done
513    fi
514 done
516 for e in $HIDLIST; do
517     HIDLIBS="$HIDLIBS lib$e.a"
518 done
520 AC_SUBST(HIDLIST)
521 AC_SUBST(HIDLIBS)
523 # ------------- end HID config -------------------
525 ######################################################################
527 # desktop integration
530 AC_PATH_PROG(SETENV, env, [])
531 AC_PATH_PROG(GTK_UPDATE_ICON_CACHE_BIN, gtk-update-icon-path, [true])
533 # Change default location for XDG files (MIME and Icons)
534 AC_ARG_WITH(xdgdatadir, [  --with-xdgdatadir=path  Change where the theme icons 
535 and mime registrations are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
537 # Change default location for KDE data files (KDE MIME registrations)
538 AC_ARG_WITH(kdedatadir, [  --with-kdedatadir=path  Change where the KDE mime reg
539 istrations are installed [[DATADIR]]], [opt_kdedatadir=$withval])
541 if test x$opt_xdgdatadir = x; then
542         # path was not specified with --with-xdgdatadir
543         XDGDATADIR='${datadir}'
544 else
545         # path WAS specified with --with-xdgdatadir
546         XDGDATADIR="$opt_xdgdatadir"
548 AC_SUBST(XDGDATADIR)
550 if test x$opt_kdedatadir = x; then
551         # path was not specified with --with-kdedatadir
552         KDEDATADIR='${datadir}'
553 else
554         # path WAS specified with --with-kdedatadir
555         KDEDATADIR="$opt_kdedatadir"
557 AC_SUBST(KDEDATADIR)
559 AC_ARG_ENABLE(update-desktop-database,
560         AC_HELP_STRING([--disable-update-desktop-database],
561         [do not update desktop database after installation]),,
562         enable_update_desktop_database=yes)
564 AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE, test x$enable_update_desktop_database = xyes)
566 if test x$enable_update_desktop_database = xyes ; then
567         AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
568         if test $UPDATE_DESKTOP_DATABASE = no; then
569         AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
570         fi
573 AC_ARG_ENABLE(update-mime-database,
574         AC_HELP_STRING([--disable-update-mime-database],
575         [do not update mime database after installation]),,
576         enable_update_mime_database=yes)
578 AM_CONDITIONAL(ENABLE_UPDATE_MIME_DATABASE, test x$enable_update_mime_database = xyes)
580 if test x$enable_update_mime_database = xyes ; then
581         AC_PATH_PROG(UPDATE_MIME_DATABASE, [update-mime-database], no)
582         if test $UPDATE_MIME_DATABASE = no; then
583         AC_MSG_ERROR([Cannot find update-mime-database, make sure it is installed and in your PATH, or configure with --disable-update-mime-database])
584         fi
588 ######################################################################
590 AC_PATH_PROGS(M4, gm4 m4, [none])
591 if test "X$M4" = "Xnone" ; then
592         AC_MSG_ERROR([Did not find a m4 executible.  You need to make sure
593         that m4 is installed on your system and that m4 is in your path])
595 AC_MSG_CHECKING([if $M4 has the division involving negative numbers bug])
596 pcb_m4_r=`echo "eval(-2/2)" | $M4`
597 if test "$pcb_m4_r" != "-1" ; then
598         AC_MSG_RESULT([yes])
599         AC_MSG_ERROR([It appears that $M4 has a bug involving division
600 with negative numbers.  In particular it just returned the result that
601 -2/2 = $pcb_m4_r instead of -1.  This is a known bug in GNU m4-1.4.9.  Please
602 install a non-broken m4.])
603 else
604         AC_MSG_RESULT([no])
608 AC_PATH_PROGS(WISH, wish wish85 wish8.5 wish83 wish8.3 wish80 wish8.0 cygwish83 cygwish80,[none])
609 if test "X$WISH" = "Xnone" ; then
610         AC_MSG_ERROR([Did not find the wish executible.  You need to make sure
611         that tcl is installed on your system and that wish is in your path])
614 AC_DEFINE_UNQUOTED(M4,$M4,[m4 executible])
615 GNUM4=$M4
616 AC_SUBST(GNUM4)
617 AC_DEFINE_UNQUOTED(GNUM4,"$M4",[m4 program used by pcb])
619 AC_PATH_PROG(PDFLATEX, pdflatex, notfound)
620 AM_CONDITIONAL(MISSING_PDFLATEX, test x$PDFLATEX = xnotfound)
622 AC_PATH_PROG(TEXI2DVI, texi2dvi, notfound)
623 AM_CONDITIONAL(MISSING_TEXI2DVI, test x$TEXI2DVI = xnotfound)
625 AC_PATH_PROG(PS2PDF, ps2pdf, notfound)
626 AM_CONDITIONAL(MISSING_PS2PDF, test x$PS2PDF = xnotfound)
628 # used to build some of the getting started guide
629 AC_PATH_PROG(GSCHEM, gschem, notfound)
630 AM_CONDITIONAL(MISSING_GSCHEM, test x$GSCHEM = xnotfound)
632 if test "X$docs_yesno" = "Xyes" -a "X$pcb_git_version" = "Xyes" ; then
633         if test "$PDFLATEX" = "notfound" -o "$TEXI2DVI" = "notfound" -o "$PS2PDF" = "notfound" ; then
634                 AC_MSG_ERROR([It appears that you are building from a source tree obtained
635 via git but you do not have the required tools installed to build the documentation.  Here
636 is a list of tools and the detected values:
637 PDFLATEX:  $PDFLATEX
638 TEXI2DVI:  $TEXI2DVI
639 PS2PDF:    $PS2PDF
640 GSCHEM:    $GSCHEM
642 Either make sure these tools are installed or disable building and installing the documentation
643 by using the --disable-doc configure option.
645         fi
648 ############################################################################
650 # These checks are for tools used by the testsuite.  It will not be fatal
651 # if these are missing because this is primarily for developer use.  It is
652 # possible that we might add some --enable flag in the future that forces
653 # full tools for development work.
655 # Check for ImageMagick tools used by the testsuite
656 AC_PATH_PROG(IM_ANIMATE, animate, notfound)
657 AC_PATH_PROG(IM_COMPARE, compare, notfound)
658 AC_PATH_PROG(IM_COMPOSITE, composite, notfound)
659 AC_PATH_PROG(IM_CONVERT, convert, notfound)
660 AC_PATH_PROG(IM_DISPLAY, display, notfound)
661 AC_PATH_PROG(IM_MONTAGE, montage, notfound)
662 AC_PATH_PROG(XHOST, xhost, notfound)
663 missing_magick=""
664 test "${IM_ANIMATE}" != "notfound" || missing_magick="${missing_magick} animate"
665 test "${IM_COMPARE}" != "notfound" || missing_magick="${missing_magick} compare"
666 test "${IM_COMPOSITE}" != "notfound" || missing_magick="${missing_magick} composite"
667 test "${IM_CONVERT}" != "notfound" || missing_magick="${missing_magick} convert"
668 test "${IM_DISPLAY}" != "notfound" || missing_magick="${missing_magick} display"
669 test "${IM_MONTAGE}" != "notfound" || missing_magick="${missing_magick} montage"
671 AC_MSG_CHECKING([if all ImageMagick tools needed for the testsuite were found])
672 if test "X${missing_magick}" != "X" ; then
673     AC_MSG_RESULT([no.  The testsuite will be disabled because the following
674 tools from the ImageMagick suite were not found:
675 ${missing_magick}
676 No loss in pcb functionality should be experienced, you just will not
677 be able to run the full regression testsuite.
679     have_magick=no
680 else
681     AC_MSG_RESULT([yes])
682     have_magick=yes
685 have_test_tools=yes
687 test $have_magick = yes || have_test_tools=no
689 # the RS274-X export HID is partially checked by looking at the result with
690 # gerbv
691 AC_PATH_PROG(GERBV, gerbv, notfound)
692 test $GERBV != notfound || have_test_tools=no
695 AM_CONDITIONAL(HAVE_TEST_TOOLS, test x$have_test_tools = xyes)
696 AC_MSG_CHECKING([if all the required testsuite tools were found])
697 if test x$have_test_tools = xyes ; then
698         AC_MSG_RESULT([yes])
699 else
700         AC_MSG_RESULT([no -- the testsuite will be disabled])
705 ############################################################################
708 dnl Checks for libraries.
709 AC_CHECK_LIB(m, sqrt)
710 AC_CHECK_LIB(dl, dlopen)
711 AC_CHECK_LIB(xnet, gethostbyname)
712 AC_CHECK_LIB(fl, yywrap)
714 dnl Checks for functions
715 AC_CHECK_FUNCS(getline)
716 AC_CHECK_FUNCS(strcasestr)
717 AC_CHECK_FUNCS(strerror)
718 AC_CHECK_FUNCS(regcomp re_comp)
719 AC_CHECK_FUNCS(logf expf rint)
720 AC_CHECK_FUNCS(vsnprintf)
721 AC_CHECK_FUNCS(getpwuid getcwd)
722 AC_CHECK_FUNCS(rand random)
723 AC_CHECK_FUNCS(stat)
725 AC_CHECK_FUNCS(mkdtemp)
727 # normally used for all file i/o
728 AC_CHECK_FUNCS(popen)
730 # for lrealpath.c
731 AC_CHECK_FUNCS(realpath canonicalize_file_name)
732 libiberty_NEED_DECLARATION(canonicalize_file_name)
734 # for pcb_spawnvp in action.c on Windows
735 AC_CHECK_FUNCS(_spawnvp)
737 AC_HEADER_STDC
738 AC_CHECK_HEADERS(limits.h locale.h string.h sys/types.h regex.h pwd.h)
739 AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h sys/param.h sys/times.h sys/wait.h)
740 AC_CHECK_HEADERS(dlfcn.h)
742 if test "x${WIN32}" = "xyes" ; then
743         AC_CHECK_HEADERS(windows.h)
745 # Search for glib
746 PKG_CHECK_MODULES(GLIB, glib-2.0, ,
747                 [AC_MSG_RESULT([Note: cannot find glib-2.0.
748 You may want to review the following errors:
749 $GLIB_PKG_ERRORS])]
752 need_gdlib=no
753 with_gif=no
754 with_png=no
755 with_jpeg=no
757 for e in $HIDLIST; do
758     case $e in
759       lesstif )
760         AC_PATH_XTRA
761         save_CPPFLAGS="$CPPFLAGS"
762         CPPFLAGS="$X_CFLAGS"
763         AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS)
764         AC_CHECK_LIB(ICE, main, , , $X_LIBS)
765         AC_CHECK_LIB(SM, main, , , $X_LIBS)
766         AC_CHECK_LIB(Xext, main, , , $X_LIBS)
767         AC_CHECK_LIB(Xt, XtOpenDisplay, , , $X_LIBS)
768         AC_CHECK_LIB(Xmu, main, , , $X_LIBS)
769         AC_CHECK_LIB(Xpm, main, , , $X_LIBS)
770         AC_CHECK_LIB(Xm, XmCreateMainWindow, , , $X_LIBS)
771         CPPFLAGS="$save_CPPFLAGS"
772         case $ac_cv_lib_Xm_XmCreateMainWindow in
773           no )
774             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
775             ;;
776           * ) ;;
777         esac
778         AC_CHECK_HEADERS(Xm/Xm.h)
779         case $ac_cv_header_Xm_Xm_h in
780           no )
781             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
782             ;;
783           * ) ;;
784         esac
785         ;;
787       gtk )
788         # Check for pkg-config
789         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
790         if test "$PKG_CONFIG" = "no"; then
791                 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
792         fi
794         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0, ,
795                 [AC_MSG_ERROR([Cannot find gtk+ >= 2.18.0, install it and rerun ./configure
796 Please review the following errors:
797 $GTK_PKG_ERRORS])]
798         )
799         GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
800         GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
802         if test "x$enable_gl" = "xyes"; then
803                 # Check for GtkGLExt
804                 PKG_CHECK_MODULES(GTKGLEXT, gtkglext-1.0 >= 1.0.0, , [AC_MSG_ERROR([
805 *** Required version of gtkglext is not installed - please install first ***
806 Please review the following errors:
807 $GTKGLEXT_PKG_ERRORS])]
808                 )
809         GTKGLEXT_VER=`$PKG_CONFIG gtkglext-1.0 --modversion`
810         fi
812         AC_MSG_CHECKING([if linux/input.h is available (to build SpaceNavivator driver])
813         AC_CHECK_HEADERS([linux/input.h])
814         AC_MSG_RESULT([$HAVE_LINUX_INPUT_H])
815         AM_CONDITIONAL(WITH_SNAVI, test "x$ac_cv_header_linux_input_h" = xyes)
816         if test "x$ac_cv_header_linux_input_h" = xyes ; then
817                 AC_DEFINE([WITH_SNAVI], 1, [Define to 1 if SpaceNavigator driver is available])
818                 with_snavi=yes
819         else
820                 with_snavi=no
821         fi
822         ;;
824       png)
825         need_gdlib=yes
826         AC_MSG_CHECKING([if GIF output from the png HID is desired])
827         AC_ARG_ENABLE([gif],
828                 [  --disable-gif           Disable support for gif output when the png HID is used [[default=include gif support]]],
829                 [
830                 if test "X$enable_gif" != "Xno" ; then
831                         AC_MSG_RESULT([yes])
832                         with_gif=yes
833                 else
834                         AC_MSG_RESULT([no])
835                 fi
836                 ],
837                 [
838                 AC_MSG_RESULT([yes])
839                 with_gif=yes
840                 ])
842         AC_MSG_CHECKING([if JPEG output from the png HID is desired])
843         AC_ARG_ENABLE([jpeg],
844                 [  --disable-jpeg          Disable support for JPEG output when the png HID is used [[default=include JPEG support]]],
845                 [
846                 if test "X$enable_jpeg" != "Xno" ; then
847                         AC_MSG_RESULT([yes])
848                         with_jpeg=yes
849                 else
850                         AC_MSG_RESULT([no])
851                 fi
852                 ],
853                 [
854                 AC_MSG_RESULT([yes])
855                 with_jpeg=yes
856                 ])
858         AC_MSG_CHECKING([if PNG output from the png HID is desired])
859         AC_ARG_ENABLE([png],
860                 [  --disable-png           Disable support for PNG output when the png HID is used [[default=include PNG support]]],
861                 [
862                 if test "X$enable_png" != "Xno" ; then
863                         AC_MSG_RESULT([yes])
864                         with_png=yes
865                 else
866                         AC_MSG_RESULT([no])
867                 fi
868                 ],
869                 [
870                 AC_MSG_RESULT([yes])
871                 with_png=yes
872                 ])
873         ;;
875       gcode|nelma)
876         need_gdlib=yes
877         with_png=yes
878         ;;
880     esac
881 done
883 if test "$need_gdlib" = "yes"; then
884         # Search for glib
885         PKG_CHECK_MODULES(GDLIB, gdlib,[found_gdlib=yes] , [found_gdlib=no])
887         if test "X$found_gdlib" = "Xno"; then
888                 # older installs came with gdlib-config and not the .pc file
889                 # to work with pkg-config
890                 AC_PATH_PROG([GDLIB_CONFIG], [gdlib-config], [notfound])
891                 if test "$GDLIB_CONFIG" = "notfound" ; then
892                         AC_MSG_ERROR([cannot find gdlib-config.  gdlib
893 is required for gcode, nelma, png HIDs 
894 You may want to review the following errors
895 from $PKG_CONFIG:
896 $GDLIB_PKG_ERRORS])
897                 else
898                         AC_MSG_CHECKING([for gdlib cflags])
899                         GDLIB_CFLAGS=`${GDLIB_CONFIG} --cflags`
900                         AC_MSG_RESULT([$GDLIB_CFLAGS])
902                         AC_MSG_CHECKING([for gdlib libraries])
903                         GDLIB_LIBS=`${GDLIB_CONFIG} --libs`
904                         AC_MSG_RESULT([$GDLIB_LIBS])
906                         AC_MSG_CHECKING([for gdlib ldflags])
907                         GDLIB_LDFLAGS=`${GDLIB_CONFIG} --ldflags`
908                         AC_MSG_RESULT([$GDLIB_LDFLAGS])
909                 fi
910         fi
912         save_LIBS="$LIBS"
913         LIBS="$LIBS $GDLIB_LDFLAGS $GDLIB_LIBS"
915         # some older installs, Ubuntu Precise for example, leave off the "-lgd" part.
916         # try to see if it needs to be added
917         before_LIBS="$LIBS"
918         AC_SEARCH_LIBS([gdImageCreate],[gd],[],[
919                         AC_MSG_ERROR([Unable to figure out how to link gd applications.
920 It is likely that your system has a broken gdlib-config or gdlib.pc file used by
921 pkg-config.
922 ])],[])
923         if test "$LIBS" != "${before_LIBS}" ; then
924                 GDLIB_LIBS="${GDLIB_LIBS} -lgd"
925         fi
927         if test "X$with_gif" = "Xyes" ; then
928                 AC_CHECK_FUNCS(gdImageGif)
929                 if test "$ac_cv_func_gdImageGif" != "yes"; then
930                         AC_MSG_ERROR([Your gd installation does not appear to include gif support.
931 You may need to update your installation of gd or disable
932 gif export with --disable-gif])
933                 fi
934         fi
936         if test "X$with_jpeg" = "Xyes" ; then
937                 AC_CHECK_FUNCS(gdImageJpeg)
938                 if test "$ac_cv_func_gdImageJpeg" != "yes"; then
939                         AC_MSG_ERROR([Your gd installation does not appear to include JPEG support.
940 You may need to update your installation of gd or disable
941 JPEG export with --disable-jpeg])
942                 fi
943         fi
945         if test "X$with_png" = "Xyes" ; then
946                 AC_CHECK_FUNCS(gdImagePng)
947                 if test "$ac_cv_func_gdImagePng" != "yes"; then
948                         AC_MSG_ERROR([Your gd installation does not appear to include PNG support.
949 You may need to update your installation of gd or disable
950 PNG export with --disable-png])
951                 fi
952         fi
953         LIBS="$save_LIBS"
956 AM_CONDITIONAL(PNG, test x$with_png = xyes)
957 AM_CONDITIONAL(GIF, test x$with_gif = xyes)
959 # ------------- check if png previews should be built for pcblib-newlib
960 AC_MSG_CHECKING([if the m4lib to newlib export should create png previews])
961 AC_ARG_ENABLE(
962         [m4lib-png],
963         [  --enable-m4lib-png      Enable creating png previews for the m4 library],
964         [],[enable_m4lib_png=no])
965 AC_MSG_RESULT([$enable_m4lib_png])
966 AM_CONDITIONAL(PNG_PREVIEW, test x$enable_m4lib_png = xyes)
969 # Run away.... more ugly stuff here.  By default we don't actually build
970 # pcblib-newlib from pcblib unless we are building from cvs or git sources.
971 # The reason is it takes a while and requires the png HID.  The problem is,
972 # what if someone wants to use --enable-m4lib-png but the tarball was built
973 # without the previews.  Or, what if someone does not want the PNG previews
974 # but the person building the tarball included them.  Ugh!  So what the following
975 # code attempts to do is detect that mismatch situation.  Note that we only
976 # want to kick this code in when *not* building from git or cvs sources.
977 build_pcblib_newlib=no
978 if test "$pcb_sources" = "tarball" ; then
979         AC_MSG_CHECKING([If pcblib-newlib was built with png previews])
980         stamp=$srcdir/lib/pcblib-newlib.stamp
981         if test ! -f ${stamp} ; then
982                 AC_MSG_RESULT([unknown, missing ${stamp}])
983                 build_pcblib_newlib=yes
984         else
985                 if test "`cat ${stamp}`" = "png-preview=yes" ; then
986                         AC_MSG_RESULT([yes])
987                         # lib exists and built with preview.
988                         # if we don't want the preview, than rebuild
989                         if test x$enable_m4lib_png != xyes ; then
990                                 build_pcblib_newlib=yes
991                         fi
992                 else
993                         AC_MSG_RESULT([no])
994                         # lib exists and built without preview.
995                         # if we want the preview, than rebuild
996                         if test x$enable_m4lib_png = xyes ; then
997                                 build_pcblib_newlib=yes
998                         fi
999                 fi
1000         fi
1001 else
1002         build_pcblib_newlib=yes
1004 AC_MSG_CHECKING([If pcblib-newlib needs to be rebuilt])
1005 AC_MSG_RESULT([$build_pcblib_newlib])
1006 AM_CONDITIONAL(BUILD_PCBLIB_NEWLIB, test x$build_pcblib_newlib = xyes)
1008 if test "X$cross_compiling" = "Xyes" ; then
1009         # we are cross compiling so we will need a build host binary for pcb
1010         AC_PATH_PROG(PCB, [pcb], [notfound])
1011 else
1012         PCB="\${top_builddir}/src/pcb"
1014 AC_SUBST(PCB)
1016 # now make see how essential it was that we have a pcb executable for the build
1017 # host
1018 if test "X$pcb_git_version" = "Xyes" ; then
1019         if test "X$docs_yesno" = "Xyes" -o "X$enable_m4lib_png" = "Xyes" ; then
1020                 if test "$PCB" = "notfound" ; then
1021                         AC_MSG_ERROR([You have selected a build with m4lib png
1022 previews enabled and/or with building the documentation enabled but you also
1023 appear to be cross-compiling.  For this to work, you must have a pcb installed that
1024 can run on this machine (the build machine) because it is needed for generating
1025 library footprint png previews as well as some of the figures in the documentation.
1026 If you wish to skip building the documentation and the footprint previews then add
1027 --disable-doc --disable-m4lib-png
1028 This will allow your cross build to work.])
1029                 fi
1030         fi
1033 # ------------- Xrender -------------------
1034 have_xrender=no
1035 AC_CHECK_LIB(Xrender,XRenderQueryExtension,have_xrender=yes,have_xrender=no,$X_LIBS)
1037 AC_ARG_ENABLE([xrender],
1038 [  --disable-xrender       Compile and link with Xrender [default=yes]])
1039 case "$have_xrender:$enable_xrender" in
1040    no:* ) ;;
1041    *:no ) ;;
1042    * )
1043      X_LIBS="-lXrender $X_LIBS"
1044      AC_DEFINE([HAVE_XRENDER], 1,
1045                 [Define to 1 if Xrender is available])
1046      ;;
1047 esac
1049 # ------------- Xinerama -------------------
1050 have_xinerama=no
1051 AC_CHECK_LIB(Xinerama,XineramaQueryExtension,have_xinerama=yes,have_xinerama=no,$X_LIBS)
1053 AC_ARG_ENABLE([xinerama],
1054 [  --disable-xinerama       Compile and link with Xinerama [default=yes]])
1055 case "$have_xinerama:$enable_xinerama" in
1056    no:* ) ;;
1057    *:no ) ;;
1058    * )
1059      X_LIBS="-lXinerama $X_LIBS"
1060      AC_DEFINE([HAVE_XINERAMA], 1,
1061                 [Define to 1 if Xinerama is available])
1062      ;;
1063 esac
1065 # ------------- dmalloc -------------------
1066 dnl dmalloc checks
1067 with_dmalloc=no
1068 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
1069 AC_ARG_ENABLE([dmalloc],
1070 [  --enable-dmalloc        Compile and link with dmalloc for malloc debugging [default=no]],
1072 if test "X$enable_dmalloc" != "Xno" ; then
1073         AC_MSG_RESULT([yes])
1074         AC_CHECK_HEADER(dmalloc.h,,
1075                 AC_MSG_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
1076         AC_CHECK_LIB(dmalloc,main,,
1077                 AC_MSG_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
1078         DMALLOC_LIBS="-ldmalloc"
1079         with_dmalloc=yes
1080 else
1081         AC_MSG_RESULT([no])
1082         DMALLOC_LIBS=""
1086         AC_MSG_RESULT([no])
1087         DMALLOC_LIBS=""
1090 # ------------- ElectricFence -------------------
1091 dnl ElectricFence checks
1092 with_efence=no
1093 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
1094 AC_ARG_ENABLE([efence],
1095 [  --enable-efence         Link with ElectricFence for malloc debugging [default=no]],
1097 if test "X$enable_efence" != "Xno" ; then
1098         AC_MSG_RESULT([yes])
1099         AC_CHECK_LIB(efence,main,,
1100                 AC_MSG_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
1101         with_efence=yes
1102 else
1103         AC_MSG_RESULT([no])
1107 AC_MSG_RESULT([no])
1110 # ------------- Enable Debug code -------------------
1111 AC_MSG_CHECKING([for whether to enable debugging code])
1112 AC_ARG_ENABLE([debug],
1113 [  --enable-debug          Enable debugging code],
1114 [],[enable_debug=no])
1116 AC_MSG_RESULT([$enable_debug])
1117 AM_CONDITIONAL(DEBUG_BUILD, test x$enable_debug = xyes)
1119 # ------------- mkdir required for win32 compatibility ------------
1120 # WIN32 mkdir takes only one argument, POSIX takes two.
1121 # #include "misc.h" where mkdir is required.
1122 m4_include([m4/m4_ax_func_mkdir.m4])
1123 AX_FUNC_MKDIR
1125 # ------------- Type used for "Coord" type -------------------
1127 AC_CHECK_HEADERS(stdint.h)
1128 AC_ARG_ENABLE([coord64],
1129 [  --enable-coord64        Force 64-bit coordinate types],
1130 [],[enable_coord64=no])
1131 AC_ARG_ENABLE([coord32],
1132 [  --enable-coord32        Force 32-bit coordinate types],
1133 [],[enable_coord32=no])
1135 COORDTYPE="long"
1137 echo "$enable_coord32:$enable_coord64:$ac_cv_header_stdint_h"
1138 case "$enable_coord32:$enable_coord64:$ac_cv_header_stdint_h" in
1139   yes:no:yes )
1140     COORD_TYPE="int32_t"
1141     COORD_MAX="INT32_MAX"
1142     ;;
1143   no:yes:yes )
1144     COORD_TYPE="int64_t"
1145     COORD_MAX="INT64_MAX"
1146     ;;
1147   yes:no:no  )
1148     COORD_TYPE="int"
1149     COORD_MAX="INT_MAX"
1150     ;;
1151   no:yes:no  )
1152     COORD_TYPE="long long"
1153     COORD_MAX="LLONG_MAX"
1154     ;;
1155   yes:yes:*  )
1156     AC_MSG_ERROR("*** cannot require both 32 and 64 bit coordinates")
1157     ;;
1158   *:*:*    )
1159     COORD_TYPE="long"
1160     COORD_MAX="LONG_MAX"
1161     ;;
1162 esac
1163 AC_DEFINE_UNQUOTED([COORD_TYPE],[$COORD_TYPE],
1164   [C type for Coordinates])
1165 AC_DEFINE_UNQUOTED([COORD_MAX],[$COORD_MAX],
1166   [Maximum value of coordinate type])
1168 # ------------- Complete set of CPPFLAGS and LIBS -------------------
1170 CPPFLAGS="$CPPFLAGS $X_CFLAGS $DBUS_CFLAGS $GDLIB_CFLAGS $GLIB_CFLAGS $GTK_CFLAGS $GD_CFLAGS $CAIRO_CFLAGS $GTKGLEXT_CFLAGS $GLU_CFLAGS $GL_CFLAGS"
1171 LIBS="$LIBS $XM_LIBS $DBUS_LIBS $X_LIBS $GDLIB_LDFLAGS $GDLIB_LIBS $GLIB_LIBS $GTK_LIBS $DMALLOC_LIBS $GD_LIBS $INTLLIBS $CAIRO_LIBS $GTKGLEXT_LIBS $GLU_LIBS $GL_LIBS"
1174 # if we have gcc then add -Wall
1175 if test "x$GCC" = "xyes"; then
1176         # see about adding some extra checks if the compiler takes them
1177         for flag in -Wall -fno-omit-frame-pointer; do
1178                 case " ${CFLAGS} " in
1179                         *\ ${flag}\ *)
1180                                 # flag is already present
1181                                 ;;
1182                         *)
1183                                 AC_MSG_CHECKING([if the compiler accepts ${flag}])
1184                                 ac_save_CFLAGS="$CFLAGS"
1185                                 CFLAGS="$CFLAGS ${flag}"
1186                                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1187                                         [AC_MSG_RESULT([yes])],
1188                                         [AC_MSG_RESULT([no])
1189                                          CFLAGS="$ac_save_CFLAGS"
1190                                         ]
1191                                 )
1192                                 ;;
1193                 esac
1194         done
1197 CXXFLAGS="$CFLAGS"
1199 # Now add C-specific flags
1200 if test "x$GCC" = "xyes"; then
1201         # see about adding some extra checks if the compiler takes them
1202         for flag in -Wdeclaration-after-statement ; do
1203                 case " ${CFLAGS} " in
1204                         *\ ${flag}\ *)
1205                                 # flag is already present
1206                                 ;;
1207                         *)
1208                                 AC_MSG_CHECKING([if the compiler accepts ${flag}])
1209                                 ac_save_CFLAGS="$CFLAGS"
1210                                 CFLAGS="$CFLAGS ${flag}"
1211                                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1212                                         [AC_MSG_RESULT([yes])],
1213                                         [AC_MSG_RESULT([no])
1214                                          CFLAGS="$ac_save_CFLAGS"
1215                                         ]
1216                                 )
1217                                 ;;
1218                 esac
1219         done
1222 # See if we are building gcc with C++.
1223 AC_ARG_ENABLE(build-with-cxx,
1224 [  --enable-build-with-cxx build with C++ compiler instead of C compiler],
1225 ENABLE_BUILD_WITH_CXX=$enableval,
1226 ENABLE_BUILD_WITH_CXX=no)
1228 case "$ENABLE_BUILD_WITH_CXX" in
1229   yes)
1230     CC_OR_CXX="$CXX"
1231     ;;
1232   no)
1233     CC_OR_CXX="$CC"
1234     ;;
1235 esac
1236 AC_SUBST(CC_OR_CXX)
1238 # font filename
1239 FONTFILENAME=${FONTFILENAME:-"default_font"}
1240 AC_SUBST(FONTFILENAME)
1241 AC_DEFINE_UNQUOTED(FONTFILENAME,"$FONTFILENAME",[File for default font])
1243 # standard autoconf variables
1244 CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\""
1245 CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\""
1246 CPPFLAGS="$CPPFLAGS -DHOST=\\\"\${host}\\\""
1248 # directory for old-style library and for fonts
1249 PCBLIBDIR=${datadir}/pcb
1250 AC_SUBST(PCBLIBDIR)
1251 #AC_DEFINE_UNQUOTED(PCBLIBDIR,"$PCBLIBDIR",[Library directory])
1252 CPPFLAGS="$CPPFLAGS -DPCBLIBDIR=\\\"$PCBLIBDIR\\\""
1254 # name for old-style library
1255 LIBRARYFILENAME=pcblib
1256 AC_SUBST(LIBRARYFILENAME)
1257 AC_DEFINE_UNQUOTED(LIBRARYFILENAME,"$LIBRARYFILENAME",[library file name])
1260 # directory for new library
1261 PCBTREEDIR=${datadir}/pcb/newlib
1262 PCBTREEPATH=${PCBTREEDIR}:${PCBLIBDIR}/pcblib-newlib
1263 PCBTREEDIR=${PCBTREEDIR:-"$PCBTREEDIR"}
1264 AC_SUBST(PCBTREEDIR)
1265 AC_SUBST(PCBTREEPATH)
1266 #AC_DEFINE_UNQUOTED(PCBTREEDIR,"$PCBLIB",[top directory for new style pcb library])
1267 CPPFLAGS="$CPPFLAGS -DPCBTREEDIR=\\\"$PCBTREEDIR\\\""
1268 CPPFLAGS="$CPPFLAGS -DPCBTREEPATH=\\\"$PCBTREEPATH\\\""
1270 # Figure out relative paths
1271 AC_MSG_CHECKING([for the bindir to pcblibdir relative path])
1272 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBLIBDIR:bindir_to_pcblibdir])
1273 adl_NORMALIZE_PATH([bindir_to_pcblibdir], [$PCB_DIR_SEPARATOR_S])
1274 AC_MSG_RESULT([$bindir_to_pcblibdir])
1275 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBLIBDIR, "$bindir_to_pcblibdir", [Relative path from bindir to pcblibdir])
1277 AC_MSG_CHECKING([for the bindir to pcbtreedir relative path])
1278 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBTREEDIR:bindir_to_pcbtreedir])
1279 adl_NORMALIZE_PATH([bindir_to_pcbtreedir], [$PCB_DIR_SEPARATOR_S])
1280 AC_MSG_RESULT([$bindir_to_pcbtreedir])
1281 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBTREEDIR, "$bindir_to_pcbtreedir", [Relative path from bindir to pcbtreedir])
1284 AC_MSG_CHECKING([for the bindir to exec_prefix relative path])
1285 adl_COMPUTE_RELATIVE_PATHS([bindir:exec_prefix:bindir_to_execprefix])
1286 adl_NORMALIZE_PATH([bindir_to_execprefix], [$PCB_DIR_SEPARATOR_S])
1287 AC_MSG_RESULT([$bindir_to_execprefix])
1288 AC_DEFINE_UNQUOTED(BINDIR_TO_EXECPREFIX, "$bindir_to_execprefix", [Relative path from bindir to exec_prefix])
1291 BTNMOD=${BTNMOD:-"Mod1"}
1292 AC_SUBST(BTNMOD)
1294 TOPDIRS=
1295 for dir in src lib newlib doc example tools tutorial README_FILES
1297    test -d $dir/. && TOPDIRS="$TOPDIRS $dir"
1298 done
1299 AC_SUBST(TOPDIRS)
1301 AC_CONFIG_FILES(Makefile data/Makefile intl/Makefile po/Makefile.in)
1303 if test -d $srcdir/README_FILES; then
1304    AC_CONFIG_FILES(README_FILES/Makefile)
1306 if test -d $srcdir/doc; then
1307    AC_CONFIG_FILES(doc/Makefile)
1309 if test -d $srcdir/doc/gs; then
1310    AC_CONFIG_FILES(doc/gs/Makefile)
1311    AC_CONFIG_FILES(doc/gs/gafrc)
1312    AC_CONFIG_FILES(doc/gs/gschemrc)
1314 if test -d $srcdir/example; then
1315    AC_CONFIG_FILES(example/Makefile)
1316    AC_CONFIG_FILES(example/libraries/Makefile)
1318 if test -d $srcdir/lib; then
1319    AC_CONFIG_FILES(lib/CreateLibraryContents.sh)
1320    AC_CONFIG_FILES(lib/CreateLibrary.sh)
1321    AC_CONFIG_FILES(lib/ListLibraryContents.sh)
1322    AC_CONFIG_FILES(lib/Makefile)
1323    AC_CONFIG_FILES(lib/QueryLibrary.sh)
1324    AC_CONFIG_FILES(lib/qfp-ui)
1326 if test -d $srcdir/newlib; then
1327    AC_CONFIG_FILES(newlib/2_pin_thru-hole_packages/Makefile)
1328    AC_CONFIG_FILES(newlib/Makefile)
1329    AC_CONFIG_FILES(newlib/connectors/Makefile)
1330    AC_CONFIG_FILES(newlib/crystal/Makefile)
1331    AC_CONFIG_FILES(newlib/electro-optics/Makefile)
1332    AC_CONFIG_FILES(newlib/headers/Makefile)
1333    AC_CONFIG_FILES(newlib/keystone/Makefile)
1334    AC_CONFIG_FILES(newlib/msp430/Makefile)
1335    AC_CONFIG_FILES(newlib/not_vetted_ingo/Makefile)
1336    AC_CONFIG_FILES(newlib/sockets/Makefile)
1337    AC_CONFIG_FILES(newlib/tests/Makefile)
1339 AC_CONFIG_FILES(src/Makefile)
1340 AC_CONFIG_FILES(src/icons/Makefile)
1341 if test -d $srcdir/tools; then
1342    AC_CONFIG_FILES(tools/Makefile)
1344 if test -d $srcdir/tutorial; then
1345    AC_CONFIG_FILES(tutorial/Makefile)
1348 dnl testsuite
1349 AC_CONFIG_FILES(tests/Makefile)
1351 dnl GTS 0.7.6 - http://gts.sourceforge.net/
1352 AC_CONFIG_FILES(gts/Makefile)
1354 dnl win32 build scripts
1355 AC_CONFIG_FILES(w32/Makefile)
1357 dnl for building under cygwin
1358 AC_CONFIG_FILES(win32/Makefile)
1360 AC_OUTPUT
1362 with_gui=`echo $with_gui`
1363 with_printer=`echo $with_printer`
1364 with_exporters=`echo $with_exporters | sed 's/,/ /g'`
1366 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
1367 expandedKDEDATADIR=`eval "echo $KDEDATADIR"`
1369 AC_MSG_RESULT([
1370 ** Configuration summary for $PACKAGE $VERSION:
1372    Cross Compiling:          $cross_compiling
1373    CC:                       $CC
1374    CXX:                      $CXX
1375    CPPFLAGS:                 $CPPFLAGS
1376    CFLAGS:                   $CFLAGS
1377    CXXFLAGS:                 $CXXFLAGS
1378    LIBS:                     $LIBS
1379    PCB:                      $PCB
1381    GUI:                      $with_gui
1382    Printer:                  $with_printer
1383    Exporters:                $with_exporters
1384    Coordinate type:          $COORD_TYPE
1385    Source tree distribution: $pcb_sources
1386    Build documentation:      $docs_yesno
1387    Build toporouter:         $enable_toporouter
1388    Enable toporouter output: $enable_toporouter_output
1389    xdg data directory:       $expandedXDGDATADIR
1390    KDE data directory:       $expandedKDEDATADIR
1391    dmalloc debugging:        $with_dmalloc
1392    ElectricFence debugging:  $with_efence
1393    Regression tests enabled: $have_test_tools
1394    SpaceNavigator driver:    $with_snavi