1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([pcb], [1.99z])
4 AC_CONFIG_SRCDIR([src/draw.c])
6 AM_INIT_AUTOMAKE([1.9])
8 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.
21 AC_MSG_CHECKING([if you are building from a git checkout])
23 if test -f $srcdir/.gitignore ; then
30 AM_CONDITIONAL(GIT_VERSION, test x$pcb_git_version = xyes)
32 AC_MSG_CHECKING([if you are building from a anoncvs checkout])
34 if test -f $srcdir/CVS/Root ; then
41 AM_CONDITIONAL(CVS_VERSION, test x$pcb_cvs_version = xyes)
42 AM_CONDITIONAL(GIT_OR_CVS_VERSION, test x$pcb_git_version = xyes -o x$pcb_cvs_version = xyes)
45 ##########################################################################
47 # See if we are supposed to build the docs
51 AC_MSG_CHECKING([if the documentation should be built])
53 [ --enable-doc Build and install the documentation [[default=yes]]],
55 if test "X$enable_doc" = "Xno" ; then
73 dnl determine host type
75 AC_MSG_CHECKING(for windows)
76 PCB_PATH_DELIMETER=":"
77 PCB_DIR_SEPARATOR_S="/"
78 PCB_DIR_SEPARATOR_C='/'
82 CFLAGS="$CFLAGS ${MINGW_CFLAGS:--mms-bitfields -mwindows}"
83 CPPFLAGS="$CPPFLAGS ${MINGW_CPPFLAGS}"
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.
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.])
117 GETTEXT_PACKAGE=$PACKAGE
118 AH_TEMPLATE([GETTEXT_PACKAGE], [Name of this program's gettext domain])
119 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"])
120 AC_SUBST(GETTEXT_PACKAGE)
122 AM_GNU_GETTEXT_VERSION([0.14])
124 IT_PROG_INTLTOOL([0.35.0])
132 AC_MSG_CHECKING([that C compiler supports C99])
133 if test "X$ac_cv_prog_cc_c99" = "Xno"; then
135 AC_MSG_ERROR([A C99-compliant compiler is requred])
144 AC_PATH_PROG(LEX_PATH, $LEX, [notfound])
145 if test "$LEX_PATH" = "notfound" ; then
146 AC_MSG_ERROR([Couldn't find a usable lex program.
147 Please install flex which is available from
148 ftp://ftp.gnu.org/pub/non-gnu/flex/
154 AC_PATH_PROG(YACC_PATH, $YACC, [notfound])
155 if test "$YACC_PATH" = "notfound" ; then
156 AC_MSG_ERROR([Couldn't find a usable yacc program.
157 Please install bison which is available from
158 ftp://ftp.gnu.org/pub/gnu/bison/
166 # Used for building the icons
168 AC_PATH_PROG(XPMTOPPM, xpmtoppm, notfound)
169 AC_PATH_PROG(PPMTOWINICON, ppmtowinicon, notfound)
170 AC_PATH_PROG(CONVERT, convert, notfound)
172 ##########################################################################
175 if test "X$docs_yesno" = "Xyes" -a "X$pcb_git_version" = "Xyes" ; then
176 AC_PATH_PROG(MKINFO, makeinfo, no)
177 if test "X$MKINFO" != "Xno"; then
178 AC_MSG_CHECKING([for GNU makeinfo version >= 4.6])
179 v=`$MKINFO --version | grep "GNU texinfo"`
180 if test $? -ne 0; then
181 AC_MSG_RESULT([non-GNU])
185 if test "X$MKINFO" != "Xno"; then
186 vmajor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\1/'`
187 vminor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
188 AC_MSG_RESULT([$vmajor.$vminor])
189 if test "$vmajor" -lt 4 \
190 || (test "$vmajor" -eq 4 && test "$vminor" -lt 6); then
194 if test "X$MKINFO" = "Xno"; then
195 AC_MSG_ERROR([You have requested a build
196 of the documentation. For this to work, you must have version 4.6 or newer of
197 the GNU texinfo package. You seem to have
201 Please update to a newer version of texinfo or disable building of
202 the documentation with --disable-doc
206 AC_PATH_PROG(TEXI2DVI, texi2dvi, no)
207 if test "X$TEXI2DVI" = "Xno"; then
208 AC_MSG_ERROR([You have requested a build
209 of the documentation. For this to work, you must have the texi2dvi program
210 installed. Alternatively, you can disable building the documentation with
215 AC_PATH_PROG(PERL, perl, notfound)
216 if test "X$PERL" = "Xnotfound"; then
217 AC_MSG_ERROR([You have requested a build
218 of the documentation. For this to work, you must have perl installed.
219 Alternatively, you can disable building the documentation with
225 AC_PATH_PROG([KPSEWHICH], [kpsewhich], [no])
226 if test "X$KPSEWHICH" = "Xno"; then
227 AC_MSG_ERROR([You have requested a build
228 of the documentation. For this to work, you must have a functional install of
229 TeX and LaTeX. kpsewhich is part of TeX.
230 Alternatively, you can disable building the documentation with
234 AC_MSG_CHECKING([If your TeX installation contains epsf.tex])
235 f=`$KPSEWHICH epsf.tex`
236 if test $? -eq 0 ; then
237 AC_MSG_RESULT([yes ($f)])
240 AC_MSG_ERROR([You have requested a build
241 of the documentation. For this to work, you must have a functional install of
242 TeX and LaTeX that includes epsf.tex. On some linux distributions this is
243 part of the texlive-generic-recommended package.
244 Alternatively, you can disable building the documentation with
250 ##########################################################################
254 # FIXME: for now, only try to add -rdynamic if we're using gcc. We really
255 # need to figure out what the correct test is here. In the mean time, this
256 # should let things build with SunPRO again.
257 if test "x$GCC" = "xyes"; then
258 AC_MSG_CHECKING([If the compiler accepts -rdynamic])
259 old_LDFLAGS="$LDFLAGS"
260 LDFLAGS="$LDFLAGS -rdynamic"
261 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
262 [AC_MSG_RESULT([yes])],
263 [LDFLAGS="$old_LDFLAGS"
268 # ------------- HID config -------------------
275 for hid in `cd $srcdir/src/hid; echo *`; do
276 F=$srcdir/src/hid/$hid/hid.conf
282 gui ) hid_guis="$hid_guis $hid" ;;
283 printer ) hid_printers="$hid_printers $hid" ;;
284 export ) hid_exporters="$hid_exporters $hid" ;;
285 always ) hid_always="$hid_always $hid" ;;
290 AC_MSG_CHECKING([for which gui to use])
292 [ --with-gui= Specify the GUI to use: batch gtk lesstif [[default=gtk]]],
296 AC_MSG_RESULT([$with_gui])
297 case " $hid_guis no none " in
298 *\ $with_gui\ * ) HIDLIST="$with_gui" ;;
299 * ) AC_MSG_ERROR([$with_gui is not a valid gui]) ;;
302 if test x"$with_gui" = x"none" -o x"$with_gui" = x"no"
307 AC_MSG_CHECKING([whether to enable toporouter])
308 AC_ARG_ENABLE([toporouter],
309 [AS_HELP_STRING([--enable-toporouter], [build toporouter [default=yes]]) ]
311 AS_CASE(["x$enable_toporouter"],[xyes | xno],,
312 [enable_toporouter=yes
315 AC_MSG_RESULT([$enable_toporouter])
316 AM_CONDITIONAL([WITH_TOPOROUTER], test $enable_toporouter != no)
318 if test "x$enable_toporouter" = "xyes"; then
320 You have requested to build with the toporouter. For this to work you
321 must have the GTS library installed, typically found in packages named
322 'libgts-dev' or similar.
324 Alternatively you can disable the toporouter with --disable-toporouter."
325 # Testing for gts.h requires glib.h, which is tested for later. To not take
326 # apart toporouter related stuff and because testing for the library makes
327 # reasonably sure that GTS is available, we omit a test for gts.h.
328 #AC_CHECK_HEADER(gts.h, , AC_MSG_ERROR($this_error_text), glib.h)
329 AC_SEARCH_LIBS(gts_object_class_new, gts, , AC_MSG_ERROR($this_error_text))
330 unset this_error_text
333 AC_MSG_CHECKING([whether to enable toporouter output])
334 AC_ARG_ENABLE([toporouter-output],
335 [AS_HELP_STRING([--enable-toporouter-output], [enable toporouter graphical output [default=no]]) ]
337 AS_CASE(["z$enable_toporouter_output"],[zyes | zno],,
338 [enable_toporouter_output=no]
340 AC_MSG_RESULT([$enable_toporouter_output])
341 AS_CASE([$enable_toporouter_output],[yes],
343 topo_output_enabled=1
346 topo_output_enabled=0
349 AC_DEFINE_UNQUOTED([TOPO_OUTPUT_ENABLED], [$topo_output_enabled],
350 [Define to 1 to enable toporouter graphical output]
353 PKG_PROG_PKG_CONFIG()
355 if test "x$enable_toporouter_output" = "xyes"; then
356 PKG_CHECK_MODULES(CAIRO, cairo,,
357 [AC_MSG_ERROR([Cannot find cairo, needed by the toporouter
358 Please review the following errors:
363 AC_MSG_CHECKING([for whether to use DBUS])
364 AC_ARG_ENABLE([dbus],
365 [ --enable-dbus Enable DBUS IPC],
367 case " $with_gui " in
368 *\ gtk\ *) enable_dbus=yes ;;
369 *\ lesstif\ *) enable_dbus=yes ;;
370 * ) enable_dbus=no ;;
374 AC_MSG_RESULT([$enable_dbus])
375 AM_CONDITIONAL(WITH_DBUS, test x$enable_dbus = xyes)
377 if test "x$enable_dbus" = "xyes"; then
378 case " $with_gui " in
381 * ) AC_MSG_ERROR([DBUS enabled but only works with a mainloop capable GUI HID.
382 Either do not use --enable-dbus or enable the gtk or lesstif GUI HID.])
385 PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.61,
387 LIBS="$LIBS $DBUS_LIBS"
388 AC_CHECK_FUNCS(dbus_watch_get_unix_fd)
389 LIBS="$saved_LIBS" ],
390 [AC_MSG_ERROR([Cannot find dbus-1 >= 0.61, install it and rerun ./configure
391 Please review the following errors:
394 DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
396 AC_DEFINE([HAVE_DBUS], 1,
397 [Define to 1 if DBUS IPC is to be compiled in])
402 AC_MSG_CHECKING([for whether to use GL drawing])
404 [ --enable-gl Enable GL drawing (with GTK HID)],
406 case " $with_gui " in
407 *\ gtk\ *) enable_gl=yes;;
411 AC_MSG_RESULT([$enable_gl])
412 AM_CONDITIONAL(USE_GL, test x$enable_gl = xyes)
414 if test "x$enable_gl" = "xyes"; then
415 case " $with_gui " in
417 * ) AC_MSG_ERROR([GL drawing enabled but only works with the GTK HID.
418 Either do not use --enable-gl or enable the gtk HID.])
423 AS_IF([test X$no_gl = Xyes],
424 [AC_MSG_FAILURE([OpenGL is required.])])
427 AS_IF([test X$no_glu = Xyes],
428 [AC_MSG_FAILURE([The OpenGL GLU library is required.])])
430 AC_DEFINE([ENABLE_GL], 1,
431 [Define to 1 if GL support is to be compiled in])
434 AC_MSG_CHECKING([for which printer to use])
435 AC_ARG_WITH([printer],
436 [ --with-printer= Specify the printer: lpr [[default=lpr]]],
437 [],[with_printer=lpr])
438 AC_MSG_RESULT([$with_printer])
439 case " $hid_printers " in
440 *\ $with_printer\ * )
441 HIDLIST="$HIDLIST $with_printer"
443 * ) AC_MSG_ERROR([$with_printer is not a valid printer]) ;;
446 AC_MSG_CHECKING([for which exporters to use])
447 AC_ARG_WITH([exporters],
448 [ --with-exporters= Enable export devices: bom gerber gcode nelma png ps [[default=bom gerber gcode nelma png ps]]],
449 [],[with_exporters=$hid_exporters])
450 AC_MSG_RESULT([$with_exporters])
451 for e in `echo $with_exporters | sed 's/,/ /g'`; do
452 case " $hid_exporters " in
454 HIDLIST="$HIDLIST $e"
456 * ) AC_MSG_ERROR([$e is not a valid exporter]) ;;
460 if test "X$enable_jpeg" = "Xno" -a "X$enable_gif" = "Xno" -a "X$enable_png" = "Xno" ; then
461 case " ${HIDLIST} " in
463 AC_MSG_ERROR([you have requested the png HID but turned off all output
464 formats! If you do not want gif/jpeg/png output, use --with-exporters to list
465 which exporters you want and do not list png there.])
473 for hid in $HIDLIST; do
474 F=$srcdir/src/hid/$hid/hid.conf
476 echo checking $hid dependencies
480 if test "X`echo $HIDLIST | grep $dep`" = "X"; then
481 AC_MSG_ERROR([you have requested the $hid HID but not the $dep HID, which it depends on])
487 for e in $HIDLIST; do
488 HIDLIBS="$HIDLIBS lib$e.a"
494 # ------------- end HID config -------------------
496 ######################################################################
498 # desktop integration
501 AC_PATH_PROG(SETENV, env, [])
502 AC_PATH_PROG(GTK_UPDATE_ICON_CACHE_BIN, gtk-update-icon-path, [true])
504 # Change default location for XDG files (MIME and Icons)
505 AC_ARG_WITH(xdgdatadir, [ --with-xdgdatadir=path Change where the theme icons
506 and mime registrations are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
508 # Change default location for KDE data files (KDE MIME registrations)
509 AC_ARG_WITH(kdedatadir, [ --with-kdedatadir=path Change where the KDE mime reg
510 istrations are installed [[DATADIR]]], [opt_kdedatadir=$withval])
512 if test x$opt_xdgdatadir = x; then
513 # path was not specified with --with-xdgdatadir
514 XDGDATADIR='${datadir}'
516 # path WAS specified with --with-xdgdatadir
517 XDGDATADIR="$opt_xdgdatadir"
521 if test x$opt_kdedatadir = x; then
522 # path was not specified with --with-kdedatadir
523 KDEDATADIR='${datadir}'
525 # path WAS specified with --with-kdedatadir
526 KDEDATADIR="$opt_kdedatadir"
530 AC_ARG_ENABLE(update-desktop-database,
531 AC_HELP_STRING([--disable-update-desktop-database],
532 [do not update desktop database after installation]),,
533 enable_update_desktop_database=yes)
535 AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE, test x$enable_update_desktop_database = xyes)
537 if test x$enable_update_desktop_database = xyes ; then
538 AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
539 if test $UPDATE_DESKTOP_DATABASE = no; then
540 AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
544 AC_ARG_ENABLE(update-mime-database,
545 AC_HELP_STRING([--disable-update-mime-database],
546 [do not update mime database after installation]),,
547 enable_update_mime_database=yes)
549 AM_CONDITIONAL(ENABLE_UPDATE_MIME_DATABASE, test x$enable_update_mime_database = xyes)
551 if test x$enable_update_mime_database = xyes ; then
552 AC_PATH_PROG(UPDATE_MIME_DATABASE, [update-mime-database], no)
553 if test $UPDATE_MIME_DATABASE = no; then
554 AC_MSG_ERROR([Cannot find update-mime-database, make sure it is installed and in your PATH, or configure with --disable-update-mime-database])
559 ######################################################################
561 AC_PATH_PROGS(M4, gm4 m4, [none])
562 if test "X$M4" = "Xnone" ; then
563 AC_MSG_ERROR([Did not find a m4 executible. You need to make sure
564 that m4 is installed on your system and that m4 is in your path])
566 AC_MSG_CHECKING([if $M4 has the division involving negative numbers bug])
567 pcb_m4_r=`echo "eval(-2/2)" | $M4`
568 if test "$pcb_m4_r" != "-1" ; then
570 AC_MSG_ERROR([It appears that $M4 has a bug involving division
571 with negative numbers. In particular it just returned the result that
572 -2/2 = $pcb_m4_r instead of -1. This is a known bug in GNU m4-1.4.9. Please
573 install a non-broken m4.])
579 AC_PATH_PROGS(WISH, wish wish85 wish8.5 wish83 wish8.3 wish80 wish8.0 cygwish83 cygwish80,[none])
580 if test "X$WISH" = "Xnone" ; then
581 AC_MSG_ERROR([Did not find the wish executible. You need to make sure
582 that tcl is installed on your system and that wish is in your path])
585 AC_DEFINE_UNQUOTED(M4,$M4,[m4 executible])
588 AC_DEFINE_UNQUOTED(GNUM4,"$M4",[m4 program used by pcb])
590 AC_PATH_PROG(PDFLATEX, pdflatex, notfound)
591 AM_CONDITIONAL(MISSING_PDFLATEX, test x$PDFLATEX = xnotfound)
593 AC_PATH_PROG(TEXI2DVI, texi2dvi, notfound)
594 AM_CONDITIONAL(MISSING_TEXI2DVI, test x$TEXI2DVI = xnotfound)
596 AC_PATH_PROG(PS2PDF, ps2pdf, notfound)
597 AM_CONDITIONAL(MISSING_PS2PDF, test x$PS2PDF = xnotfound)
599 # used to build some of the getting started guide
600 AC_PATH_PROG(GSCHEM, gschem, notfound)
601 AM_CONDITIONAL(MISSING_GSCHEM, test x$GSCHEM = xnotfound)
603 if test "X$docs_yesno" = "Xyes" -a "X$pcb_git_version" = "Xyes" ; then
604 if test "$PDFLATEX" = "notfound" -o "$TEXI2DVI" = "notfound" -o "$PS2PDF" = "notfound" ; then
605 AC_MSG_ERROR([It appears that you are building from a source tree obtained
606 via git but you do not have the required tools installed to build the documentation. Here
607 is a list of tools and the detected values:
613 Either make sure these tools are installed or disable building and installing the documentation
614 by using the --disable-doc configure option.
619 ############################################################################
621 # These checks are for tools used by the testsuite. It will not be fatal
622 # if these are missing because this is primarily for developer use. It is
623 # possible that we might add some --enable flag in the future that forces
624 # full tools for development work.
626 # Check for ImageMagick tools used by the testsuite
627 AC_PATH_PROG(IM_ANIMATE, animate, notfound)
628 AC_PATH_PROG(IM_COMPARE, compare, notfound)
629 AC_PATH_PROG(IM_COMPOSITE, composite, notfound)
630 AC_PATH_PROG(IM_CONVERT, convert, notfound)
631 AC_PATH_PROG(IM_DISPLAY, display, notfound)
632 AC_PATH_PROG(IM_MONTAGE, montage, notfound)
634 test "${IM_ANIMATE}" != "notfound" || missing_magick="${missing_magick} animate"
635 test "${IM_COMPARE}" != "notfound" || missing_magick="${missing_magick} compare"
636 test "${IM_COMPOSITE}" != "notfound" || missing_magick="${missing_magick} composite"
637 test "${IM_CONVERT}" != "notfound" || missing_magick="${missing_magick} convert"
638 test "${IM_DISPLAY}" != "notfound" || missing_magick="${missing_magick} display"
639 test "${IM_MONTAGE}" != "notfound" || missing_magick="${missing_magick} montage"
641 AC_MSG_CHECKING([if all ImageMagick tools needed for the testsuite were found])
642 if test "X${missing_magick}" != "X" ; then
643 AC_MSG_RESULT([no. The testsuite will be disabled because the following
644 tools from the ImageMagick suite were not found:
646 No loss in pcb functionality should be experienced, you just will not
647 be able to run the full regression testsuite.
657 test $have_magick = yes || have_test_tools=no
659 # the RS274-X export HID is partially checked by looking at the result with
661 AC_PATH_PROG(GERBV, gerbv, notfound)
662 test $GERBV != notfound || have_test_tools=no
665 AM_CONDITIONAL(HAVE_TEST_TOOLS, test x$have_test_tools = xyes)
666 AC_MSG_CHECKING([if all the requried testsuite tools were found])
667 if test x$have_test_tools = xyes ; then
670 AC_MSG_RESULT([no -- the testsuite will be disabled])
675 ############################################################################
678 dnl Checks for libraries.
679 AC_CHECK_LIB(m, sqrt)
680 AC_CHECK_LIB(dl, dlopen)
681 AC_CHECK_LIB(xnet, gethostbyname)
682 AC_CHECK_LIB(fl, yywrap)
683 AC_CHECK_FUNCS(strerror)
684 AC_CHECK_FUNCS(regcomp re_comp)
685 AC_CHECK_FUNCS(logf expf rint)
686 AC_CHECK_FUNCS(vsnprintf)
687 AC_CHECK_FUNCS(getpwuid getcwd)
688 AC_CHECK_FUNCS(rand random)
691 AC_CHECK_FUNCS(mkdtemp)
693 # normally used for all file i/o
694 AC_CHECK_FUNCS(popen)
697 AC_CHECK_FUNCS(realpath canonicalize_file_name)
698 libiberty_NEED_DECLARATION(canonicalize_file_name)
700 # for pcb_spawnvp in action.c on Windows
701 AC_CHECK_FUNCS(_spawnvp)
704 AC_CHECK_HEADERS(limits.h locale.h string.h sys/types.h regex.h pwd.h)
705 AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h sys/param.h sys/times.h sys/wait.h)
706 AC_CHECK_HEADERS(dlfcn.h)
708 if test "x${WIN32}" = "xyes" ; then
709 AC_CHECK_HEADERS(windows.h)
712 PKG_CHECK_MODULES(GLIB, glib-2.0, ,
713 [AC_MSG_RESULT([Note: cannot find glib-2.0.
714 You may want to review the following errors:
723 for e in $HIDLIST; do
727 save_CPPFLAGS="$CPPFLAGS"
729 AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS)
730 AC_CHECK_LIB(ICE, main, , , $X_LIBS)
731 AC_CHECK_LIB(SM, main, , , $X_LIBS)
732 AC_CHECK_LIB(Xext, main, , , $X_LIBS)
733 AC_CHECK_LIB(Xt, XtOpenDisplay, , , $X_LIBS)
734 AC_CHECK_LIB(Xmu, main, , , $X_LIBS)
735 AC_CHECK_LIB(Xpm, main, , , $X_LIBS)
736 AC_CHECK_LIB(Xm, XmCreateMainWindow, , , $X_LIBS)
737 CPPFLAGS="$save_CPPFLAGS"
738 case $ac_cv_lib_Xm_XmCreateMainWindow in
740 AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
744 AC_CHECK_HEADERS(Xm/Xm.h)
745 case $ac_cv_header_Xm_Xm_h in
747 AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
754 # Check for pkg-config
755 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
756 if test "$PKG_CONFIG" = "no"; then
757 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
760 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0, ,
761 [AC_MSG_ERROR([Cannot find gtk+ >= 2.18.0, install it and rerun ./configure
762 Please review the following errors:
765 GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
766 GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
768 if test "x$enable_gl" = "xyes"; then
770 PKG_CHECK_MODULES(GTKGLEXT, gtkglext-1.0 >= 1.0.0, , [AC_MSG_ERROR([
771 *** Required version of gtkglext is not installed - please install first ***
772 Please review the following errors:
773 $GTKGLEXT_PKG_ERRORS])]
775 GTKGLEXT_VER=`$PKG_CONFIG gtkglext-1.0 --modversion`
782 AC_MSG_CHECKING([if GIF output from the png HID is desired])
784 [ --disable-gif Disable support for gif output when the png HID is used [[default=include gif support]]],
786 if test "X$enable_gif" != "Xno" ; then
798 AC_MSG_CHECKING([if JPEG output from the png HID is desired])
799 AC_ARG_ENABLE([jpeg],
800 [ --disable-jpeg Disable support for JPEG output when the png HID is used [[default=include JPEG support]]],
802 if test "X$enable_jpeg" != "Xno" ; then
814 AC_MSG_CHECKING([if PNG output from the png HID is desired])
816 [ --disable-png Disable support for PNG output when the png HID is used [[default=include PNG support]]],
818 if test "X$enable_png" != "Xno" ; then
839 if test "$need_gdlib" = "yes"; then
840 # Check for gdlib-config for gd (www.boutell.com/gd)
841 AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, no)
842 if test "$GDLIB_CONFIG" = "no"; then
843 AC_MSG_RESULT([Cannot find gdlib-config.
844 Make sure it is installed and in your PATH.
845 gdlib-config is part of the GD library available from www.boutell.com/gd.
846 This is needed for the png HID. I will look for libgd anyway and maybe
849 if test "$WIN32" != "yes" ; then
850 AC_CHECK_LIB(gd,main,,
851 AC_MSG_ERROR([[You have requested gcode, nelma, or png HIDs but -lgd could not be found]]))
853 AC_CHECK_LIB(bgd,main,,
854 AC_MSG_ERROR([[You have requested gcode, nelma, or png HIDs but -lbgd could not be found]]))
857 if test "$WIN32" = "yes" ; then
862 AC_MSG_CHECKING([for libgd cflags])
863 GD_CFLAGS="`$GDLIB_CONFIG --cflags`"
864 AC_MSG_RESULT([$GD_CFLAGS])
865 AC_MSG_CHECKING([for libgd libs])
866 GD_LIBS="`$GDLIB_CONFIG --ldflags` `$GDLIB_CONFIG --libs` -l${GD}"
867 AC_MSG_RESULT([$GD_LIBS])
870 # since some linux systems evidently install gdlib-config but fail to
871 # install the headers (nice), check for the header too and fail if it
873 save_CPPFLAGS="$CPPFLAGS"
874 CPPFLAGS="$CPPFLAGS $GD_CFLAGS"
875 AC_CHECK_HEADERS(gd.h)
876 CPPFLASS="$save_CPPFLAGS"
877 case $ac_cv_header_gd_h in
880 You evidentally do not have a complete installation of the GD library available from www.boutell.com/gd.
881 This is needed for the nelma and/or png HID.
887 # Some versions of gd (prior to the expiration of the
888 # patent related to gif compression) do not support
889 # gif output. Check for that here.
891 LIBS="$save_LIBS $GD_LIBS $X_LIBS"
893 if test "X$with_gif" = "Xyes" ; then
894 AC_CHECK_FUNCS(gdImageGif)
895 if test "$ac_cv_func_gdImageGif" != "yes"; then
896 AC_MSG_ERROR([Your gd installation does not appear to include gif support.
897 You may need to update your installation of gd or disable
898 gif export with --disable-gif])
902 if test "X$with_jpeg" = "Xyes" ; then
903 AC_CHECK_FUNCS(gdImageJpeg)
904 if test "$ac_cv_func_gdImageJpeg" != "yes"; then
905 AC_MSG_ERROR([Your gd installation does not appear to include JPEG support.
906 You may need to update your installation of gd or disable
907 JPEG export with --disable-jpeg])
911 if test "X$with_png" = "Xyes" ; then
912 AC_CHECK_FUNCS(gdImagePng)
913 if test "$ac_cv_func_gdImagePng" != "yes"; then
914 AC_MSG_ERROR([Your gd installation does not appear to include PNG support.
915 You may need to update your installation of gd or disable
916 PNG export with --disable-png])
922 AM_CONDITIONAL(PNG, test x$with_png = xyes)
923 AM_CONDITIONAL(GIF, test x$with_gif = xyes)
925 # ------------- check if png previews should be built for pcblib-newlib
926 AC_MSG_CHECKING([if the m4lib to newlib export should create png previews])
929 [ --enable-m4lib-png Enable creating png previews for the m4 library],
930 [],[enable_m4lib_png=no])
931 AC_MSG_RESULT([$enable_m4lib_png])
932 AM_CONDITIONAL(PNG_PREVIEW, test x$enable_m4lib_png = xyes)
935 # Run away.... more ugly stuff here. By default we don't actually build
936 # pcblib-newlib from pcblib unless we are building from cvs or git sources.
937 # The reason is it takes a while and requires the png HID. The problem is,
938 # what if someone wants to use --enable-m4lib-png but the tarball was built
939 # without the previews. Or, what if someone does not want the PNG previews
940 # but the person building the tarball included them. Ugh! So what the following
941 # code attempts to do is detect that mismatch situation. Note that we only
942 # want to kick this code in when *not* building from git or cvs sources.
943 build_pcblib_newlib=no
944 if test "$pcb_sources" = "tarball" ; then
945 AC_MSG_CHECKING([If pcblib-newlib was built with png previews])
946 stamp=$srcdir/lib/pcblib-newlib.stamp
947 if test ! -f ${stamp} ; then
948 AC_MSG_RESULT([unknown, missing ${stamp}])
949 build_pcblib_newlib=yes
951 if test "`cat ${stamp}`" = "png-preview=yes" ; then
953 # lib exists and built with preview.
954 # if we don't want the preview, than rebuild
955 if test x$enable_m4lib_png != xyes ; then
956 build_pcblib_newlib=yes
960 # lib exists and built without preview.
961 # if we want the preview, than rebuild
962 if test x$enable_m4lib_png = xyes ; then
963 build_pcblib_newlib=yes
968 build_pcblib_newlib=yes
970 AC_MSG_CHECKING([If pcblib-newlib needs to be rebuilt])
971 AC_MSG_RESULT([$build_pcblib_newlib])
972 AM_CONDITIONAL(BUILD_PCBLIB_NEWLIB, test x$build_pcblib_newlib = xyes)
974 if test "X$cross_compiling" = "Xyes" ; then
975 # we are cross compiling so we will need a build host binary for pcb
976 AC_PATH_PROG(PCB, [pcb], [notfound])
978 PCB="\${top_builddir}/src/pcb"
982 # now make see how essential it was that we have a pcb executable for the build
984 if test "X$pcb_git_version" = "Xyes" ; then
985 if test "X$docs_yesno" = "Xyes" -o "X$enable_m4lib_png" = "Xyes" ; then
986 if test "$PCB" = "notfound" ; then
987 AC_MSG_ERROR([You have selected a build with m4lib png
988 previews enabled and/or with building the documentation enabled but you also
989 appear to be cross-compiling. For this to work, you must have a pcb installed that
990 can run on this machine (the build machine) because it is needed for generating
991 library footprint png previews as well as some of the figures in the documentation.
992 If you wish to skip building the documentation and the footprint previews then add
993 --disable-doc --disable-m4lib-png
994 This will allow your cross build to work.])
999 # ------------- Xrender -------------------
1001 AC_CHECK_LIB(Xrender,XRenderQueryExtension,have_xrender=yes,have_xrender=no,$X_LIBS)
1003 AC_ARG_ENABLE([xrender],
1004 [ --disable-xrender Compile and link with Xrender [default=yes]])
1005 case "$have_xrender:$enable_xrender" in
1009 X_LIBS="-lXrender $X_LIBS"
1010 AC_DEFINE([HAVE_XRENDER], 1,
1011 [Define to 1 if Xrender is available])
1015 # ------------- Xinerama -------------------
1017 AC_CHECK_LIB(Xinerama,XineramaQueryExtension,have_xinerama=yes,have_xinerama=no,$X_LIBS)
1019 AC_ARG_ENABLE([xinerama],
1020 [ --disable-xinerama Compile and link with Xinerama [default=yes]])
1021 case "$have_xinerama:$enable_xinerama" in
1025 X_LIBS="-lXinerama $X_LIBS"
1026 AC_DEFINE([HAVE_XINERAMA], 1,
1027 [Define to 1 if Xinerama is available])
1031 # ------------- dmalloc -------------------
1034 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
1035 AC_ARG_ENABLE([dmalloc],
1036 [ --enable-dmalloc Compile and link with dmalloc for malloc debugging [default=no]],
1038 if test "X$enable_dmalloc" != "Xno" ; then
1039 AC_MSG_RESULT([yes])
1040 AC_CHECK_HEADER(dmalloc.h,,
1041 AC_MSG_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
1042 AC_CHECK_LIB(dmalloc,main,,
1043 AC_MSG_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
1044 DMALLOC_LIBS="-ldmalloc"
1056 # ------------- ElectricFence -------------------
1057 dnl ElectricFence checks
1059 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
1060 AC_ARG_ENABLE([efence],
1061 [ --enable-efence Link with ElectricFence for malloc debugging [default=no]],
1063 if test "X$enable_efence" != "Xno" ; then
1064 AC_MSG_RESULT([yes])
1065 AC_CHECK_LIB(efence,main,,
1066 AC_MSG_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
1076 # ------------- Enable Debug code -------------------
1077 AC_MSG_CHECKING([for whether to enable debugging code])
1078 AC_ARG_ENABLE([debug],
1079 [ --enable-debug Enable debugging code],
1080 [],[enable_debug=no])
1082 AC_MSG_RESULT([$enable_debug])
1083 AM_CONDITIONAL(DEBUG_BUILD, test x$enable_debug = xyes)
1085 # ------------- mkdir required for win32 compatibility ------------
1086 # WIN32 mkdir takes only one argument, POSIX takes two.
1087 # #include "misc.h" where mkdir is required.
1088 m4_include([m4/m4_ax_func_mkdir.m4])
1091 # ------------- Type used for "Coord" type -------------------
1093 AC_CHECK_HEADERS(stdint.h)
1094 AC_ARG_ENABLE([coord64],
1095 [ --enable-coord64 Force 64-bit coordinate types],
1096 [],[enable_coord64=no])
1097 AC_ARG_ENABLE([coord32],
1098 [ --enable-coord32 Force 32-bit coordinate types],
1099 [],[enable_coord32=no])
1103 echo "$enable_coord32:$enable_coord64:$ac_cv_header_stdint_h"
1104 case "$enable_coord32:$enable_coord64:$ac_cv_header_stdint_h" in
1106 COORD_TYPE="int32_t"
1107 COORD_MAX="INT32_MAX"
1110 COORD_TYPE="int64_t"
1111 COORD_MAX="INT64_MAX"
1118 COORD_TYPE="long long"
1119 COORD_MAX="LLONG_MAX"
1122 AC_MSG_ERROR("*** cannot require both 32 and 64 bit coordinates")
1126 COORD_MAX="LONG_MAX"
1129 AC_DEFINE_UNQUOTED([COORD_TYPE],[$COORD_TYPE],
1130 [C type for Coordinates])
1131 AC_DEFINE_UNQUOTED([COORD_MAX],[$COORD_MAX],
1132 [Maximum value of coordinate type])
1134 # ------------- Complete set of CPPFLAGS and LIBS -------------------
1136 CPPFLAGS="$CPPFLAGS $X_CFLAGS $DBUS_CFLAGS $GLIB_CFLAGS $GTK_CFLAGS $GD_CFLAGS $CAIRO_CFLAGS $GTKGLEXT_CFLAGS $GLU_CFLAGS $GL_CFLAGS"
1137 LIBS="$LIBS $XM_LIBS $DBUS_LIBS $X_LIBS $GLIB_LIBS $GTK_LIBS $DMALLOC_LIBS $GD_LIBS $INTLLIBS $CAIRO_LIBS $GTKGLEXT_LIBS $GLU_LIBS $GL_LIBS"
1140 # if we have gcc then add -Wall
1141 if test "x$GCC" = "xyes"; then
1142 # see about adding some extra checks if the compiler takes them
1143 for flag in -Wall ; do
1144 case " ${CFLAGS} " in
1146 # flag is already present
1149 AC_MSG_CHECKING([if the compiler accepts ${flag}])
1150 ac_save_CFLAGS="$CFLAGS"
1151 CFLAGS="$CFLAGS ${flag}"
1152 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1153 [AC_MSG_RESULT([yes])],
1154 [AC_MSG_RESULT([no])
1155 CFLAGS="$ac_save_CFLAGS"
1165 # Now add C-specific flags
1166 if test "x$GCC" = "xyes"; then
1167 # see about adding some extra checks if the compiler takes them
1168 for flag in -Wdeclaration-after-statement ; do
1169 case " ${CFLAGS} " in
1171 # flag is already present
1174 AC_MSG_CHECKING([if the compiler accepts ${flag}])
1175 ac_save_CFLAGS="$CFLAGS"
1176 CFLAGS="$CFLAGS ${flag}"
1177 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1178 [AC_MSG_RESULT([yes])],
1179 [AC_MSG_RESULT([no])
1180 CFLAGS="$ac_save_CFLAGS"
1188 # See if we are building gcc with C++.
1189 AC_ARG_ENABLE(build-with-cxx,
1190 [ --enable-build-with-cxx build with C++ compiler instead of C compiler],
1191 ENABLE_BUILD_WITH_CXX=$enableval,
1192 ENABLE_BUILD_WITH_CXX=no)
1194 case "$ENABLE_BUILD_WITH_CXX" in
1205 FONTFILENAME=${FONTFILENAME:-"default_font"}
1206 AC_SUBST(FONTFILENAME)
1207 AC_DEFINE_UNQUOTED(FONTFILENAME,"$FONTFILENAME",[File for default font])
1209 # standard autoconf variables
1210 CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\""
1211 CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\""
1212 CPPFLAGS="$CPPFLAGS -DHOST=\\\"\${host}\\\""
1214 # directory for old-style library and for fonts
1215 PCBLIBDIR=${datadir}/pcb
1217 #AC_DEFINE_UNQUOTED(PCBLIBDIR,"$PCBLIBDIR",[Library directory])
1218 CPPFLAGS="$CPPFLAGS -DPCBLIBDIR=\\\"$PCBLIBDIR\\\""
1220 # name for old-style library
1221 LIBRARYFILENAME=pcblib
1222 AC_SUBST(LIBRARYFILENAME)
1223 AC_DEFINE_UNQUOTED(LIBRARYFILENAME,"$LIBRARYFILENAME",[library file name])
1226 # directory for new library
1227 PCBTREEDIR=${datadir}/pcb/newlib
1228 PCBTREEPATH=${PCBTREEDIR}:${PCBLIBDIR}/pcblib-newlib
1229 PCBTREEDIR=${PCBTREEDIR:-"$PCBTREEDIR"}
1230 AC_SUBST(PCBTREEDIR)
1231 AC_SUBST(PCBTREEPATH)
1232 #AC_DEFINE_UNQUOTED(PCBTREEDIR,"$PCBLIB",[top directory for new style pcb library])
1233 CPPFLAGS="$CPPFLAGS -DPCBTREEDIR=\\\"$PCBTREEDIR\\\""
1234 CPPFLAGS="$CPPFLAGS -DPCBTREEPATH=\\\"$PCBTREEPATH\\\""
1236 # Figure out relative paths
1237 AC_MSG_CHECKING([for the bindir to pcblibdir relative path])
1238 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBLIBDIR:bindir_to_pcblibdir])
1239 adl_NORMALIZE_PATH([bindir_to_pcblibdir], [$PCB_DIR_SEPARATOR_S])
1240 AC_MSG_RESULT([$bindir_to_pcblibdir])
1241 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBLIBDIR, "$bindir_to_pcblibdir", [Relative path from bindir to pcblibdir])
1243 AC_MSG_CHECKING([for the bindir to pcbtreedir relative path])
1244 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBTREEDIR:bindir_to_pcbtreedir])
1245 adl_NORMALIZE_PATH([bindir_to_pcbtreedir], [$PCB_DIR_SEPARATOR_S])
1246 AC_MSG_RESULT([$bindir_to_pcbtreedir])
1247 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBTREEDIR, "$bindir_to_pcbtreedir", [Relative path from bindir to pcbtreedir])
1250 AC_MSG_CHECKING([for the bindir to exec_prefix relative path])
1251 adl_COMPUTE_RELATIVE_PATHS([bindir:exec_prefix:bindir_to_execprefix])
1252 adl_NORMALIZE_PATH([bindir_to_execprefix], [$PCB_DIR_SEPARATOR_S])
1253 AC_MSG_RESULT([$bindir_to_execprefix])
1254 AC_DEFINE_UNQUOTED(BINDIR_TO_EXECPREFIX, "$bindir_to_execprefix", [Relative path from bindir to exec_prefix])
1257 BTNMOD=${BTNMOD:-"Mod1"}
1261 for dir in src lib newlib doc example tools tutorial README_FILES
1263 test -d $dir/. && TOPDIRS="$TOPDIRS $dir"
1267 AC_CONFIG_FILES(Makefile data/Makefile intl/Makefile po/Makefile.in)
1269 if test -d $srcdir/README_FILES; then
1270 AC_CONFIG_FILES(README_FILES/Makefile)
1272 if test -d $srcdir/doc; then
1273 AC_CONFIG_FILES(doc/Makefile)
1275 if test -d $srcdir/doc/gs; then
1276 AC_CONFIG_FILES(doc/gs/Makefile)
1277 AC_CONFIG_FILES(doc/gs/gafrc)
1278 AC_CONFIG_FILES(doc/gs/gschemrc)
1280 if test -d $srcdir/example; then
1281 AC_CONFIG_FILES(example/Makefile)
1282 AC_CONFIG_FILES(example/libraries/Makefile)
1284 if test -d $srcdir/lib; then
1285 AC_CONFIG_FILES(lib/CreateLibraryContents.sh)
1286 AC_CONFIG_FILES(lib/CreateLibrary.sh)
1287 AC_CONFIG_FILES(lib/ListLibraryContents.sh)
1288 AC_CONFIG_FILES(lib/Makefile)
1289 AC_CONFIG_FILES(lib/QueryLibrary.sh)
1290 AC_CONFIG_FILES(lib/qfp-ui)
1292 if test -d $srcdir/newlib; then
1293 AC_CONFIG_FILES(newlib/2_pin_thru-hole_packages/Makefile)
1294 AC_CONFIG_FILES(newlib/Makefile)
1295 AC_CONFIG_FILES(newlib/connectors/Makefile)
1296 AC_CONFIG_FILES(newlib/crystal/Makefile)
1297 AC_CONFIG_FILES(newlib/electro-optics/Makefile)
1298 AC_CONFIG_FILES(newlib/headers/Makefile)
1299 AC_CONFIG_FILES(newlib/keystone/Makefile)
1300 AC_CONFIG_FILES(newlib/msp430/Makefile)
1301 AC_CONFIG_FILES(newlib/not_vetted_ingo/Makefile)
1302 AC_CONFIG_FILES(newlib/sockets/Makefile)
1303 AC_CONFIG_FILES(newlib/tests/Makefile)
1305 AC_CONFIG_FILES(src/Makefile)
1306 AC_CONFIG_FILES(src/icons/Makefile)
1307 if test -d $srcdir/tools; then
1308 AC_CONFIG_FILES(tools/Makefile)
1310 if test -d $srcdir/tutorial; then
1311 AC_CONFIG_FILES(tutorial/Makefile)
1315 AC_CONFIG_FILES(tests/Makefile)
1317 dnl win32 build scripts
1318 AC_CONFIG_FILES(w32/Makefile)
1322 with_gui=`echo $with_gui`
1323 with_printer=`echo $with_printer`
1324 with_exporters=`echo $with_exporters | sed 's/,/ /g'`
1326 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
1327 expandedKDEDATADIR=`eval "echo $KDEDATADIR"`
1330 ** Configuration summary for $PACKAGE $VERSION:
1332 Cross Compiling: $cross_compiling
1342 Printer: $with_printer
1343 Exporters: $with_exporters
1344 Coordinate type: $COORD_TYPE
1345 Source tree distribution: $pcb_sources
1346 Build documentation: $docs_yesno
1347 Build toporouter: $enable_toporouter
1348 Enable toporouter output: $enable_toporouter_output
1349 xdg data directory: $expandedXDGDATADIR
1350 KDE data directory: $expandedKDEDATADIR
1351 dmalloc debugging: $with_dmalloc
1352 ElectricFence debugging: $with_efence
1353 Regression tests enabled: $have_test_tools