Add support for filling / thindrawing raw polygons to the HID interface
[geda-pcb/gde.git] / configure.ac
blob80c373753fded8f78bd80c235ede758e66885d24
1 dnl $Id$
2 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT([pcb], [1.99y])
5 AC_CONFIG_SRCDIR([src/draw.c])
6 AC_PREREQ([2.59])
7 AM_INIT_AUTOMAKE([1.9])
8 AC_GNU_SOURCE
9 AM_CONFIG_HEADER([config.h])
11 AM_MAINTAINER_MODE
13 dnl determine host type
14 AC_CANONICAL_HOST
15 AC_MSG_CHECKING(for windows)
16 PCB_PATH_DELIMETER=":"
17 PCB_DIR_SEPARATOR_S="/"
18 PCB_DIR_SEPARATOR_C='/'
19 case $host in
20         *-*-cygwin* )
21                 CFLAGS="$CFLAGS ${CYGWIN_CFLAGS}"
22                 CPPFLAGS="$CPPFLAGS ${CYGWIN_CPPFLAGS}"
23                 ;;
25         *-*-mingw* )
26                 WIN32=yes
27                 CFLAGS="$CFLAGS ${MINGW_CFLAGS:--mms-bitfields -mwindows}"
28                 CPPFLAGS="$CPPFLAGS ${MINGW_CPPFLAGS:--mms-bitfields -mwindows}"
29                 ;;
31         * )
32                 WIN32=no
33                 ;;
34 esac
36 AC_MSG_RESULT($WIN32)
37 AC_SUBST(WIN32)
38 AM_CONDITIONAL(WIN32, test x$WIN32 = xyes)
39 if test "x$WIN32" = "xyes" ; then
40         PCB_PATH_DELIMETER=";"
41         PCB_DIR_SEPARATOR_S="\\\\"
42         PCB_DIR_SEPARATOR_C='\\'
45 AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_C,'$PCB_DIR_SEPARATOR_C',[Directory separator char])
46 AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_S,"$PCB_DIR_SEPARATOR_S",[Directory separator string])
47 AC_DEFINE_UNQUOTED(PCB_PATH_DELIMETER,"$PCB_PATH_DELIMETER",[Search path separator string])
50 dnl Checks for programs.
51 AC_PROG_CC
53 if test "x$WIN32" = "xyes" ; then
54         AC_CHECK_TOOL(WINDRES, windres, [no])
55         if test "$WINDRES" = "no" ; then
56                 AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
57         fi
60 # i18n
61 GETTEXT_PACKAGE=$PACKAGE
62 AH_TEMPLATE([GETTEXT_PACKAGE], [Name of this program's gettext domain])
63 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"])
64 AC_SUBST(GETTEXT_PACKAGE)
66 AM_GNU_GETTEXT_VERSION([0.14])
67 AM_GNU_GETTEXT
68 IT_PROG_INTLTOOL([0.35.0])
70 AC_C_INLINE
71 AC_PROG_CC_STDC
72 AM_PROG_CC_C_O
73 AC_PROG_CPP
74 AC_PROG_AWK
76 AM_PROG_LEX
77 AC_PATH_PROG(LEX_PATH, $LEX, [notfound])
78 if test "$LEX_PATH" = "notfound" ; then
79         AC_MSG_ERROR([Couldn't find a usable lex program.
80 Please install flex which is available from
81 ftp://ftp.gnu.org/pub/non-gnu/flex/
86 AC_PROG_YACC
87 AC_PATH_PROG(YACC_PATH, $YACC, [notfound])
88 if test "$YACC_PATH" = "notfound" ; then
89         AC_MSG_ERROR([Couldn't find a usable yacc program.
90 Please install bison which is available from
91 ftp://ftp.gnu.org/pub/gnu/bison/
95 AC_PROG_INSTALL
96 AC_PROG_RANLIB
99 # Used for building the icons
101 AC_PATH_PROG(XPMTOPPM, xpmtoppm, notfound)
102 AC_PATH_PROG(PPMTOWINICON, ppmtowinicon, notfound)
103 AC_PATH_PROG(CONVERT, convert, notfound)
105 docs_yesno=yes
107 AC_MSG_CHECKING([if the documentation should be built])
108 AC_ARG_ENABLE([doc],
109 [  --enable-doc            Build and install the documentation [[default=yes]]],
111 if test "X$enable_doc" = "Xno" ; then
112         DOC=""
113         AC_MSG_RESULT([no])
114         docs_yesno=no
115 else
116         DOC=doc
117         AC_MSG_RESULT([yes])
118         docs_yesno=yes
122 DOC=doc
123 AC_MSG_RESULT([yes])
124 docs_yesno=yes
126 AC_SUBST(DOC)
128 if test "X$docs_yesno" = "Xyes" -a "X$USE_MAINTAINER_MODE" = "Xyes" ; then
129    AC_CHECK_PROGS(MKINFO, makeinfo, no)
130    if test "X$MKINFO" != "Xno"; then
131       AC_MSG_CHECKING([for GNU makeinfo version >= 4.6])
132       v=`$MKINFO --version | grep "GNU texinfo"`
133       if test $? -ne 0; then
134          AC_MSG_RESULT([non-GNU])
135          MKINFO="no"
136       fi
137    fi
138    if test "X$MKINFO" != "Xno"; then
139       vmajor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\1/'`
140       vminor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
141       AC_MSG_RESULT([$vmajor.$vminor])
142       if test "$vmajor" -lt 4 \
143               || (test "$vmajor" -eq 4 && test "$vminor" -lt 6); then
144          MKINFO=no
145       fi
146    fi
147    if test "X$MKINFO" = "Xno"; then
148       AC_MSG_ERROR([You have requested a maintainer-mode build and a build
149 of the documentation.  For this to work, you must have version 4.6 or newer of
150 the GNU texinfo package.  You seem to have
155    fi
157    AC_CHECK_PROGS(TEXI2DVI, texi2dvi, no)
158    if test "X$TEXI2DVI" = "Xno"; then
159       AC_MSG_ERROR([You have requested a maintainer-mode build and a build
160 of the documentation.  For this to work, you must have the texi2dvi program
161 installed.])
162    fi
165         AC_PATH_PROG(PERL, perl, notfound)
166         if test "X$PERL" = "Xnotfound"; then
167                         AC_MSG_ERROR([You have requested a maintainer-mode build and a build
168 of the documentation.  For this to work, you must have perl installed.
170         fi
173 # FIXME:  for now, only try to add -rdynamic if we're using gcc.  We really
174 # need to figure out what the correct test is here.  In the mean time, this
175 # should let things build with SunPRO again.
176 if test "x$GCC" = "xyes"; then
177 AC_MSG_CHECKING([If the compiler accepts -rdynamic])
178 old_LDFLAGS="$LDFLAGS"
179 LDFLAGS="$LDFLAGS -rdynamic"
180 AC_LINK_IFELSE([int main(){}],
181         [AC_MSG_RESULT([yes])],
182         [LDFLAGS="$old_LDFLAGS"
183         AC_MSG_RESULT([no])
184         ])
187 # ------------- HID config -------------------
189 hid_guis=""
190 hid_printers=""
191 hid_exporters=""
192 hid_always=""
194 for hid in `cd $srcdir/src/hid; echo *`; do
195     F=$srcdir/src/hid/$hid/hid.conf
196     if test -f $F 
197     then
198     echo checking $F
199         . $F
200         case $type in
201           gui ) hid_guis="$hid_guis $hid" ;;
202           printer ) hid_printers="$hid_printers $hid" ;;
203           export ) hid_exporters="$hid_exporters $hid" ;;
204           always ) hid_always="$hid_always $hid" ;;
205         esac
206     fi
207 done
209 AC_MSG_CHECKING([for which gui to use])
210 AC_ARG_WITH([gui],
211 [  --with-gui=            Specify the GUI to use: batch gtk lesstif [[default=gtk]]],
213 [with_gui=gtk]
215 AC_MSG_RESULT([$with_gui])
216 case " $hid_guis no none " in
217      *\ $with_gui\ * ) HIDLIST="$with_gui" ;;
218      * ) AC_MSG_ERROR([$with_gui is not a valid gui]) ;;
219 esac
221 if test x"$with_gui" = x"none" -o x"$with_gui" = x"no"
222 then
223     HIDLIST=
226 AC_MSG_CHECKING([for whether to use DBUS])
227 AC_ARG_ENABLE([dbus],
228 [  --enable-dbus           Enable DBUS IPC],
229 [],[enable_dbus=no])
231 AC_MSG_RESULT([$enable_dbus])
232 AM_CONDITIONAL(WITH_DBUS, test x$enable_dbus = xyes)
234 if test "x$enable_dbus" = "xyes"; then
235         case " $with_gui " in
236                 *\ gtk\ *) ;;
237                 *\ lesstif\ *) ;;
238                 * ) AC_MSG_ERROR([DBUS enabled but only works with a mainloop capable GUI HID.
239 Either do not use --enable-dbus or enable the gtk or lesstif GUI HID.])
240         esac
241         
242         # Check for pkg-config
243         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
244         if test "$PKG_CONFIG" = "no"; then
245                 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
246         fi
248         PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.61,
249                 [saved_LIBS="$LIBS"
250                  LIBS="$LIBS $DBUS_LIBS"
251                  AC_CHECK_FUNCS(dbus_watch_get_unix_fd)
252                  LIBS="$saved_LIBS" ],
253                 [AC_MSG_ERROR([Cannot find dbus-1 >= 0.61, install it and rerun ./configure
254 Please review the following errors:
255 $DBUS_PKG_ERRORS])]
256         )
257         DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
258         
259         AC_DEFINE([HAVE_DBUS], 1,
260                 [Define to 1 if DBUS IPC is to be compiled in])
264 AC_MSG_CHECKING([for which printer to use])
265 AC_ARG_WITH([printer],
266 [  --with-printer=        Specify the printer: lpr [[default=lpr]]],
267 [],[with_printer=lpr])
268 AC_MSG_RESULT([$with_printer])
269 case " $hid_printers " in
270      *\ $with_printer\ * )
271          HIDLIST="$HIDLIST $with_printer"
272          ;;
273      * ) AC_MSG_ERROR([$with_printer is not a valid printer]) ;;
274 esac
276 AC_MSG_CHECKING([for which exporters to use])
277 AC_ARG_WITH([exporters],
278 [  --with-exporters=       Enable export devices: bom gerber nelma png ps [[default=bom gerber nelma png ps]]],
279 [],[with_exporters=$hid_exporters])
280 AC_MSG_RESULT([$with_exporters])
281 for e in `echo $with_exporters | sed 's/,/ /g'`; do
282     case " $hid_exporters " in
283       *\ $e\ * )
284          HIDLIST="$HIDLIST $e"
285          ;;
286       * ) AC_MSG_ERROR([$e is not a valid exporter]) ;;
287     esac
288 done
290 if test "X$enable_jpeg" = "Xno" -a "X$enable_gif" = "Xno" -a "X$enable_png" = "Xno" ; then
291         case " ${HIDLIST} " in
292                 *\ png\ *)
293                         AC_MSG_ERROR([you have requested the png HID but turned off all output
294 formats!  If you do not want gif/jpeg/png output, use --with-exporters to list
295 which exporters you want and do not list png there.])
296                         ;;
298                 *)
299                         ;;
300         esac
303 for e in $HIDLIST; do
304     HIDLIBS="$HIDLIBS lib$e.a"
305 done
307 AC_SUBST(HIDLIST)
308 AC_SUBST(HIDLIBS)
310 # ------------- end HID config -------------------
312 ######################################################################
314 # desktop integration
317 AC_PATH_PROG(SETENV, env, [])
318 AC_PATH_PROG(GTK_UPDATE_ICON_CACHE_BIN, gtk-update-icon-path, [true])
320 # Change default location for XDG files (MIME and Icons)
321 AC_ARG_WITH(xdgdatadir, [  --with-xdgdatadir=path  Change where the theme icons 
322 and mime registrations are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
324 # Change default location for KDE data files (KDE MIME registrations)
325 AC_ARG_WITH(kdedatadir, [  --with-kdedatadir=path  Change where the KDE mime reg
326 istrations are installed [[DATADIR]]], [opt_kdedatadir=$withval])
328 if test x$opt_xdgdatadir = x; then
329         # path was not specified with --with-xdgdatadir
330         XDGDATADIR='${datadir}'
331 else
332         # path WAS specified with --with-xdgdatadir
333         XDGDATADIR="$opt_xdgdatadir"
335 AC_SUBST(XDGDATADIR)
337 if test x$opt_kdedatadir = x; then
338         # path was not specified with --with-kdedatadir
339         KDEDATADIR='${datadir}'
340 else
341         # path WAS specified with --with-kdedatadir
342         KDEDATADIR="$opt_kdedatadir"
344 AC_SUBST(KDEDATADIR)
346 AC_ARG_ENABLE(update-desktop-database,
347         AC_HELP_STRING([--disable-update-desktop-database],
348         [do not update desktop database after installation]),,
349         enable_update_desktop_database=yes)
351 AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE, test x$enable_update_desktop_database = xyes)
353 if test x$enable_update_desktop_database = xyes ; then
354         AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
355         if test $UPDATE_DESKTOP_DATABASE = no; then
356         AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
357         fi
360 AC_ARG_ENABLE(update-mime-database,
361         AC_HELP_STRING([--disable-update-mime-database],
362         [do not update mime database after installation]),,
363         enable_update_mime_database=yes)
365 AM_CONDITIONAL(ENABLE_UPDATE_MIME_DATABASE, test x$enable_update_mime_database = xyes)
367 if test x$enable_update_mime_database = xyes ; then
368         AC_PATH_PROG(UPDATE_MIME_DATABASE, [update-mime-database], no)
369         if test $UPDATE_MIME_DATABASE = no; then
370         AC_MSG_ERROR([Cannot find update-mime-database, make sure it is installed and in your PATH, or configure with --disable-update-mime-database])
371         fi
375 ######################################################################
377 AC_PATH_PROGS(M4, gm4 m4, [none])
378 if test "X$M4" = "Xnone" ; then
379         AC_MSG_ERROR([Did not find a m4 executible.  You need to make sure
380         that m4 is installed on your system and that m4 is in your path])
382 AC_MSG_CHECKING([if $M4 has the division involving negative numbers bug])
383 pcb_m4_r=`echo "eval(-2/2)" | $M4`
384 if test "$pcb_m4_r" != "-1" ; then
385         AC_MSG_RESULT([yes])
386         AC_MSG_ERROR([It appears that $M4 has a bug involving division
387 with negative numbers.  In particular it just returned the result that
388 -2/2 = $pcb_m4_r instead of -1.  This is a known bug in GNU m4-1.4.9.  Please
389 install a non-broken m4.])
390 else
391         AC_MSG_RESULT([no])
395 AC_PATH_PROGS(WISH, wish wish83 wish8.3 wish80 wish8.0 cygwish83 cygwish80,[none])
396 if test "X$WISH" = "Xnone" ; then
397         AC_MSG_ERROR([Did not find the wish executible.  You need to make sure
398         that tcl is installed on your system and that wish is in your path])
401 AC_DEFINE_UNQUOTED(M4,$M4,[m4 executible])
402 GNUM4=$M4
403 AC_SUBST(GNUM4)
404 AC_DEFINE_UNQUOTED(GNUM4,"$M4",[m4 program used by pcb])
406 AC_CHECK_PROGS(LATEX, latex, notfound)
407 AM_CONDITIONAL(MISSING_LATEX, test x$LATEX = xnotfound)
409 AC_CHECK_PROGS(PDFLATEX, pdflatex, notfound)
410 AM_CONDITIONAL(MISSING_PDFLATEX, test x$PDFLATEX = xnotfound)
412 AC_CHECK_PROGS(DVIPS, dvips, notfound)
413 AM_CONDITIONAL(MISSING_DVIPS, test x$DVIPS = xnotfound)
415 AC_CHECK_PROGS(TEXI2DVI, texi2dvi, notfound)
416 AM_CONDITIONAL(MISSING_TEXI2DVI, test x$TEXI2DVI = xnotfound)
418 AC_CHECK_PROGS(PS2PDF, ps2pdf, notfound)
419 AM_CONDITIONAL(MISSING_PS2PDF, test x$PS2PDF = xnotfound)
421 dnl Checks for libraries.
422 AC_CHECK_LIB(m, sqrt)
423 AC_CHECK_LIB(dl, dlopen)
424 AC_CHECK_LIB(xnet, gethostbyname)
425 AC_CHECK_LIB(fl, yywrap)
426 AC_CHECK_FUNCS(strerror)
427 AC_CHECK_FUNCS(regcomp re_comp)
428 AC_CHECK_FUNCS(logf expf rint)
429 AC_CHECK_FUNCS(vsnprintf)
430 AC_CHECK_FUNCS(getpwuid gethostname getcwd)
431 AC_CHECK_FUNCS(random)
432 AC_CHECK_FUNCS(stat)
434 # normally used for all file i/o
435 AC_CHECK_FUNCS(popen)
437 # for lrealpath.c
438 AC_CHECK_FUNCS(realpath canonicalize_file_name)
439 libiberty_NEED_DECLARATION(canonicalize_file_name)
441 AC_HEADER_STDC
442 AC_CHECK_HEADERS(limits.h locale.h string.h sys/types.h regex.h pwd.h)
443 AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h sys/param.h sys/times.h)
444 AC_CHECK_HEADERS(dlfcn.h)
446 if test "x${WIN32}" = "xyes" ; then
447         AC_CHECK_HEADERS(windows.h)
450 for e in $HIDLIST; do
451     case $e in
452       lesstif )
453         AC_PATH_XTRA
454         CPPFLAGS="$CFLAGS $X_CFLAGS"
455         AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS)
456         AC_CHECK_LIB(ICE, main, , , $X_LIBS)
457         AC_CHECK_LIB(SM, main, , , $X_LIBS)
458         AC_CHECK_LIB(Xext, main, , , $X_LIBS)
459         AC_CHECK_LIB(Xt, XtOpenDisplay, , , $X_LIBS)
460         AC_CHECK_LIB(Xmu, main, , , $X_LIBS)
461         AC_CHECK_LIB(Xpm, main, , , $X_LIBS)
462         AC_CHECK_LIB(Xm, XmCreateMainWindow, , , $X_LIBS)
463         case $ac_cv_lib_Xm_XmCreateMainWindow in
464           no )
465             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
466             ;;
467           * ) ;;
468         esac
469         AC_CHECK_HEADERS(Xm/Xm.h)
470         case $ac_cv_header_Xm_Xm_h in
471           no )
472             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
473             ;;
474           * ) ;;
475         esac
476         ;;
478       gtk )
479         # Check for pkg-config
480         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
481         if test "$PKG_CONFIG" = "no"; then
482                 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
483         fi
485         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0, , 
486                 [AC_MSG_ERROR([Cannot find gtk+ >= 2.4.0, install it and rerun ./configure
487 Please review the following errors:
488 $GTK_PKG_ERRORS])]
489         )
490         GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
491         
492         # if we are building for gtk >= 2.8.0, we can use gdk_display_warp_pointer()
493         # otherwise we need XWarpPointer and we'll pull in the required headers with
494         # gdk/gdkx.h and we'll need to link with X11
495         if ! $PKG_CONFIG gtk+-2.0 --atleast-version=2.8.0 ; then
496                 CPPFLAGS="$CFLAGS $GTK_CFLAGS"
497                 AC_CHECK_HEADERS([gdk/gdkx.h])
498         fi
500         # Search for glib
501         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.4.0, , 
502                 [AC_MSG_ERROR([Cannot find glib >= 2.4.0, install it and rerun ./configure.
503 Please review the following errors:
504 $GLIB_PKG_ERRORS])]
505         )
506         GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
507         ;;
509       nelma|png )
510         # Check for gdlib-config for gd (www.boutell.com/gd)
511         AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, no)
512         if test "$GDLIB_CONFIG" = "no"; then
513                 AC_MSG_RESULT([Cannot find gdlib-config.
514 Make sure it is installed and in your PATH.
515 gdlib-config is part of the GD library available from www.boutell.com/gd.
516 This is needed for the png HID.  I will look for libgd anyway and maybe
517 you will get lucky.
519                 if test "$WIN32" != "yes" ; then
520                         AC_CHECK_LIB(gd,main,,
521                         AC_MSG_ERROR([You have requested the nelma and/or png HID  but -lgd could not be found]))
522                 else 
523                         AC_CHECK_LIB(bgd,main,,
524                         AC_MSG_ERROR([You have requested the nelma and/or png HID  but -lbgd could not be found]))
525                 fi
526         else
527                 if test "$WIN32" = "yes" ; then
528                         GD=bgd
529                 else
530                         GD=gd
531                 fi
532                 AC_MSG_CHECKING([for libgd cflags])
533                 GD_CFLAGS="`$GDLIB_CONFIG --cflags`"
534                 AC_MSG_RESULT([$GD_CFLAGS])
535                 AC_MSG_CHECKING([for libgd libs])
536                 GD_LIBS="`$GDLIB_CONFIG --ldflags` `$GDLIB_CONFIG --libs` -l${GD}"
537                 AC_MSG_RESULT([$GD_LIBS])
538         fi
539    
540         # since some linux systems evidently install gdlib-config but fail to
541         # install the headers (nice), check for the header too and fail if it
542         # is not there.
543         CFLAGS="$CFLAGS $GD_CFLAGS"
544         CPPFLAGS="$CPPFLAGS $GD_CFLAGS"
545         AC_CHECK_HEADERS(gd.h)
546         case $ac_cv_header_gd_h in
547              no )
548                 AC_MSG_ERROR([
549 You evidentally do not have a complete installation of the GD library available from www.boutell.com/gd.
550 This is needed for the nelma and/or png HID.
552                 ;;
553              * ) ;;
554         esac
555         
556         # Some versions of gd (prior to the expiration of the
557         # patent related to gif compression) do not support
558         # gif output.  Check for that here.
559         save_LIBS="$LIBS"
560         LIBS="$save_LIBS $GD_LIBS $X_LIBS"
562         AC_MSG_CHECKING([if GIF output from the png HID is desired])
563         AC_ARG_ENABLE([gif],
564                 [  --disable-gif           Disable support for gif output when the png HID is used [[default=include gif support]]],
565                 [
566                 if test "X$enable_gif" != "Xno" ; then
567                         AC_MSG_RESULT([yes])
568                         with_gif=yes
569                 else
570                         AC_MSG_RESULT([no])
571                         with_gif=no
572                 fi
573                 ],
574                 [
575                 AC_MSG_RESULT([yes])
576                 with_gif=yes
577                 ])
578         if test "X$with_gif" = "Xyes" ; then
579                 AC_CHECK_FUNCS(gdImageGif)
580                 if test "$ac_cv_func_gdImageGif" != "yes"; then
581                         AC_MSG_ERROR([Your gd installation does not appear to include gif support.
582 You may need to update your installation of gd or disable
583 gif export with --disable-gif])
584                 fi
585         fi
587         AC_MSG_CHECKING([if JPEG output from the png HID is desired])
588         AC_ARG_ENABLE([jpeg],
589                 [  --disable-jpeg          Disable support for JPEG output when the png HID is used [[default=include JPEG support]]],
590                 [
591                 if test "X$enable_jpeg" != "Xno" ; then
592                         AC_MSG_RESULT([yes])
593                         with_jpeg=yes
594                 else
595                         AC_MSG_RESULT([no])
596                         with_jpeg=no
597                 fi
598                 ],
599                 [
600                 AC_MSG_RESULT([yes])
601                 with_jpeg=yes
602                 ])
603         if test "X$with_jpeg" = "Xyes" ; then
604                 AC_CHECK_FUNCS(gdImageJpeg)
605                 if test "$ac_cv_func_gdImageJpeg" != "yes"; then
606                         AC_MSG_ERROR([Your gd installation does not appear to include JPEG support.
607 You may need to update your installation of gd or disable
608 JPEG export with --disable-jpeg])
609                 fi
610         fi
613         AC_MSG_CHECKING([if PNG output from the png HID is desired])
614         AC_ARG_ENABLE([png],
615                 [  --disable-png           Disable support for PNG output when the png HID is used [[default=include PNG support]]],
616                 [
617                 if test "X$enable_png" != "Xno" ; then
618                         AC_MSG_RESULT([yes])
619                         with_png=yes
620                 else
621                         AC_MSG_RESULT([no])
622                         with_png=no
623                 fi
624                 ],
625                 [
626                 AC_MSG_RESULT([yes])
627                 with_png=yes
628                 ])
629         if test "X$with_png" = "Xyes" ; then
630                 AC_CHECK_FUNCS(gdImagePng)
631                 if test "$ac_cv_func_gdImagePng" != "yes"; then
632                         AC_MSG_ERROR([Your gd installation does not appear to include PNG support.
633 You may need to update your installation of gd or disable
634 PNG export with --disable-png])
635                 fi
636         fi
637         LIBS="$save_LIBS"
638         ;;
640     esac
641 done
644 AM_CONDITIONAL(PNG, test x$with_png = xyes)
645 AM_CONDITIONAL(GIF, test x$with_gif = xyes)
647 # ------------- check if png previews should be built for pcblib-newlib
648 AC_MSG_CHECKING([if the m4lib to newlib export should create png previews])
649 AC_ARG_ENABLE(
650         [m4lib-png],
651         [  --enable-m4lib-png      Enable creating png previews for the m4 library],
652         [],[enable_m4lib_png=no])
653 AC_MSG_RESULT([$enable_m4lib_png])
654 AM_CONDITIONAL(PNG_PREVIEW, test x$enable_m4lib_png = xyes)
656 if test "X$cross_compiling" = "Xyes" ; then
657         # we are cross compiling so we will need a build host binary for pcb
658         AC_PATH_PROG(PCB, [pcb], [notfound])
659 else
660         PCB="\${top_builddir}/src/pcb"
662 AC_SUBST(PCB)
664 # now make see how essential it was that we have a pcb executable for the build
665 # host
666 if test "X$USE_MAINTAINER_MODE" = "Xyes" ; then
667         if test "X$docs_yesno" = "Xyes" -o "X$enable_m4lib_png" = "Xyes" ; then
668                 if test "$PCB" = "notfound" ; then
669                         AC_MSG_ERROR([You have selected a maintainer mode build with m4lib png
670 previews enabled and/or with building the documentation enabled but you also
671 appear to be cross-compiling.  For this to work, you must have a pcb installed that
672 can run on this machine (the build machine) because it is needed for generating
673 library footprint png previews as well as some of the figures in the documentation.
674 If you wish to skip building the documentation and the footprint previews then add
675 --disable-doc --disable-m4lib-png
676 This will allow your cross build to work.])
677                 fi
678         fi
681 # ------------- Xrender -------------------
682 have_xrender=no
683 AC_CHECK_LIB(Xrender,XRenderQueryExtension,have_xrender=yes,have_xrender=no,$X_LIBS)
685 AC_ARG_ENABLE([xrender],
686 [  --disable-xrender       Compile and link with Xrender [default=yes]])
687 case "$have_xrender:$enable_xrender" in
688    no:* ) ;;
689    *:no ) ;;
690    * )
691      X_LIBS="-lXrender $X_LIBS"
692      AC_DEFINE([HAVE_XRENDER], 1,
693                 [Define to 1 if Xrender is available])
694      ;;
695 esac
697 # ------------- dmalloc -------------------
698 dnl dmalloc checks
699 with_dmalloc=no
700 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
701 AC_ARG_ENABLE([dmalloc],
702 [  --enable-dmalloc        Compile and link with dmalloc for malloc debugging [default=no]],
704 if test "X$enable_dmalloc" != "Xno" ; then
705         AC_MSG_RESULT([yes])
706         AC_CHECK_HEADER(dmalloc.h,,
707                 AC_MSG_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
708         AC_CHECK_LIB(dmalloc,main,,
709                 AC_MSG_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
710         DMALLOC_LIBS="-ldmalloc"
711         with_dmalloc=yes
712 else
713         AC_MSG_RESULT([no])
714         DMALLOC_LIBS=""
718         AC_MSG_RESULT([no])
719         DMALLOC_LIBS=""
722 # ------------- ElectricFence -------------------
723 dnl ElectricFence checks
724 with_efence=no
725 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
726 AC_ARG_ENABLE([efence],
727 [  --enable-efence         Link with ElectricFence for malloc debugging [default=no]],
729 if test "X$enable_efence" != "Xno" ; then
730         AC_MSG_RESULT([yes])
731         AC_CHECK_LIB(efence,main,,
732                 AC_MSG_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
733         with_efence=yes
734 else
735         AC_MSG_RESULT([no])
739 AC_MSG_RESULT([no])
742 # ------------- Enable Debug code -------------------
743 AC_MSG_CHECKING([for whether to enable debugging code])
744 AC_ARG_ENABLE([debug],
745 [  --enable-debug          Enable debugging code],
746 [],[enable_debug=no])
748 AC_MSG_RESULT([$enable_debug])
749 AM_CONDITIONAL(DEBUG_BUILD, test x$enable_debug = xyes)
752 # ------------- Complete set of CFLAGS and LIBS -------------------
754 CFLAGS="$CFLAGS $X_CFLAGS $DBUS_CFLAGS $GTK_CFLAGS"
755 LIBS="$LIBS $XM_LIBS $DBUS_LIBS $X_LIBS $GTK_LIBS $DMALLOC_LIBS $GD_LIBS $INTLLIBS"
758 # if we have gcc then add -Wall
759 if test "x$GCC" = "xyes"; then
760         # see about adding some extra checks if the compiler takes them
761         for flag in -Wall -Wdeclaration-after-statement ; do
762                 case " ${CFLAGS} " in
763                         *\ ${flag}\ *)
764                                 # flag is already present
765                                 ;;
766                         *)
767                                 AC_MSG_CHECKING([if the compiler accepts ${flag}])
768                                 ac_save_CFLAGS="$CFLAGS"
769                                 CFLAGS="$CFLAGS ${flag}"
770                                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
771                                         [AC_MSG_RESULT([yes])],
772                                         [AC_MSG_RESULT([no])
773                                          CFLAGS="$ac_save_CFLAGS"
774                                         ]
775                                 )
776                                 ;;
777                 esac
778         done
781 # font filename
782 FONTFILENAME=${FONTFILENAME:-"default_font"}
783 AC_SUBST(FONTFILENAME)
784 AC_DEFINE_UNQUOTED(FONTFILENAME,"$FONTFILENAME",[File for default font])
786 # standard autoconf variables
787 CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\""
788 CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\""
789 CPPFLAGS="$CPPFLAGS -DHOST=\\\"\${host}\\\""
791 # directory for old-style library and for fonts
792 PCBLIBDIR=${datadir}/pcb
793 AC_SUBST(PCBLIBDIR)
794 #AC_DEFINE_UNQUOTED(PCBLIBDIR,"$PCBLIBDIR",[Library directory])
795 CPPFLAGS="$CPPFLAGS -DPCBLIBDIR=\\\"$PCBLIBDIR\\\""
797 # name for old-style library
798 LIBRARYFILENAME=pcblib
799 AC_SUBST(LIBRARYFILENAME)
800 AC_DEFINE_UNQUOTED(LIBRARYFILENAME,"$LIBRARYFILENAME",[library file name])
803 # directory for new library
804 PCBTREEDIR=${datadir}/pcb/newlib
805 PCBTREEPATH=${PCBTREEDIR}:${PCBLIBDIR}/pcblib-newlib
806 PCBTREEDIR=${PCBTREEDIR:-"$PCBTREEDIR"}
807 AC_SUBST(PCBTREEDIR)
808 AC_SUBST(PCBTREEPATH)
809 #AC_DEFINE_UNQUOTED(PCBTREEDIR,"$PCBLIB",[top directory for new style pcb library])
810 CPPFLAGS="$CPPFLAGS -DPCBTREEDIR=\\\"$PCBTREEDIR\\\""
811 CPPFLAGS="$CPPFLAGS -DPCBTREEPATH=\\\"$PCBTREEPATH\\\""
813 # Figure out relative paths
814 AC_MSG_CHECKING([for the bindir to pcblibdir relative path])
815 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBLIBDIR:bindir_to_pcblibdir])
816 adl_NORMALIZE_PATH([bindir_to_pcblibdir], [$PCB_DIR_SEPARATOR_S])
817 AC_MSG_RESULT([$bindir_to_pcblibdir])
818 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBLIBDIR, "$bindir_to_pcblibdir", [Relative path from bindir to pcblibdir])
820 AC_MSG_CHECKING([for the bindir to pcbtreedir relative path])
821 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBTREEDIR:bindir_to_pcbtreedir])
822 adl_NORMALIZE_PATH([bindir_to_pcbtreedir], [$PCB_DIR_SEPARATOR_S])
823 AC_MSG_RESULT([$bindir_to_pcbtreedir])
824 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBTREEDIR, "$bindir_to_pcbtreedir", [Relative path from bindir to pcbtreedir])
827 AC_MSG_CHECKING([for the bindir to exec_prefix relative path])
828 adl_COMPUTE_RELATIVE_PATHS([bindir:exec_prefix:bindir_to_execprefix])
829 adl_NORMALIZE_PATH([bindir_to_execprefix], [$PCB_DIR_SEPARATOR_S])
830 AC_MSG_RESULT([$bindir_to_execprefix])
831 AC_DEFINE_UNQUOTED(BINDIR_TO_EXECPREFIX, "$bindir_to_execprefix", [Relative path from bindir to exec_prefix])
834 BTNMOD=${BTNMOD:-"Mod1"}
835 AC_SUBST(BTNMOD)
837 TOPDIRS=
838 for dir in src lib newlib doc example tools tutorial README_FILES
840    test -d $dir/. && TOPDIRS="$TOPDIRS $dir"
841 done
842 AC_SUBST(TOPDIRS)
844 AC_CONFIG_FILES(Makefile data/Makefile intl/Makefile po/Makefile.in)
846 if test -d $srcdir/README_FILES; then
847    AC_CONFIG_FILES(README_FILES/Makefile)
849 if test -d $srcdir/doc; then
850    AC_CONFIG_FILES(doc/Makefile)
851    AC_CONFIG_FILES(doc/gs/Makefile)
853 if test -d $srcdir/example; then
854    AC_CONFIG_FILES(example/Makefile)
855    AC_CONFIG_FILES(example/libraries/Makefile)
857 if test -d $srcdir/lib; then
858    AC_CONFIG_FILES(lib/CreateLibraryContents.sh)
859    AC_CONFIG_FILES(lib/CreateLibrary.sh)
860    AC_CONFIG_FILES(lib/ListLibraryContents.sh)
861    AC_CONFIG_FILES(lib/Makefile)
862    AC_CONFIG_FILES(lib/QueryLibrary.sh)
863    AC_CONFIG_FILES(lib/qfp-ui)
865 if test -d $srcdir/newlib; then
866    AC_CONFIG_FILES(newlib/2_pin_thru-hole_packages/Makefile)
867    AC_CONFIG_FILES(newlib/Makefile)
868    AC_CONFIG_FILES(newlib/connectors/Makefile)
869    AC_CONFIG_FILES(newlib/crystal/Makefile)
870    AC_CONFIG_FILES(newlib/electro-optics/Makefile)
871    AC_CONFIG_FILES(newlib/headers/Makefile)
872    AC_CONFIG_FILES(newlib/keystone/Makefile)
873    AC_CONFIG_FILES(newlib/msp430/Makefile)
874    AC_CONFIG_FILES(newlib/not_vetted_ingo/Makefile)
875    AC_CONFIG_FILES(newlib/sockets/Makefile)
876    AC_CONFIG_FILES(newlib/tests/Makefile)
878 AC_CONFIG_FILES(src/Makefile)
879 AC_CONFIG_FILES(src/icons/Makefile)
880 if test -d $srcdir/tools; then
881    AC_CONFIG_FILES(tools/Makefile)
883 if test -d $srcdir/tutorial; then
884    AC_CONFIG_FILES(tutorial/Makefile)
887 AC_CONFIG_FILES(win32/Makefile)
889 AC_OUTPUT
891 with_gui=`echo $with_gui`
892 with_printer=`echo $with_printer`
893 with_exporters=`echo $with_exporters | sed 's/,/ /g'`
895 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
896 expandedKDEDATADIR=`eval "echo $KDEDATADIR"`
898 AC_MSG_RESULT([
899 ** Configuration summary for $PACKAGE $VERSION:
901    GUI:                      $with_gui
902    Printer:                  $with_printer
903    Exporters:                $with_exporters
904    Build documentation:      $docs_yesno
905    xdg data directory:       $expandedXDGDATADIR
906    KDE data directory:       $expandedKDEDATADIR
907    dmalloc debugging:        $with_dmalloc
908    ElectricFence debugging:  $with_efence
910    Cross Compiling:          $cross_compiling
911    CC:                       $CC
912    CPPFLAGS:                 $CPPFLAGS
913    CFLAGS:                   $CFLAGS
914    LIBS:                     $LIBS
915    PCB:                      $PCB