Fix includes for glx check
[geda-pcb.git] / configure.ac
blobb7cbb4285fa41ce088f26fe0ed7e29b776ca8b2f
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 ##########################################################################
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.19.3])
123 AM_GNU_GETTEXT
125 AC_MSG_CHECKING([if $MSGFMT understands msgctxt (message context)])
126 cat > conftest.po <<EOF
127 [#]line __oline__ "configure"
128 [#]. -- Info tab
129 [#]: myfile.c:lineno
130 msgctxt "tab"
131 msgid "Info"
132 msgstr ""
134 if ($MSGFMT -o conftest.gmo conftest.po >/dev/null; exit) 2>&AS_MESSAGE_LOG_FD
135 then
137   AC_MSG_RESULT([yes])
138 else
139   AC_MSG_RESULT([no])
140   AC_MSG_ERROR([It appears that your gettext tools ($MSGFMT) is too old.
141 You should install a newer gettext tools (>= 0.19.3 suggested).  You may
142 specify the location of the msgfmt executible with MSGFMT=/path/to/msgfmt
143 on the configure command line.
146 rm -f conftest.po conftest.gmo
148 IT_PROG_INTLTOOL([0.35.0])
150 AC_C_INLINE
151 AC_PROG_CC_STDC
152 AC_PROG_CC_C99
153 AM_PROG_CC_C_O
154 AC_PROG_CPP
156 AC_MSG_CHECKING([that C compiler supports C99])
157 if test "X$ac_cv_prog_cc_c99" = "Xno"; then
158   AC_MSG_RESULT([no])
159   AC_MSG_ERROR([A C99-compliant compiler is requred])
160 else
161   AC_MSG_RESULT([yes])
164 AC_PROG_AWK
165 AC_PROG_MKDIR_P
167 AM_PROG_LEX
168 AC_PATH_PROG(LEX_PATH, $LEX, [notfound])
169 if test "$LEX_PATH" = "notfound" ; then
170         AC_MSG_ERROR([Couldn't find a usable lex program.
171 Please install flex which is available from
172 ftp://ftp.gnu.org/pub/non-gnu/flex/
177 AC_PROG_YACC
178 AC_PATH_PROG(YACC_PATH, $YACC, [notfound])
179 if test "$YACC_PATH" = "notfound" ; then
180         AC_MSG_ERROR([Couldn't find a usable yacc program.
181 Please install bison which is available from
182 ftp://ftp.gnu.org/pub/gnu/bison/
186 AC_PROG_INSTALL
187 AC_PROG_RANLIB
190 # Used for building the icons
192 AC_PATH_PROG(XPMTOPPM, xpmtoppm, notfound)
193 AC_PATH_PROG(PPMTOWINICON, ppmtowinicon, notfound)
194 AC_PATH_PROG(CONVERT, convert, notfound)
196 ##########################################################################
199 if test "X$docs_yesno" = "Xyes" -a "X$pcb_git_version" = "Xyes" ; then
200    AC_PATH_PROG(MKINFO, makeinfo, no)
201    if test "X$MKINFO" != "Xno"; then
202       AC_MSG_CHECKING([for GNU makeinfo version >= 4.6])
203       v=`$MKINFO --version | grep "GNU texinfo"`
204       if test $? -ne 0; then
205          AC_MSG_RESULT([non-GNU])
206          MKINFO="no"
207       fi
208    fi
209    if test "X$MKINFO" != "Xno"; then
210       vmajor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\1/'`
211       vminor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
212       AC_MSG_RESULT([$vmajor.$vminor])
213       if test "$vmajor" -lt 4 \
214               || (test "$vmajor" -eq 4 && test "$vminor" -lt 6); then
215          MKINFO=no
216       fi
217    fi
218    if test "X$MKINFO" = "Xno"; then
219       AC_MSG_ERROR([You have requested a build
220 of the documentation.  For this to work, you must have version 4.6 or newer of
221 the GNU texinfo package.  You seem to have
225 Please update to a newer version of texinfo or disable building of
226 the documentation with --disable-doc
228    fi
230    AC_PATH_PROG(TEXI2DVI, texi2dvi, no)
231    if test "X$TEXI2DVI" = "Xno"; then
232       AC_MSG_ERROR([You have requested a build
233 of the documentation.  For this to work, you must have the texi2dvi program
234 installed.  Alternatively, you can disable building the documentation with
235 --disable-doc.])
236    fi
239         AC_PATH_PROG(PERL, perl, notfound)
240         if test "X$PERL" = "Xnotfound"; then
241                         AC_MSG_ERROR([You have requested a build
242 of the documentation.  For this to work, you must have perl installed.
243 Alternatively, you can disable building the documentation with
244 --disable-doc.
246         fi
249    AC_PATH_PROG([KPSEWHICH], [kpsewhich], [no])
250    if test "X$KPSEWHICH" = "Xno"; then
251       AC_MSG_ERROR([You have requested a build
252 of the documentation.  For this to work, you must have a functional install of
253 TeX and LaTeX.  kpsewhich is part of TeX.
254 Alternatively, you can disable building the documentation with
255 --disable-doc.])
256    fi
258    AC_MSG_CHECKING([If your TeX installation contains epsf.tex])
259    f=`$KPSEWHICH epsf.tex`
260    if test $? -eq 0 ; then
261         AC_MSG_RESULT([yes ($f)])
262    else
263         AC_MSG_RESULT([no])
264         AC_MSG_ERROR([You have requested a build
265 of the documentation.  For this to work, you must have a functional install of
266 TeX and LaTeX that includes epsf.tex.  On some linux distributions this is
267 part of the texlive-generic-recommended package.  On NetBSD this is is part
268 of the tex-epsf package.
269 Alternatively, you can disable building the documentation with
270 --disable-doc.])
271    fi
275 ##########################################################################
279 # FIXME:  for now, only try to add -rdynamic if we're using gcc.  We really
280 # need to figure out what the correct test is here.  In the mean time, this
281 # should let things build with SunPRO again.
282 if test "x$GCC" = "xyes"; then
283 AC_MSG_CHECKING([If the compiler accepts -rdynamic])
284 old_LDFLAGS="$LDFLAGS"
285 LDFLAGS="$LDFLAGS -rdynamic"
286 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
287         [AC_MSG_RESULT([yes])],
288         [LDFLAGS="$old_LDFLAGS"
289         AC_MSG_RESULT([no])
290         ])
293 # ------------- HID config -------------------
295 hid_guis=""
296 hid_printers=""
297 hid_exporters=""
298 hid_always=""
300 for hid in `cd $srcdir/src/hid; echo *`; do
301     F=$srcdir/src/hid/$hid/hid.conf
302     if test -f $F 
303     then
304     echo checking $F
305         . $F
306         case $type in
307           gui ) hid_guis="$hid_guis $hid" ;;
308           printer ) hid_printers="$hid_printers $hid" ;;
309           export ) hid_exporters="$hid_exporters $hid" ;;
310           always ) hid_always="$hid_always $hid" ;;
311         esac
312     fi
313 done
315 AC_MSG_CHECKING([for which gui to use])
316 AC_ARG_WITH([gui],
317 [  --with-gui=            Specify the GUI to use: batch gtk lesstif [[default=gtk]]],
319 [with_gui=gtk]
321 AC_MSG_RESULT([$with_gui])
322 case " $hid_guis no none " in
323      *\ $with_gui\ * ) HIDLIST="$with_gui" ;;
324      * ) AC_MSG_ERROR([$with_gui is not a valid gui]) ;;
325 esac
327 WITHGUI="$with_gui"
328 AC_SUBST(WITHGUI)
330 if test x"$with_gui" = x"none" -o x"$with_gui" = x"no"
331 then
332     HIDLIST=
335 AC_MSG_CHECKING([whether to enable toporouter])
336 AC_ARG_ENABLE([toporouter],
337  [AS_HELP_STRING([--enable-toporouter], [build toporouter [default=yes]]) ]
339 AS_CASE(["x$enable_toporouter"],[xyes | xno],,
340  [enable_toporouter=yes
343 AC_MSG_RESULT([$enable_toporouter])
344 AM_CONDITIONAL([WITH_TOPOROUTER], test $enable_toporouter != no)
346 AC_MSG_CHECKING([whether to enable toporouter output])
347 AC_ARG_ENABLE([toporouter-output],
348  [AS_HELP_STRING([--enable-toporouter-output], [enable toporouter graphical output [default=no]]) ]
350 AS_CASE(["z$enable_toporouter_output"],[zyes | zno],,
351  [enable_toporouter_output=no]
353 AC_MSG_RESULT([$enable_toporouter_output])
354 AS_CASE([$enable_toporouter_output],[yes],
356   topo_output_enabled=1
357  ],
359   topo_output_enabled=0
362 AC_DEFINE_UNQUOTED([TOPO_OUTPUT_ENABLED], [$topo_output_enabled],
363  [Define to 1 to enable toporouter graphical output]
366 PKG_PROG_PKG_CONFIG()
368 if test "x$enable_toporouter_output" = "xyes"; then
369    PKG_CHECK_MODULES(CAIRO, cairo,,
370                      [AC_MSG_ERROR([Cannot find cairo, needed by the toporouter
371 Please review the following errors:
372 $CAIRO_PKG_ERRORS])]
373    )
376 AC_MSG_CHECKING([for whether to use DBUS])
377 AC_ARG_ENABLE([dbus],
378 [  --enable-dbus           Enable DBUS IPC],
379 [],[
380         case " $with_gui " in
381                 *\ gtk\ *)     enable_dbus=yes ;;
382                 *\ lesstif\ *) enable_dbus=yes ;;
383                 * )            enable_dbus=no ;;
384         esac
387 AC_MSG_RESULT([$enable_dbus])
388 AM_CONDITIONAL(WITH_DBUS, test x$enable_dbus = xyes)
390 if test "x$enable_dbus" = "xyes"; then
391         case " $with_gui " in
392                 *\ gtk\ *) ;;
393                 *\ lesstif\ *) ;;
394                 * ) AC_MSG_ERROR([DBUS enabled but only works with a mainloop capable GUI HID.
395 Either do not use --enable-dbus or enable the gtk or lesstif GUI HID.])
396         esac
397         
398         PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.61,
399                 [saved_LIBS="$LIBS"
400                  LIBS="$LIBS $DBUS_LIBS"
401                  AC_CHECK_FUNCS(dbus_watch_get_unix_fd)
402                  LIBS="$saved_LIBS" ],
403                 [AC_MSG_ERROR([Cannot find dbus-1 >= 0.61, install it and rerun ./configure
404 Please review the following errors:
405 $DBUS_PKG_ERRORS])]
406         )
407         DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
408         
409         AC_DEFINE([HAVE_DBUS], 1,
410                 [Define to 1 if DBUS IPC is to be compiled in])
415 AC_MSG_CHECKING([for whether to use GL drawing])
416 AC_ARG_ENABLE([gl],
417 [  --enable-gl           Enable GL drawing (with GTK HID)],
418 [],[
419         case " $with_gui " in
420                 *\ gtk\ *) enable_gl=yes;;
421                 * ) enable_gl=no;;
422         esac
424 AC_MSG_RESULT([$enable_gl])
425 AM_CONDITIONAL(USE_GL, test x$enable_gl = xyes)
427 if test "x$enable_gl" = "xyes"; then
428         case " $with_gui " in
429                 *\ gtk\ *) ;;
430                 * ) AC_MSG_ERROR([GL drawing enabled but only works with the GTK HID.
431 Either do not use --enable-gl or enable the gtk HID.])
432         ;;
433         esac
435         AX_CHECK_GL
436         AS_IF([test X$no_gl = Xyes],
437               [AC_MSG_FAILURE([OpenGL is required.])])
439         AX_CHECK_GLU
440         AS_IF([test X$no_glu = Xyes],
441               [AC_MSG_FAILURE([The OpenGL GLU library is required.])])
443         AC_DEFINE([ENABLE_GL], 1,
444                 [Define to 1 if GL support is to be compiled in])
447 AC_MSG_CHECKING([for which printer to use])
448 AC_ARG_WITH([printer],
449 [  --with-printer=        Specify the printer: lpr [[default=lpr]]],
450 [],[with_printer=lpr])
451 AC_MSG_RESULT([$with_printer])
452 case " $hid_printers " in
453      *\ $with_printer\ * )
454          HIDLIST="$HIDLIST $with_printer"
455          ;;
456      * ) AC_MSG_ERROR([$with_printer is not a valid printer]) ;;
457 esac
459 AC_MSG_CHECKING([for which exporters to use])
460 AC_ARG_WITH([exporters],
461 [  --with-exporters=       Enable export devices: bom bom_md gerber gcode nelma png ps ipcd356 gsvit [[default=bom bom_md gerber gcode nelma png ps ipcd356 gsvit]]],
462 [],[with_exporters=$hid_exporters])
463 AC_MSG_RESULT([$with_exporters])
464 for e in `echo $with_exporters | sed 's/,/ /g'`; do
465     case " $hid_exporters " in
466       *\ $e\ * )
467          HIDLIST="$HIDLIST $e"
468          ;;
469       * ) AC_MSG_ERROR([$e is not a valid exporter]) ;;
470     esac
471 done
473 if test "X$enable_jpeg" = "Xno" -a "X$enable_gif" = "Xno" -a "X$enable_png" = "Xno" ; then
474         case " ${HIDLIST} " in
475                 *\ png\ *)
476                         AC_MSG_ERROR([you have requested the png HID but turned off all output
477 formats!  If you do not want gif/jpeg/png output, use --with-exporters to list
478 which exporters you want and do not list png there.])
479                         ;;
481                 *)
482                         ;;
483         esac
486 for hid in $HIDLIST; do
487     F=$srcdir/src/hid/$hid/hid.conf
488     if test -f $F ; then
489         echo checking $hid dependencies
490         deps=
491         . $F
492         for dep in $deps; do
493             if test "X`echo $HIDLIST | grep $dep`" = "X"; then
494                 AC_MSG_ERROR([you have requested the $hid HID but not the $dep HID, which it depends on])
495             fi
496         done
497    fi
498 done
500 for e in $HIDLIST; do
501     HIDLIBS="$HIDLIBS lib$e.a"
502 done
504 AC_SUBST(HIDLIST)
505 AC_SUBST(HIDLIBS)
507 # ------------- end HID config -------------------
509 ######################################################################
511 # desktop integration
514 AC_PATH_PROG(SETENV, env, [])
515 AC_PATH_PROG(GTK_UPDATE_ICON_CACHE_BIN, gtk-update-icon-path, [true])
517 # Change default location for XDG files (MIME and Icons)
518 AC_ARG_WITH(xdgdatadir, [  --with-xdgdatadir=path  Change where the theme icons 
519 and mime registrations are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
521 # Change default location for KDE data files (KDE MIME registrations)
522 AC_ARG_WITH(kdedatadir, [  --with-kdedatadir=path  Change where the KDE mime reg
523 istrations are installed [[DATADIR]]], [opt_kdedatadir=$withval])
525 if test x$opt_xdgdatadir = x; then
526         # path was not specified with --with-xdgdatadir
527         XDGDATADIR='${datadir}'
528 else
529         # path WAS specified with --with-xdgdatadir
530         XDGDATADIR="$opt_xdgdatadir"
532 AC_SUBST(XDGDATADIR)
534 if test x$opt_kdedatadir = x; then
535         # path was not specified with --with-kdedatadir
536         KDEDATADIR='${datadir}'
537 else
538         # path WAS specified with --with-kdedatadir
539         KDEDATADIR="$opt_kdedatadir"
541 AC_SUBST(KDEDATADIR)
543 AC_ARG_ENABLE(update-desktop-database,
544         AC_HELP_STRING([--disable-update-desktop-database],
545         [do not update desktop database after installation]),,
546         enable_update_desktop_database=yes)
548 AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE, test x$enable_update_desktop_database = xyes)
550 if test x$enable_update_desktop_database = xyes ; then
551         AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
552         if test $UPDATE_DESKTOP_DATABASE = no; then
553         AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
554         fi
557 AC_ARG_ENABLE(update-mime-database,
558         AC_HELP_STRING([--disable-update-mime-database],
559         [do not update mime database after installation]),,
560         enable_update_mime_database=yes)
562 AM_CONDITIONAL(ENABLE_UPDATE_MIME_DATABASE, test x$enable_update_mime_database = xyes)
564 if test x$enable_update_mime_database = xyes ; then
565         AC_PATH_PROG(UPDATE_MIME_DATABASE, [update-mime-database], no)
566         if test $UPDATE_MIME_DATABASE = no; then
567         AC_MSG_ERROR([Cannot find update-mime-database, make sure it is installed and in your PATH, or configure with --disable-update-mime-database])
568         fi
572 ######################################################################
574 # ------------- Non-standard gaf install location -----------------
575 AC_MSG_CHECKING([where to install gaf scheme additions])
576 GAFDATADIR="${datadir}"
577 AC_ARG_WITH([gaf-datadir],
578   AS_HELP_STRING([--with-gaf-datadir=DIR],
579     [install additional gaf scheme into DIR [[DATADIR]]]),
580   [ if (test "X$with_gaf_datadir" != "Xno" &&
581           test "X$with_gaf_datadir" != "Xyes"); then
582         GAFDATADIR="$with_gaf_datadir"
583       fi ], [])
584 AC_MSG_RESULT([$GAFDATADIR])
585 AC_SUBST([GAFDATADIR])
588 AC_PATH_PROGS(M4, gm4 m4, [none])
589 if test "X$M4" = "Xnone" ; then
590         AC_MSG_ERROR([Did not find a m4 executible.  You need to make sure
591         that m4 is installed on your system and that m4 is in your path])
593 AC_MSG_CHECKING([if $M4 has the division involving negative numbers bug])
594 pcb_m4_r=`echo "eval(-2/2)" | $M4`
595 if test "$pcb_m4_r" != "-1" ; then
596         AC_MSG_RESULT([yes])
597         AC_MSG_ERROR([It appears that $M4 has a bug involving division
598 with negative numbers.  In particular it just returned the result that
599 -2/2 = $pcb_m4_r instead of -1.  This is a known bug in GNU m4-1.4.9.  Please
600 install a non-broken m4.])
601 else
602         AC_MSG_RESULT([no])
606 AC_PATH_PROGS(WISH, wish wish85 wish8.5 wish83 wish8.3 wish80 wish8.0 cygwish83 cygwish80,[none])
607 if test "X$WISH" = "Xnone" ; then
608         AC_MSG_ERROR([Did not find the wish executible.  You need to make sure
609         that tcl is installed on your system and that wish is in your path])
612 AC_DEFINE_UNQUOTED(M4,$M4,[m4 executible])
613 GNUM4=$M4
614 AC_SUBST(GNUM4)
615 AC_DEFINE_UNQUOTED(GNUM4,"$M4",[m4 program used by pcb])
617 AC_PATH_PROG(PDFLATEX, pdflatex, notfound)
618 AM_CONDITIONAL(MISSING_PDFLATEX, test x$PDFLATEX = xnotfound)
620 AC_PATH_PROG(TEXI2DVI, texi2dvi, notfound)
621 AM_CONDITIONAL(MISSING_TEXI2DVI, test x$TEXI2DVI = xnotfound)
623 AC_PATH_PROG(PS2PDF, ps2pdf, notfound)
624 AM_CONDITIONAL(MISSING_PS2PDF, test x$PS2PDF = xnotfound)
626 # used to build some of the getting started guide
627 AC_PATH_PROG(GSCHEM, gschem, notfound)
628 AM_CONDITIONAL(MISSING_GSCHEM, test x$GSCHEM = xnotfound)
630 if test "X$docs_yesno" = "Xyes" -a "X$pcb_git_version" = "Xyes" ; then
631         if test "$PDFLATEX" = "notfound" -o "$TEXI2DVI" = "notfound" -o "$PS2PDF" = "notfound" ; then
632                 AC_MSG_ERROR([It appears that you are building from a source tree obtained
633 via git but you do not have the required tools installed to build the documentation.  Here
634 is a list of tools and the detected values:
635 PDFLATEX:  $PDFLATEX
636 TEXI2DVI:  $TEXI2DVI
637 PS2PDF:    $PS2PDF
638 GSCHEM:    $GSCHEM
640 Either make sure these tools are installed or disable building and installing the documentation
641 by using the --disable-doc configure option.
643         fi
646 ############################################################################
648 # These checks are for tools used by the testsuite.  It will not be fatal
649 # if these are missing because this is primarily for developer use.  It is
650 # possible that we might add some --enable flag in the future that forces
651 # full tools for development work.
653 # Check for ImageMagick tools used by the testsuite
654 AC_PATH_PROG(IM_ANIMATE, animate, notfound)
655 AC_PATH_PROG(IM_COMPARE, compare, notfound)
656 AC_PATH_PROG(IM_COMPOSITE, composite, notfound)
657 AC_PATH_PROG(IM_CONVERT, convert, notfound)
658 AC_PATH_PROG(IM_DISPLAY, display, notfound)
659 AC_PATH_PROG(IM_MONTAGE, montage, notfound)
660 AC_PATH_PROG(XHOST, xhost, notfound)
661 missing_magick=""
662 test "${IM_ANIMATE}" != "notfound" || missing_magick="${missing_magick} animate"
663 test "${IM_COMPARE}" != "notfound" || missing_magick="${missing_magick} compare"
664 test "${IM_COMPOSITE}" != "notfound" || missing_magick="${missing_magick} composite"
665 test "${IM_CONVERT}" != "notfound" || missing_magick="${missing_magick} convert"
666 test "${IM_DISPLAY}" != "notfound" || missing_magick="${missing_magick} display"
667 test "${IM_MONTAGE}" != "notfound" || missing_magick="${missing_magick} montage"
669 AC_MSG_CHECKING([if all ImageMagick tools needed for the testsuite were found])
670 if test "X${missing_magick}" != "X" ; then
671     AC_MSG_RESULT([no.  The testsuite will be disabled because the following
672 tools from the ImageMagick suite were not found:
673 ${missing_magick}
674 No loss in pcb functionality should be experienced, you just will not
675 be able to run the full regression testsuite.
677     have_magick=no
678 else
679     AC_MSG_RESULT([yes])
680     have_magick=yes
683 have_test_tools=yes
685 test $have_magick = yes || have_test_tools=no
687 # the RS274-X export HID is partially checked by looking at the result with
688 # gerbv
689 AC_PATH_PROG(GERBV, gerbv, notfound)
690 test $GERBV != notfound || have_test_tools=no
693 AM_CONDITIONAL(HAVE_TEST_TOOLS, test x$have_test_tools = xyes)
694 AC_MSG_CHECKING([if all the required testsuite tools were found])
695 if test x$have_test_tools = xyes ; then
696         AC_MSG_RESULT([yes])
697 else
698         AC_MSG_RESULT([no -- the testsuite will be disabled])
703 ############################################################################
706 dnl Checks for libraries.
707 AC_CHECK_LIB(m, sqrt)
708 AC_CHECK_LIB(dl, dlopen)
709 AC_CHECK_LIB(xnet, gethostbyname)
710 AC_CHECK_LIB(fl, yywrap)
712 dnl Checks for functions
713 AC_CHECK_FUNCS(getline)
714 AC_CHECK_FUNCS(strcasestr)
715 AC_CHECK_FUNCS(strerror)
716 AC_CHECK_FUNCS(regcomp re_comp)
717 AC_CHECK_FUNCS(logf expf rint)
718 AC_CHECK_FUNCS(vsnprintf)
719 AC_CHECK_FUNCS(getpwuid getcwd)
720 AC_CHECK_FUNCS(rand random)
721 AC_CHECK_FUNCS(stat)
723 AC_CHECK_FUNCS(mkdtemp)
725 # normally used for all file i/o
726 AC_CHECK_FUNCS(popen)
728 # for lrealpath.c
729 AC_CHECK_FUNCS(realpath canonicalize_file_name)
730 libiberty_NEED_DECLARATION(canonicalize_file_name)
732 # for pcb_spawnvp in action.c on Windows
733 AC_CHECK_FUNCS(_spawnvp)
735 AC_HEADER_STDC
736 AC_CHECK_HEADERS(limits.h locale.h string.h sys/types.h regex.h pwd.h)
737 AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h sys/param.h sys/times.h sys/wait.h)
738 AC_CHECK_HEADERS(dlfcn.h)
740 if test "x${WIN32}" = "xyes" ; then
741         AC_CHECK_HEADERS(windows.h)
743 # Search for glib
744 PKG_CHECK_MODULES(GLIB, glib-2.0, ,
745                 [AC_MSG_RESULT([Note: cannot find glib-2.0.
746 You may want to review the following errors:
747 $GLIB_PKG_ERRORS])]
750 need_gdlib=no
751 with_gif=no
752 with_png=no
753 with_jpeg=no
755 for e in $HIDLIST; do
756     case $e in
757       lesstif )
758         AC_PATH_XTRA
759         save_CPPFLAGS="$CPPFLAGS"
760         CPPFLAGS="$X_CFLAGS"
761         AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS)
762         AC_CHECK_LIB(ICE, main, , , $X_LIBS)
763         AC_CHECK_LIB(SM, main, , , $X_LIBS)
764         AC_CHECK_LIB(Xext, main, , , $X_LIBS)
765         AC_CHECK_LIB(Xt, XtOpenDisplay, , , $X_LIBS)
766         AC_CHECK_LIB(Xmu, main, , , $X_LIBS)
767         AC_CHECK_LIB(Xpm, main, , , $X_LIBS)
768         AC_CHECK_LIB(Xm, XmCreateMainWindow, , , $X_LIBS)
769         CPPFLAGS="$save_CPPFLAGS"
770         case $ac_cv_lib_Xm_XmCreateMainWindow in
771           no )
772             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
773             ;;
774           * ) ;;
775         esac
776         AC_CHECK_HEADERS(Xm/Xm.h)
777         case $ac_cv_header_Xm_Xm_h in
778           no )
779             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
780             ;;
781           * ) ;;
782         esac
783         ;;
785       gtk )
786         # Check for pkg-config
787         PKG_PROG_PKG_CONFIG
788         if test -z "$PKG_CONFIG"; then
789                 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
790         fi
792         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0, ,
793                 [AC_MSG_ERROR([Cannot find gtk+ >= 2.18.0, install it and rerun ./configure
794 Please review the following errors:
795 $GTK_PKG_ERRORS])]
796         )
797         GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
798         GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
800         if test "x$enable_gl" = "xyes"; then
801                 # Check for GtkGLExt
802                 PKG_CHECK_MODULES(GTKGLEXT, gtkglext-1.0 >= 1.0.0, , [AC_MSG_ERROR([
803 *** Required version of gtkglext is not installed - please install first ***
804 Please review the following errors:
805 $GTKGLEXT_PKG_ERRORS])]
806                 )
807         GTKGLEXT_VER=`$PKG_CONFIG gtkglext-1.0 --modversion`
808         fi
810         ;;
812       png)
813         need_gdlib=yes
814         AC_MSG_CHECKING([if GIF output from the png HID is desired])
815         AC_ARG_ENABLE([gif],
816                 [  --disable-gif           Disable support for gif output when the png HID is used [[default=include gif support]]],
817                 [
818                 if test "X$enable_gif" != "Xno" ; then
819                         AC_MSG_RESULT([yes])
820                         with_gif=yes
821                 else
822                         AC_MSG_RESULT([no])
823                 fi
824                 ],
825                 [
826                 AC_MSG_RESULT([yes])
827                 with_gif=yes
828                 ])
830         AC_MSG_CHECKING([if JPEG output from the png HID is desired])
831         AC_ARG_ENABLE([jpeg],
832                 [  --disable-jpeg          Disable support for JPEG output when the png HID is used [[default=include JPEG support]]],
833                 [
834                 if test "X$enable_jpeg" != "Xno" ; then
835                         AC_MSG_RESULT([yes])
836                         with_jpeg=yes
837                 else
838                         AC_MSG_RESULT([no])
839                 fi
840                 ],
841                 [
842                 AC_MSG_RESULT([yes])
843                 with_jpeg=yes
844                 ])
846         AC_MSG_CHECKING([if PNG output from the png HID is desired])
847         AC_ARG_ENABLE([png],
848                 [  --disable-png           Disable support for PNG output when the png HID is used [[default=include PNG support]]],
849                 [
850                 if test "X$enable_png" != "Xno" ; then
851                         AC_MSG_RESULT([yes])
852                         with_png=yes
853                 else
854                         AC_MSG_RESULT([no])
855                 fi
856                 ],
857                 [
858                 AC_MSG_RESULT([yes])
859                 with_png=yes
860                 ])
861         ;;
863       gcode|nelma)
864         need_gdlib=yes
865         with_png=yes
866         ;;
868     esac
869 done
871 if test "$need_gdlib" = "yes"; then
872         # Search for glib
873         PKG_CHECK_MODULES(GDLIB, gdlib,[found_gdlib=yes] , [found_gdlib=no])
875         if test "X$found_gdlib" = "Xno"; then
876                 # older installs came with gdlib-config and not the .pc file
877                 # to work with pkg-config
878                 AC_PATH_PROG([GDLIB_CONFIG], [gdlib-config], [notfound])
879                 if test "$GDLIB_CONFIG" = "notfound" ; then
880                         AC_MSG_ERROR([cannot find gdlib-config.  gdlib
881 is required for gcode, nelma, png HIDs 
882 You may want to review the following errors
883 from $PKG_CONFIG:
884 $GDLIB_PKG_ERRORS])
885                 else
886                         AC_MSG_CHECKING([for gdlib cflags])
887                         GDLIB_CFLAGS=`${GDLIB_CONFIG} --cflags`
888                         AC_MSG_RESULT([$GDLIB_CFLAGS])
890                         AC_MSG_CHECKING([for gdlib libraries])
891                         GDLIB_LIBS=`${GDLIB_CONFIG} --libs`
892                         AC_MSG_RESULT([$GDLIB_LIBS])
894                         AC_MSG_CHECKING([for gdlib ldflags])
895                         GDLIB_LDFLAGS=`${GDLIB_CONFIG} --ldflags`
896                         AC_MSG_RESULT([$GDLIB_LDFLAGS])
897                 fi
898         fi
900         save_LIBS="$LIBS"
901         LIBS="$LIBS $GDLIB_LDFLAGS $GDLIB_LIBS"
903         # some older installs, Ubuntu Precise for example, leave off the "-lgd" part.
904         # try to see if it needs to be added.  However this is currently broken
905         # under cygwin cross building for mingw because of interactions with
906         # __imp__ prefix added in the libgd.a static library.  Look at the declspec
907         # stuff in the mingw gd.h file.
908 if test "x$WIN32" = "xno" ; then
909         before_LIBS="$LIBS"
910         AC_SEARCH_LIBS([gdImageCreate],[gd],[],[
911                         AC_MSG_ERROR([Unable to figure out how to link gd applications.
912 It is likely that your system has a broken gdlib-config or gdlib.pc file used by
913 pkg-config.
914 ])],[])
915         if test "$LIBS" != "${before_LIBS}" ; then
916                 GDLIB_LIBS="${GDLIB_LIBS} -lgd"
917         fi
920         if test "X$with_gif" = "Xyes" ; then
921                 AC_CHECK_FUNCS(gdImageGif)
922                 if test "$ac_cv_func_gdImageGif" != "yes"; then
923                         AC_MSG_ERROR([Your gd installation does not appear to include gif support.
924 You may need to update your installation of gd or disable
925 gif export with --disable-gif])
926                 fi
927         fi
929         if test "X$with_jpeg" = "Xyes" ; then
930                 AC_CHECK_FUNCS(gdImageJpeg)
931                 if test "$ac_cv_func_gdImageJpeg" != "yes"; then
932                         AC_MSG_ERROR([Your gd installation does not appear to include JPEG support.
933 You may need to update your installation of gd or disable
934 JPEG export with --disable-jpeg])
935                 fi
936         fi
938         if test "X$with_png" = "Xyes" ; then
939                 AC_CHECK_FUNCS(gdImagePng)
940                 if test "$ac_cv_func_gdImagePng" != "yes"; then
941                         AC_MSG_ERROR([Your gd installation does not appear to include PNG support.
942 You may need to update your installation of gd or disable
943 PNG export with --disable-png])
944                 fi
945         fi
946         LIBS="$save_LIBS"
949 AM_CONDITIONAL(PNG, test x$with_png = xyes)
950 AM_CONDITIONAL(GIF, test x$with_gif = xyes)
952 # ------------- check if png previews should be built for pcblib-newlib
953 AC_MSG_CHECKING([if the m4lib to newlib export should create png previews])
954 AC_ARG_ENABLE(
955         [m4lib-png],
956         [  --enable-m4lib-png      Enable creating png previews for the m4 library],
957         [],[enable_m4lib_png=no])
958 AC_MSG_RESULT([$enable_m4lib_png])
959 AM_CONDITIONAL(PNG_PREVIEW, test x$enable_m4lib_png = xyes)
962 # Run away.... more ugly stuff here.  By default we don't actually build
963 # pcblib-newlib from pcblib unless we are building from cvs or git sources.
964 # The reason is it takes a while and requires the png HID.  The problem is,
965 # what if someone wants to use --enable-m4lib-png but the tarball was built
966 # without the previews.  Or, what if someone does not want the PNG previews
967 # but the person building the tarball included them.  Ugh!  So what the following
968 # code attempts to do is detect that mismatch situation.  Note that we only
969 # want to kick this code in when *not* building from git or cvs sources.
970 build_pcblib_newlib=no
971 if test "$pcb_sources" = "tarball" ; then
972         AC_MSG_CHECKING([If pcblib-newlib was built with png previews])
973         stamp=$srcdir/lib/pcblib-newlib.stamp
974         if test ! -f ${stamp} ; then
975                 AC_MSG_RESULT([unknown, missing ${stamp}])
976                 build_pcblib_newlib=yes
977         else
978                 if test "`cat ${stamp}`" = "png-preview=yes" ; then
979                         AC_MSG_RESULT([yes])
980                         # lib exists and built with preview.
981                         # if we don't want the preview, than rebuild
982                         if test x$enable_m4lib_png != xyes ; then
983                                 build_pcblib_newlib=yes
984                         fi
985                 else
986                         AC_MSG_RESULT([no])
987                         # lib exists and built without preview.
988                         # if we want the preview, than rebuild
989                         if test x$enable_m4lib_png = xyes ; then
990                                 build_pcblib_newlib=yes
991                         fi
992                 fi
993         fi
994 else
995         build_pcblib_newlib=yes
997 AC_MSG_CHECKING([If pcblib-newlib needs to be rebuilt])
998 AC_MSG_RESULT([$build_pcblib_newlib])
999 AM_CONDITIONAL(BUILD_PCBLIB_NEWLIB, test x$build_pcblib_newlib = xyes)
1001 if test "X$cross_compiling" = "Xyes" ; then
1002         # we are cross compiling so we will need a build host binary for pcb
1003         AC_PATH_PROG(PCB, [pcb], [notfound])
1004 else
1005         PCB="\${top_builddir}/src/pcb"
1007 AC_SUBST(PCB)
1009 # now make see how essential it was that we have a pcb executable for the build
1010 # host
1011 if test "X$pcb_git_version" = "Xyes" ; then
1012         if test "X$docs_yesno" = "Xyes" -o "X$enable_m4lib_png" = "Xyes" ; then
1013                 if test "$PCB" = "notfound" ; then
1014                         AC_MSG_ERROR([You have selected a build with m4lib png
1015 previews enabled and/or with building the documentation enabled but you also
1016 appear to be cross-compiling.  For this to work, you must have a pcb installed that
1017 can run on this machine (the build machine) because it is needed for generating
1018 library footprint png previews as well as some of the figures in the documentation.
1019 If you wish to skip building the documentation and the footprint previews then add
1020 --disable-doc --disable-m4lib-png
1021 This will allow your cross build to work.])
1022                 fi
1023         fi
1026 # ------------- Xrender -------------------
1027 have_xrender=no
1028 AC_CHECK_LIB(Xrender,XRenderQueryExtension,have_xrender=yes,have_xrender=no,$X_LIBS)
1030 AC_ARG_ENABLE([xrender],
1031 [  --disable-xrender       Compile and link with Xrender [default=yes]])
1032 case "$have_xrender:$enable_xrender" in
1033    no:* ) ;;
1034    *:no ) ;;
1035    * )
1036      X_LIBS="-lXrender $X_LIBS"
1037      AC_DEFINE([HAVE_XRENDER], 1,
1038                 [Define to 1 if Xrender is available])
1039      ;;
1040 esac
1042 # ------------- Xinerama -------------------
1043 have_xinerama=no
1044 AC_CHECK_LIB(Xinerama,XineramaQueryExtension,have_xinerama=yes,have_xinerama=no,$X_LIBS)
1046 AC_ARG_ENABLE([xinerama],
1047 [  --disable-xinerama       Compile and link with Xinerama [default=yes]])
1048 case "$have_xinerama:$enable_xinerama" in
1049    no:* ) ;;
1050    *:no ) ;;
1051    * )
1052      X_LIBS="-lXinerama $X_LIBS"
1053      AC_DEFINE([HAVE_XINERAMA], 1,
1054                 [Define to 1 if Xinerama is available])
1055      ;;
1056 esac
1058 # ------------- dmalloc -------------------
1059 dnl dmalloc checks
1060 with_dmalloc=no
1061 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
1062 AC_ARG_ENABLE([dmalloc],
1063 [  --enable-dmalloc        Compile and link with dmalloc for malloc debugging [default=no]],
1065 if test "X$enable_dmalloc" != "Xno" ; then
1066         AC_MSG_RESULT([yes])
1067         AC_CHECK_HEADER(dmalloc.h,,
1068                 AC_MSG_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
1069         AC_CHECK_LIB(dmalloc,main,,
1070                 AC_MSG_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
1071         DMALLOC_LIBS="-ldmalloc"
1072         with_dmalloc=yes
1073 else
1074         AC_MSG_RESULT([no])
1075         DMALLOC_LIBS=""
1079         AC_MSG_RESULT([no])
1080         DMALLOC_LIBS=""
1083 # ------------- ElectricFence -------------------
1084 dnl ElectricFence checks
1085 with_efence=no
1086 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
1087 AC_ARG_ENABLE([efence],
1088 [  --enable-efence         Link with ElectricFence for malloc debugging [default=no]],
1090 if test "X$enable_efence" != "Xno" ; then
1091         AC_MSG_RESULT([yes])
1092         AC_CHECK_LIB(efence,main,,
1093                 AC_MSG_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
1094         with_efence=yes
1095 else
1096         AC_MSG_RESULT([no])
1100 AC_MSG_RESULT([no])
1103 # ------------- Enable Debug code -------------------
1104 AC_MSG_CHECKING([for whether to enable debugging code])
1105 AC_ARG_ENABLE([debug],
1106 [  --enable-debug          Enable debugging code],
1107 [],[enable_debug=no])
1109 AC_MSG_RESULT([$enable_debug])
1110 AM_CONDITIONAL(DEBUG_BUILD, test x$enable_debug = xyes)
1112 # ------------- mkdir required for win32 compatibility ------------
1113 # WIN32 mkdir takes only one argument, POSIX takes two.
1114 # #include "misc.h" where mkdir is required.
1115 m4_include([m4/m4_ax_func_mkdir.m4])
1116 AX_FUNC_MKDIR
1118 # ------------- Type used for "Coord" type -------------------
1120 AC_CHECK_HEADERS(stdint.h)
1121 AC_ARG_ENABLE([coord64],
1122 [  --enable-coord64        Force 64-bit coordinate types],
1123 [],[enable_coord64=no])
1124 AC_ARG_ENABLE([coord32],
1125 [  --enable-coord32        Force 32-bit coordinate types],
1126 [],[enable_coord32=no])
1128 COORDTYPE="long"
1130 echo "$enable_coord32:$enable_coord64:$ac_cv_header_stdint_h"
1131 case "$enable_coord32:$enable_coord64:$ac_cv_header_stdint_h" in
1132   yes:no:yes )
1133     COORD_TYPE="int32_t"
1134     COORD_MAX="INT32_MAX"
1135     ;;
1136   no:yes:yes )
1137     COORD_TYPE="int64_t"
1138     COORD_MAX="INT64_MAX"
1139     ;;
1140   yes:no:no  )
1141     COORD_TYPE="int"
1142     COORD_MAX="INT_MAX"
1143     ;;
1144   no:yes:no  )
1145     COORD_TYPE="long long"
1146     COORD_MAX="LLONG_MAX"
1147     ;;
1148   yes:yes:*  )
1149     AC_MSG_ERROR("*** cannot require both 32 and 64 bit coordinates")
1150     ;;
1151   *:*:*    )
1152     COORD_TYPE="long"
1153     COORD_MAX="LONG_MAX"
1154     ;;
1155 esac
1156 AC_DEFINE_UNQUOTED([COORD_TYPE],[$COORD_TYPE],
1157   [C type for Coordinates])
1158 AC_DEFINE_UNQUOTED([COORD_MAX],[$COORD_MAX],
1159   [Maximum value of coordinate type])
1161 # ------------- Complete set of CPPFLAGS and LIBS -------------------
1163 CPPFLAGS="$CPPFLAGS $X_CFLAGS $DBUS_CFLAGS $GDLIB_CFLAGS $GLIB_CFLAGS $GTK_CFLAGS $GD_CFLAGS $CAIRO_CFLAGS $GTKGLEXT_CFLAGS $GLU_CFLAGS $GL_CFLAGS"
1164 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"
1167 # if we have gcc then add -Wall
1168 if test "x$GCC" = "xyes"; then
1169         # see about adding some extra checks if the compiler takes them
1170         for flag in -Wall ; do
1171                 case " ${CFLAGS} " in
1172                         *\ ${flag}\ *)
1173                                 # flag is already present
1174                                 ;;
1175                         *)
1176                                 AC_MSG_CHECKING([if the compiler accepts ${flag}])
1177                                 ac_save_CFLAGS="$CFLAGS"
1178                                 CFLAGS="$CFLAGS ${flag}"
1179                                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1180                                         [AC_MSG_RESULT([yes])],
1181                                         [AC_MSG_RESULT([no])
1182                                          CFLAGS="$ac_save_CFLAGS"
1183                                         ]
1184                                 )
1185                                 ;;
1186                 esac
1187         done
1190 CXXFLAGS="$CFLAGS"
1192 # Now add C-specific flags
1193 if test "x$GCC" = "xyes"; then
1194         # see about adding some extra checks if the compiler takes them
1195         for flag in -Wdeclaration-after-statement ; do
1196                 case " ${CFLAGS} " in
1197                         *\ ${flag}\ *)
1198                                 # flag is already present
1199                                 ;;
1200                         *)
1201                                 AC_MSG_CHECKING([if the compiler accepts ${flag}])
1202                                 ac_save_CFLAGS="$CFLAGS"
1203                                 CFLAGS="$CFLAGS ${flag}"
1204                                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1205                                         [AC_MSG_RESULT([yes])],
1206                                         [AC_MSG_RESULT([no])
1207                                          CFLAGS="$ac_save_CFLAGS"
1208                                         ]
1209                                 )
1210                                 ;;
1211                 esac
1212         done
1215 # See if we are building gcc with C++.
1216 AC_ARG_ENABLE(build-with-cxx,
1217 [  --enable-build-with-cxx build with C++ compiler instead of C compiler],
1218 ENABLE_BUILD_WITH_CXX=$enableval,
1219 ENABLE_BUILD_WITH_CXX=no)
1221 case "$ENABLE_BUILD_WITH_CXX" in
1222   yes)
1223     CC_OR_CXX="$CXX"
1224     ;;
1225   no)
1226     CC_OR_CXX="$CC"
1227     ;;
1228 esac
1229 AC_SUBST(CC_OR_CXX)
1231 # font filename
1232 FONTFILENAME=${FONTFILENAME:-"default_font"}
1233 AC_SUBST(FONTFILENAME)
1234 AC_DEFINE_UNQUOTED(FONTFILENAME,"$FONTFILENAME",[File for default font])
1236 # standard autoconf variables
1237 CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\""
1238 CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\""
1239 CPPFLAGS="$CPPFLAGS -DHOST=\\\"\${host}\\\""
1241 # directory for old-style library and for fonts
1242 PCBLIBDIR=${datadir}/pcb
1243 AC_SUBST(PCBLIBDIR)
1244 #AC_DEFINE_UNQUOTED(PCBLIBDIR,"$PCBLIBDIR",[Library directory])
1245 CPPFLAGS="$CPPFLAGS -DPCBLIBDIR=\\\"$PCBLIBDIR\\\""
1247 # name for old-style library
1248 LIBRARYFILENAME=pcblib
1249 AC_SUBST(LIBRARYFILENAME)
1250 AC_DEFINE_UNQUOTED(LIBRARYFILENAME,"$LIBRARYFILENAME",[library file name])
1253 # directory for new library
1254 PCBTREEDIR=${datadir}/pcb/newlib
1255 PCBTREEPATH=${PCBTREEDIR}:${PCBLIBDIR}/pcblib-newlib
1256 PCBTREEDIR=${PCBTREEDIR:-"$PCBTREEDIR"}
1257 AC_SUBST(PCBTREEDIR)
1258 AC_SUBST(PCBTREEPATH)
1259 #AC_DEFINE_UNQUOTED(PCBTREEDIR,"$PCBLIB",[top directory for new style pcb library])
1260 CPPFLAGS="$CPPFLAGS -DPCBTREEDIR=\\\"$PCBTREEDIR\\\""
1261 CPPFLAGS="$CPPFLAGS -DPCBTREEPATH=\\\"$PCBTREEPATH\\\""
1263 # Figure out relative paths
1264 AC_MSG_CHECKING([for the bindir to pcblibdir relative path])
1265 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBLIBDIR:bindir_to_pcblibdir])
1266 adl_NORMALIZE_PATH([bindir_to_pcblibdir], [$PCB_DIR_SEPARATOR_S])
1267 AC_MSG_RESULT([$bindir_to_pcblibdir])
1268 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBLIBDIR, "$bindir_to_pcblibdir", [Relative path from bindir to pcblibdir])
1270 AC_MSG_CHECKING([for the bindir to pcbtreedir relative path])
1271 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBTREEDIR:bindir_to_pcbtreedir])
1272 adl_NORMALIZE_PATH([bindir_to_pcbtreedir], [$PCB_DIR_SEPARATOR_S])
1273 AC_MSG_RESULT([$bindir_to_pcbtreedir])
1274 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBTREEDIR, "$bindir_to_pcbtreedir", [Relative path from bindir to pcbtreedir])
1277 AC_MSG_CHECKING([for the bindir to exec_prefix relative path])
1278 adl_COMPUTE_RELATIVE_PATHS([bindir:exec_prefix:bindir_to_execprefix])
1279 adl_NORMALIZE_PATH([bindir_to_execprefix], [$PCB_DIR_SEPARATOR_S])
1280 AC_MSG_RESULT([$bindir_to_execprefix])
1281 AC_DEFINE_UNQUOTED(BINDIR_TO_EXECPREFIX, "$bindir_to_execprefix", [Relative path from bindir to exec_prefix])
1284 BTNMOD=${BTNMOD:-"Mod1"}
1285 AC_SUBST(BTNMOD)
1287 TOPDIRS=
1288 for dir in src lib newlib doc example tools tutorial README_FILES
1290    test -d $dir/. && TOPDIRS="$TOPDIRS $dir"
1291 done
1292 AC_SUBST(TOPDIRS)
1294 AC_CONFIG_FILES(Makefile data/Makefile intl/Makefile po/Makefile.in)
1296 if test -d $srcdir/README_FILES; then
1297    AC_CONFIG_FILES(README_FILES/Makefile)
1299 if test -d $srcdir/doc; then
1300    AC_CONFIG_FILES(doc/Makefile)
1302 if test -d $srcdir/doc/gs; then
1303    AC_CONFIG_FILES(doc/gs/Makefile)
1304    AC_CONFIG_FILES(doc/gs/gafrc)
1305    AC_CONFIG_FILES(doc/gs/gschemrc)
1307 if test -d $srcdir/example; then
1308    AC_CONFIG_FILES(example/Makefile)
1309    AC_CONFIG_FILES(example/libraries/Makefile)
1311 if test -d $srcdir/lib; then
1312    AC_CONFIG_FILES(lib/CreateLibraryContents.sh)
1313    AC_CONFIG_FILES(lib/CreateLibrary.sh)
1314    AC_CONFIG_FILES(lib/ListLibraryContents.sh)
1315    AC_CONFIG_FILES(lib/Makefile)
1316    AC_CONFIG_FILES(lib/QueryLibrary.sh)
1317    AC_CONFIG_FILES(lib/qfp-ui)
1319 if test -d $srcdir/newlib; then
1320    AC_CONFIG_FILES(newlib/2_pin_thru-hole_packages/Makefile)
1321    AC_CONFIG_FILES(newlib/Makefile)
1322    AC_CONFIG_FILES(newlib/connectors/Makefile)
1323    AC_CONFIG_FILES(newlib/crystal/Makefile)
1324    AC_CONFIG_FILES(newlib/electro-optics/Makefile)
1325    AC_CONFIG_FILES(newlib/headers/Makefile)
1326    AC_CONFIG_FILES(newlib/keystone/Makefile)
1327    AC_CONFIG_FILES(newlib/msp430/Makefile)
1328    AC_CONFIG_FILES(newlib/not_vetted_ingo/Makefile)
1329    AC_CONFIG_FILES(newlib/sockets/Makefile)
1330    AC_CONFIG_FILES(newlib/tests/Makefile)
1332 AC_CONFIG_FILES(src/Makefile)
1333 AC_CONFIG_FILES(src/icons/Makefile)
1334 if test -d $srcdir/tools; then
1335    AC_CONFIG_FILES(tools/Makefile)
1337 if test -d $srcdir/tutorial; then
1338    AC_CONFIG_FILES(tutorial/Makefile)
1341 dnl testsuite
1342 AC_CONFIG_FILES(tests/Makefile)
1344 dnl GTS 0.7.6 - http://gts.sourceforge.net/
1345 AC_CONFIG_FILES(gts/Makefile)
1347 dnl win32 build scripts
1348 AC_CONFIG_FILES(w32/Makefile)
1350 dnl for building under cygwin
1351 AC_CONFIG_FILES(win32/Makefile)
1353 AC_OUTPUT
1355 with_gui=`echo $with_gui`
1356 with_printer=`echo $with_printer`
1357 with_exporters=`echo $with_exporters | sed 's/,/ /g'`
1359 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
1360 expandedKDEDATADIR=`eval "echo $KDEDATADIR"`
1361 expandedGAFDATADIR=`eval "echo $GAFDATADIR"`
1363 AC_MSG_RESULT([
1364 ** Configuration summary for $PACKAGE $VERSION:
1366    Cross Compiling:          $cross_compiling
1367    CC:                       $CC
1368    CXX:                      $CXX
1369    CPPFLAGS:                 $CPPFLAGS
1370    CFLAGS:                   $CFLAGS
1371    CXXFLAGS:                 $CXXFLAGS
1372    LIBS:                     $LIBS
1373    PCB:                      $PCB
1375    GUI:                      $with_gui
1376    Printer:                  $with_printer
1377    Exporters:                $with_exporters
1378    Coordinate type:          $COORD_TYPE
1379    Source tree distribution: $pcb_sources
1380    Build documentation:      $docs_yesno
1381    Build toporouter:         $enable_toporouter
1382    Enable toporouter output: $enable_toporouter_output
1383    xdg data directory:       $expandedXDGDATADIR
1384    KDE data directory:       $expandedKDEDATADIR
1385    gaf data directory:       $expandedGAFDATADIR
1386    dmalloc debugging:        $with_dmalloc
1387    ElectricFence debugging:  $with_efence
1388    Regression tests enabled: $have_test_tools