Fix data/Makefile.am where xdgdir was used instead of xdgdatadir
[geda-pcb/gde.git] / configure.ac
blob85162dfb05eca2bc5302cdc66cd57dabdc244ac0
1 dnl $Id$
2 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT([pcb], [1.99w])
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 # i18n
54 GETTEXT_PACKAGE=$PACKAGE
55 AC_SUBST(GETTEXT_PACKAGE)
57 AM_GNU_GETTEXT_VERSION([0.14])
58 AM_GNU_GETTEXT
59 IT_PROG_INTLTOOL([0.35.0])
61 AC_C_INLINE
62 AC_PROG_CC_STDC
63 AM_PROG_CC_C_O
64 AC_PROG_CPP
65 AC_PROG_AWK
67 AM_PROG_LEX
68 AC_PATH_PROG(LEX_PATH, $LEX, [notfound])
69 if test "$LEX_PATH" = "notfound" ; then
70         AC_MSG_ERROR([Couldn't find a usable lex program.
71 Please install flex which is available from
72 ftp://ftp.gnu.org/pub/non-gnu/flex/
77 AC_PROG_YACC
78 AC_PATH_PROG(YACC_PATH, $YACC, [notfound])
79 if test "$YACC_PATH" = "notfound" ; then
80         AC_MSG_ERROR([Couldn't find a usable yacc program.
81 Please install bison which is available from
82 ftp://ftp.gnu.org/pub/gnu/bison/
86 AC_PROG_INSTALL
87 AC_PROG_RANLIB
90 # Used for building the win32 icons.
92 AC_PATH_PROG(TGIF, tgif, notfound)
93 AM_CONDITIONAL(MISSING_TGIF, test x$TGIF = xnotfound)
94 AC_PATH_PROG(XPMTOPPM, xpmtoppm, notfound)
95 AC_PATH_PROG(PPMTOWINICON, ppmtowinicon, notfound)
96 AM_CONDITIONAL(MISSING_XPMTOPPM, test x$PPMTOWINICON = xnotfound -o x$XPMTOPPM = xnotfound)
97 AC_PATH_PROG(CONVERT, convert, notfound)
98 AM_CONDITIONAL(MISSING_CONVERT, test x$CONVERT = xnotfound)
100 docs_yesno=yes
102 AC_MSG_CHECKING([if the documentation should be built])
103 AC_ARG_ENABLE([doc],
104 [  --enable-doc            Build and install the documentation [[default=yes]]],
106 if test "X$enable_doc" = "Xno" ; then
107         DOC=""
108         AC_MSG_RESULT([no])
109         docs_yesno=no
110 else
111         DOC=doc
112         AC_MSG_RESULT([yes])
113         docs_yesno=yes
117 DOC=doc
118 AC_MSG_RESULT([yes])
119 docs_yesno=yes
121 AC_SUBST(DOC)
123 if test "X$docs_yesno" = "Xyes" -a "X$USE_MAINTAINER_MODE" = "Xyes" ; then
124    AC_CHECK_PROGS(MKINFO, makeinfo, no)
125    if test "X$MKINFO" != "Xno"; then
126       AC_MSG_CHECKING([for GNU makeinfo version >= 4.6])
127       v=`$MKINFO --version | grep "GNU texinfo"`
128       if test $? -ne 0; then
129          AC_MSG_RESULT([non-GNU])
130          MKINFO="no"
131       fi
132    fi
133    if test "X$MKINFO" != "Xno"; then
134       vmajor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\1/'`
135       vminor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
136       AC_MSG_RESULT([$vmajor.$vminor])
137       if test "$vmajor" -lt 4 \
138               || (test "$vmajor" -eq 4 && test "$vminor" -lt 6); then
139          MKINFO=no
140       fi
141    fi
142    if test "X$MKINFO" = "Xno"; then
143       AC_MSG_ERROR([You have requested a maintainer-mode build and a build
144 of the documentation.  For this to work, you must have version 4.6 or newer of
145 the GNU texinfo package.  You seem to have
150    fi
152    AC_CHECK_PROGS(TEXI2DVI, texi2dvi, no)
153    if test "X$TEXI2DVI" = "Xno"; then
154       AC_MSG_ERROR([You have requested a maintainer-mode build and a build
155 of the documentation.  For this to work, you must have the texi2dvi program
156 installed.])
157    fi
160         AC_PATH_PROG(PERL, perl, notfound)
161         if test "X$PERL" = "Xnotfound"; then
162                         AC_MSG_ERROR([You have requested a maintainer-mode build and a build
163 of the documentation.  For this to work, you must have perl installed.
165         fi
168 # FIXME:  for now, only try to add -rdynamic if we're using gcc.  We really
169 # need to figure out what the correct test is here.  In the mean time, this
170 # should let things build with SunPRO again.
171 if test "x$GCC" = "xyes"; then
172 AC_MSG_CHECKING([If the compiler accepts -rdynamic])
173 old_LDFLAGS="$LDFLAGS"
174 LDFLAGS="$LDFLAGS -rdynamic"
175 AC_LINK_IFELSE([int main(){}],
176         [AC_MSG_RESULT([yes])],
177         [LDFLAGS="$old_LDFLAGS"
178         AC_MSG_RESULT([no])
179         ])
182 # ------------- HID config -------------------
184 hid_guis=""
185 hid_printers=""
186 hid_exporters=""
187 hid_always=""
189 for hid in `cd $srcdir/src/hid; echo *`; do
190     F=$srcdir/src/hid/$hid/hid.conf
191     if test -f $F 
192     then
193     echo checking $F
194         . $F
195         case $type in
196           gui ) hid_guis="$hid_guis $hid" ;;
197           printer ) hid_printers="$hid_printers $hid" ;;
198           export ) hid_exporters="$hid_exporters $hid" ;;
199           always ) hid_always="$hid_always $hid" ;;
200         esac
201     fi
202 done
204 AC_MSG_CHECKING([for which gui to use])
205 AC_ARG_WITH([gui],
206 [  --with-gui=            Specify the GUI to use: batch gtk lesstif [[default=gtk]]],
208 [with_gui=gtk]
210 AC_MSG_RESULT([$with_gui])
211 case " $hid_guis no none " in
212      *\ $with_gui\ * ) HIDLIST="$with_gui" ;;
213      * ) AC_MSG_ERROR([$with_gui is not a valid gui]) ;;
214 esac
216 if test x"$with_gui" = x"none" -o x"$with_gui" = x"no"
217 then
218     HIDLIST=
221 AC_MSG_CHECKING([for whether to use DBUS])
222 AC_ARG_ENABLE([dbus],
223 [  --enable-dbus           Enable DBUS IPC],
224 [],[enable_dbus=no])
226 AC_MSG_RESULT([$enable_dbus])
227 AM_CONDITIONAL(WITH_DBUS, test x$enable_dbus = xyes)
229 if test "x$enable_dbus" = "xyes"; then
230         case " $with_gui " in
231                 *\ gtk\ *) ;;
232                 *\ lesstif\ *) ;;
233                 * ) AC_MSG_ERROR([DBUS enabled but only works with a mainloop capable GUI HID.
234 Either do not use --enable-dbus or enable the gtk or lesstif GUI HID.])
235         esac
236         
237         # Check for pkg-config
238         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
239         if test "$PKG_CONFIG" = "no"; then
240                 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
241         fi
243         PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.61,
244                 [saved_LIBS="$LIBS"
245                  LIBS="$LIBS $DBUS_LIBS"
246                  AC_CHECK_FUNCS(dbus_watch_get_unix_fd)
247                  LIBS="$saved_LIBS" ],
248                 [AC_MSG_ERROR([Cannot find dbus-1 >= 0.61, install it and rerun ./configure
249 Please review the following errors:
250 $DBUS_PKG_ERRORS])]
251         )
252         DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
253         
254         AC_DEFINE([HAVE_DBUS], 1,
255                 [Define to 1 if DBUS IPC is to be compiled in])
259 AC_MSG_CHECKING([for which printer to use])
260 AC_ARG_WITH([printer],
261 [  --with-printer=        Specify the printer: lpr [[default=lpr]]],
262 [],[with_printer=lpr])
263 AC_MSG_RESULT([$with_printer])
264 case " $hid_printers " in
265      *\ $with_printer\ * )
266          HIDLIST="$HIDLIST $with_printer"
267          ;;
268      * ) AC_MSG_ERROR([$with_printer is not a valid printer]) ;;
269 esac
271 AC_MSG_CHECKING([for which exporters to use])
272 AC_ARG_WITH([exporters],
273 [  --with-exporters=       Enable export devices: bom gerber nelma png ps [[default=bom gerber nelma png ps]]],
274 [],[with_exporters=$hid_exporters])
275 AC_MSG_RESULT([$with_exporters])
276 for e in `echo $with_exporters | sed 's/,/ /g'`; do
277     case " $hid_exporters " in
278       *\ $e\ * )
279          HIDLIST="$HIDLIST $e"
280          ;;
281       * ) AC_MSG_ERROR([$e is not a valid exporter]) ;;
282     esac
283 done
285 if test "X$enable_jpeg" = "Xno" -a "X$enable_gif" = "Xno" -a "X$enable_png" = "Xno" ; then
286         case " ${HIDLIST} " in
287                 *\ png\ *)
288                         AC_MSG_ERROR([you have requested the png HID but turned off all output
289 formats!  If you do not want gif/jpeg/png output, use --with-exporters to list
290 which exporters you want and do not list png there.])
291                         ;;
293                 *)
294                         ;;
295         esac
298 for e in $HIDLIST; do
299     HIDLIBS="$HIDLIBS lib$e.a"
300 done
302 AC_SUBST(HIDLIST)
303 AC_SUBST(HIDLIBS)
305 # ------------- end HID config -------------------
307 ######################################################################
309 # desktop integration
312 # Change default location for XDG files (MIME and Icons)
313 AC_ARG_WITH(xdgdatadir, [  --with-xdgdatadir=path  Change where the theme icons 
314 and mime registrations are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
316 # Change default location for KDE data files (KDE MIME registrations)
317 AC_ARG_WITH(kdedatadir, [  --with-kdedatadir=path  Change where the KDE mime reg
318 istrations are installed [[DATADIR]]], [opt_kdedatadir=$withval])
320 if test x$opt_xdgdatadir = x; then
321         # path was not specified with --with-xdgdatadir
322         XDGDATADIR='${datadir}'
323 else
324         # path WAS specified with --with-xdgdatadir
325         XDGDATADIR="$opt_xdgdatadir"
327 AC_SUBST(XDGDATADIR)
329 if test x$opt_kdedatadir = x; then
330         # path was not specified with --with-kdedatadir
331         KDEDATADIR='${datadir}'
332 else
333         # path WAS specified with --with-kdedatadir
334         KDEDATADIR="$opt_kdedatadir"
336 AC_SUBST(KDEDATADIR)
338 AC_ARG_ENABLE(update-desktop-database,
339         AC_HELP_STRING([--disable-update-desktop-database],
340         [do not update desktop database after installation]),,
341         enable_update_desktop_database=yes)
343 AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE, test x$enable_update_desktop_database = xyes)
345 if test x$enable_update_desktop_database = xyes ; then
346         AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
347         if test $UPDATE_DESKTOP_DATABASE = no; then
348         AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
349         fi
352 AC_ARG_ENABLE(update-mime-database,
353         AC_HELP_STRING([--disable-update-mime-database],
354         [do not update mime database after installation]),,
355         enable_update_mime_database=yes)
357 AM_CONDITIONAL(ENABLE_UPDATE_MIME_DATABASE, test x$enable_update_mime_database = xyes)
359 if test x$enable_update_mime_database = xyes ; then
360         AC_PATH_PROG(UPDATE_MIME_DATABASE, [update-mime-database], no)
361         if test $UPDATE_MIME_DATABASE = no; then
362         AC_MSG_ERROR([Cannot find update-mime-database, make sure it is installed and in your PATH, or configure with --disable-update-mime-database])
363         fi
367 ######################################################################
369 AC_PATH_PROGS(M4, gm4 m4, [none])
370 if test "X$M4" = "Xnone" ; then
371         AC_MSG_ERROR([Did not find a m4 executible.  You need to make sure
372         that m4 is installed on your system and that m4 is in your path])
374 AC_MSG_CHECKING([if $M4 has the division involving negative numbers bug])
375 pcb_m4_r=`echo "eval(-2/2)" | $M4`
376 if test "$pcb_m4_r" != "-1" ; then
377         AC_MSG_RESULT([yes])
378         AC_MSG_ERROR([It appears that $M4 has a bug involving division
379 with negative numbers.  In particular it just returned the result that
380 -2/2 = $pcb_m4_r instead of -1.  This is a known bug in GNU m4-1.4.9.  Please
381 install a non-broken m4.])
382 else
383         AC_MSG_RESULT([no])
387 AC_PATH_PROGS(WISH, wish wish83 wish8.3 wish80 wish8.0 cygwish83 cygwish80,[none])
388 if test "X$WISH" = "Xnone" ; then
389         AC_MSG_ERROR([Did not find the wish executible.  You need to make sure
390         that tcl is installed on your system and that wish is in your path])
393 AC_DEFINE_UNQUOTED(M4,$M4,[m4 executible])
394 GNUM4=$M4
395 AC_SUBST(GNUM4)
396 AC_DEFINE_UNQUOTED(GNUM4,"$M4",[m4 program used by pcb])
398 AC_CHECK_PROGS(LATEX, latex, notfound)
399 AM_CONDITIONAL(MISSING_LATEX, test x$LATEX = xnotfound)
401 AC_CHECK_PROGS(PDFLATEX, pdflatex, notfound)
402 AM_CONDITIONAL(MISSING_PDFLATEX, test x$PDFLATEX = xnotfound)
404 AC_CHECK_PROGS(DVIPS, dvips, notfound)
405 AM_CONDITIONAL(MISSING_DVIPS, test x$DVIPS = xnotfound)
407 AC_CHECK_PROGS(PS2PDF, ps2pdf, notfound)
408 AM_CONDITIONAL(MISSING_PS2PDF, test x$PS2PDF = xnotfound)
410 dnl Checks for libraries.
411 AC_CHECK_LIB(m, sqrt)
412 AC_CHECK_LIB(dl, dlopen)
413 AC_CHECK_LIB(xnet, gethostbyname)
414 AC_CHECK_LIB(fl, yywrap)
415 AC_CHECK_FUNCS(strerror)
416 AC_CHECK_FUNCS(regcomp re_comp)
417 AC_CHECK_FUNCS(logf expf rint)
418 AC_CHECK_FUNCS(vsnprintf)
419 AC_CHECK_FUNCS(getpwuid gethostname getcwd)
420 AC_CHECK_FUNCS(random)
421 AC_CHECK_FUNCS(stat)
423 # normally used for all file i/o
424 AC_CHECK_FUNCS(popen)
426 # for lrealpath.c
427 AC_CHECK_FUNCS(realpath canonicalize_file_name)
428 libiberty_NEED_DECLARATION(canonicalize_file_name)
430 AC_HEADER_STDC
431 AC_CHECK_HEADERS(limits.h string.h sys/types.h regex.h pwd.h)
432 AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h sys/param.h sys/times.h)
433 AC_CHECK_HEADERS(dlfcn.h)
435 if test "x${WIN32}" = "xyes" ; then
436         AC_CHECK_HEADERS(windows.h)
439 for e in $HIDLIST; do
440     case $e in
441       lesstif )
442         AC_PATH_XTRA
443         CPPFLAGS="$CFLAGS $X_CFLAGS"
444         AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS)
445         AC_CHECK_LIB(ICE, main, , , $X_LIBS)
446         AC_CHECK_LIB(SM, main, , , $X_LIBS)
447         AC_CHECK_LIB(Xext, main, , , $X_LIBS)
448         AC_CHECK_LIB(Xt, XtOpenDisplay, , , $X_LIBS)
449         AC_CHECK_LIB(Xmu, main, , , $X_LIBS)
450         AC_CHECK_LIB(Xpm, main, , , $X_LIBS)
451         AC_CHECK_LIB(Xm, XmCreateMainWindow, , , $X_LIBS)
452         case $ac_cv_lib_Xm_XmCreateMainWindow in
453           no )
454             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
455             ;;
456           * ) ;;
457         esac
458         AC_CHECK_HEADERS(Xm/Xm.h)
459         case $ac_cv_header_Xm_Xm_h in
460           no )
461             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
462             ;;
463           * ) ;;
464         esac
465         ;;
467       gtk )
468         # Check for pkg-config
469         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
470         if test "$PKG_CONFIG" = "no"; then
471                 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
472         fi
474         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0, , 
475                 [AC_MSG_ERROR([Cannot find gtk+ >= 2.4.0, install it and rerun ./configure
476 Please review the following errors:
477 $GTK_PKG_ERRORS])]
478         )
479         GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
480         
481         # if we are building for gtk >= 2.8.0, we can use gdk_display_warp_pointer()
482         # otherwise we need XWarpPointer and we'll pull in the required headers with
483         # gdk/gdkx.h and we'll need to link with X11
484         if ! $PKG_CONFIG gtk+-2.0 --atleast-version=2.8.0 ; then
485                 CPPFLAGS="$CFLAGS $GTK_CFLAGS"
486                 AC_CHECK_HEADERS([gdk/gdkx.h])
487         fi
489         # Search for glib
490         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.4.0, , 
491                 [AC_MSG_ERROR([Cannot find glib >= 2.4.0, install it and rerun ./configure.
492 Please review the following errors:
493 $GLIB_PKG_ERRORS])]
494         )
495         GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
496         ;;
498       nelma|png )
499         # Check for gdlib-config for gd (www.boutell.com/gd)
500         AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, no)
501         if test "$GDLIB_CONFIG" = "no"; then
502                 AC_MSG_RESULT([Cannot find gdlib-config.
503 Make sure it is installed and in your PATH.
504 gdlib-config is part of the GD library available from www.boutell.com/gd.
505 This is needed for the png HID.  I will look for libgd anyway and maybe
506 you will get lucky.
508                 if test "$WIN32" != "yes" ; then
509                         AC_CHECK_LIB(gd,main,,
510                         AC_MSG_ERROR([You have requested the nelma and/or png HID  but -lgd could not be found]))
511                 else 
512                         AC_CHECK_LIB(bgd,main,,
513                         AC_MSG_ERROR([You have requested the nelma and/or png HID  but -lbgd could not be found]))
514                 fi
515         else
516                 if test "$WIN32" = "yes" ; then
517                         GD=bgd
518                 else
519                         GD=gd
520                 fi
521                 AC_MSG_CHECKING([for libgd cflags])
522                 GD_CFLAGS="`$GDLIB_CONFIG --cflags`"
523                 AC_MSG_RESULT([$GD_CFLAGS])
524                 AC_MSG_CHECKING([for libgd libs])
525                 GD_LIBS="`$GDLIB_CONFIG --ldflags` `$GDLIB_CONFIG --libs` -l${GD}"
526                 AC_MSG_RESULT([$GD_LIBS])
527         fi
528    
529         # since some linux systems evidently install gdlib-config but fail to
530         # install the headers (nice), check for the header too and fail if it
531         # is not there.
532         CFLAGS="$CFLAGS $GD_CFLAGS"
533         CPPFLAGS="$CPPFLAGS $GD_CFLAGS"
534         AC_CHECK_HEADERS(gd.h)
535         case $ac_cv_header_gd_h in
536              no )
537                 AC_MSG_ERROR([
538 You evidentally do not have a complete installation of the GD library available from www.boutell.com/gd.
539 This is needed for the nelma and/or png HID.
541                 ;;
542              * ) ;;
543         esac
544         
545         # Some versions of gd (prior to the expiration of the
546         # patent related to gif compression) do not support
547         # gif output.  Check for that here.
548         save_LIBS="$LIBS"
549         LIBS="$save_LIBS $GD_LIBS $X_LIBS"
551         AC_MSG_CHECKING([if GIF output from the png HID is desired])
552         AC_ARG_ENABLE([gif],
553                 [  --disable-gif           Disable support for gif output when the png HID is used [[default=include gif support]]],
554                 [
555                 if test "X$enable_gif" != "Xno" ; then
556                         AC_MSG_RESULT([yes])
557                         with_gif=yes
558                 else
559                         AC_MSG_RESULT([no])
560                         with_gif=no
561                 fi
562                 ],
563                 [
564                 AC_MSG_RESULT([yes])
565                 with_gif=yes
566                 ])
567         if test "X$with_gif" = "Xyes" ; then
568                 AC_CHECK_FUNCS(gdImageGif)
569                 if test "$ac_cv_func_gdImageGif" != "yes"; then
570                         AC_MSG_ERROR([Your gd installation does not appear to include gif support.
571 You may need to update your installation of gd or disable
572 gif export with --disable-gif])
573                 fi
574         fi
576         AC_MSG_CHECKING([if JPEG output from the png HID is desired])
577         AC_ARG_ENABLE([jpeg],
578                 [  --disable-jpeg          Disable support for JPEG output when the png HID is used [[default=include JPEG support]]],
579                 [
580                 if test "X$enable_jpeg" != "Xno" ; then
581                         AC_MSG_RESULT([yes])
582                         with_jpeg=yes
583                 else
584                         AC_MSG_RESULT([no])
585                         with_jpeg=no
586                 fi
587                 ],
588                 [
589                 AC_MSG_RESULT([yes])
590                 with_jpeg=yes
591                 ])
592         if test "X$with_jpeg" = "Xyes" ; then
593                 AC_CHECK_FUNCS(gdImageJpeg)
594                 if test "$ac_cv_func_gdImageJpeg" != "yes"; then
595                         AC_MSG_ERROR([Your gd installation does not appear to include JPEG support.
596 You may need to update your installation of gd or disable
597 JPEG export with --disable-jpeg])
598                 fi
599         fi
602         AC_MSG_CHECKING([if PNG output from the png HID is desired])
603         AC_ARG_ENABLE([png],
604                 [  --disable-png           Disable support for PNG output when the png HID is used [[default=include PNG support]]],
605                 [
606                 if test "X$enable_png" != "Xno" ; then
607                         AC_MSG_RESULT([yes])
608                         with_png=yes
609                 else
610                         AC_MSG_RESULT([no])
611                         with_png=no
612                 fi
613                 ],
614                 [
615                 AC_MSG_RESULT([yes])
616                 with_png=yes
617                 ])
618         if test "X$with_png" = "Xyes" ; then
619                 AC_CHECK_FUNCS(gdImagePng)
620                 if test "$ac_cv_func_gdImagePng" != "yes"; then
621                         AC_MSG_ERROR([Your gd installation does not appear to include PNG support.
622 You may need to update your installation of gd or disable
623 PNG export with --disable-png])
624                 fi
625         fi
626         LIBS="$save_LIBS"
627         ;;
629     esac
630 done
633 AM_CONDITIONAL(PNG, test x$with_png = xyes)
634 AM_CONDITIONAL(GIF, test x$with_gif = xyes)
637 # ------------- Xrender -------------------
638 have_xrender=no
639 AC_CHECK_LIB(Xrender,XRenderQueryExtension,have_xrender=yes,have_xrender=no,$X_LIBS)
641 AC_ARG_ENABLE([xrender],
642 [  --disable-xrender        Compile and link with Xrender [default=yes]])
643 case "$have_xrender:$enable_xrender" in
644    no:* ) ;;
645    *:no ) ;;
646    * )
647      X_LIBS="-lXrender $X_LIBS"
648      AC_DEFINE([HAVE_XRENDER], 1,
649                 [Define to 1 if Xrender is available])
650      ;;
651 esac
653 # ------------- dmalloc -------------------
654 dnl dmalloc checks
655 with_dmalloc=no
656 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
657 AC_ARG_ENABLE([dmalloc],
658 [  --enable-dmalloc        Compile and link with dmalloc for malloc debugging [default=no]],
660 if test "X$enable_dmalloc" != "Xno" ; then
661         AC_MSG_RESULT([yes])
662         AC_CHECK_HEADER(dmalloc.h,,
663                 AC_MSG_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
664         AC_CHECK_LIB(dmalloc,main,,
665                 AC_MSG_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
666         DMALLOC_LIBS="-ldmalloc"
667         with_dmalloc=yes
668 else
669         AC_MSG_RESULT([no])
670         DMALLOC_LIBS=""
674         AC_MSG_RESULT([no])
675         DMALLOC_LIBS=""
678 # ------------- ElectricFence -------------------
679 dnl ElectricFence checks
680 with_efence=no
681 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
682 AC_ARG_ENABLE([efence],
683 [  --enable-efence         Link with ElectricFence for malloc debugging [default=no]],
685 if test "X$enable_efence" != "Xno" ; then
686         AC_MSG_RESULT([yes])
687         AC_CHECK_LIB(efence,main,,
688                 AC_MSG_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
689         with_efence=yes
690 else
691         AC_MSG_RESULT([no])
695 AC_MSG_RESULT([no])
698 CFLAGS="$CFLAGS $X_CFLAGS $DBUS_CFLAGS $GTK_CFLAGS"
699 LIBS="$LIBS $XM_LIBS $DBUS_LIBS $X_LIBS $GTK_LIBS $DMALLOC_LIBS $GD_LIBS"
702 # if we have gcc then add -Wall
703 if test "x$GCC" = "xyes"; then
704         if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
705                 CFLAGS="$CFLAGS -Wall"
706         fi
710 # font filename
711 FONTFILENAME=${FONTFILENAME:-"default_font"}
712 AC_SUBST(FONTFILENAME)
713 AC_DEFINE_UNQUOTED(FONTFILENAME,"$FONTFILENAME",[File for default font])
715 # standard autoconf variables
716 CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\""
717 CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\""
718 CPPFLAGS="$CPPFLAGS -DHOST=\\\"\${host}\\\""
720 # directory for old-style library and for fonts
721 PCBLIBDIR=${datadir}/pcb
722 AC_SUBST(PCBLIBDIR)
723 #AC_DEFINE_UNQUOTED(PCBLIBDIR,"$PCBLIBDIR",[Library directory])
724 CPPFLAGS="$CPPFLAGS -DPCBLIBDIR=\\\"$PCBLIBDIR\\\""
726 # name for old-style library
727 LIBRARYFILENAME=pcblib
728 AC_SUBST(LIBRARYFILENAME)
729 AC_DEFINE_UNQUOTED(LIBRARYFILENAME,"$LIBRARYFILENAME",[library file name])
732 # directory for new library
733 PCBTREEDIR=${datadir}/pcb/newlib
734 PCBTREEPATH=${PCBTREEDIR}:${PCBLIBDIR}/pcblib-newlib
735 PCBTREEDIR=${PCBTREEDIR:-"$PCBTREEDIR"}
736 AC_SUBST(PCBTREEDIR)
737 AC_SUBST(PCBTREEPATH)
738 #AC_DEFINE_UNQUOTED(PCBTREEDIR,"$PCBLIB",[top directory for new style pcb library])
739 CPPFLAGS="$CPPFLAGS -DPCBTREEDIR=\\\"$PCBTREEDIR\\\""
740 CPPFLAGS="$CPPFLAGS -DPCBTREEPATH=\\\"$PCBTREEPATH\\\""
742 # Figure out relative paths
743 AC_MSG_CHECKING([for the bindir to pcblibdir relative path])
744 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBLIBDIR:bindir_to_pcblibdir])
745 adl_NORMALIZE_PATH([bindir_to_pcblibdir], [$PCB_DIR_SEPARATOR_S])
746 AC_MSG_RESULT([$bindir_to_pcblibdir])
747 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBLIBDIR, "$bindir_to_pcblibdir", [Relative path from bindir to pcblibdir])
749 AC_MSG_CHECKING([for the bindir to pcbtreedir relative path])
750 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBTREEDIR:bindir_to_pcbtreedir])
751 adl_NORMALIZE_PATH([bindir_to_pcbtreedir], [$PCB_DIR_SEPARATOR_S])
752 AC_MSG_RESULT([$bindir_to_pcbtreedir])
753 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBTREEDIR, "$bindir_to_pcbtreedir", [Relative path from bindir to pcbtreedir])
756 AC_MSG_CHECKING([for the bindir to exec_prefix relative path])
757 adl_COMPUTE_RELATIVE_PATHS([bindir:exec_prefix:bindir_to_execprefix])
758 adl_NORMALIZE_PATH([bindir_to_execprefix], [$PCB_DIR_SEPARATOR_S])
759 AC_MSG_RESULT([$bindir_to_execprefix])
760 AC_DEFINE_UNQUOTED(BINDIR_TO_EXECPREFIX, "$bindir_to_execprefix", [Relative path from bindir to exec_prefix])
763 BTNMOD=${BTNMOD:-"Mod1"}
764 AC_SUBST(BTNMOD)
766 TOPDIRS=
767 for dir in src lib newlib doc example tools tutorial README_FILES
769    test -d $dir/. && TOPDIRS="$TOPDIRS $dir"
770 done
771 AC_SUBST(TOPDIRS)
773 AC_CONFIG_FILES(Makefile data/Makefile intl/Makefile po/Makefile.in)
775 if test -d $srcdir/README_FILES; then
776    AC_CONFIG_FILES(README_FILES/Makefile)
778 if test -d $srcdir/doc; then
779    AC_CONFIG_FILES(doc/Makefile)
781 if test -d $srcdir/example; then
782    AC_CONFIG_FILES(example/Makefile)
783    AC_CONFIG_FILES(example/libraries/Makefile)
785 if test -d $srcdir/lib; then
786    AC_CONFIG_FILES(lib/CreateLibraryContents.sh)
787    AC_CONFIG_FILES(lib/CreateLibrary.sh)
788    AC_CONFIG_FILES(lib/ListLibraryContents.sh)
789    AC_CONFIG_FILES(lib/Makefile)
790    AC_CONFIG_FILES(lib/QueryLibrary.sh)
791    AC_CONFIG_FILES(lib/m4lib_to_newlib.sh)
792    AC_CONFIG_FILES(lib/qfp-ui)
794 if test -d $srcdir/newlib; then
795    AC_CONFIG_FILES(newlib/2_pin_thru-hole_packages/Makefile)
796    AC_CONFIG_FILES(newlib/Makefile)
797    AC_CONFIG_FILES(newlib/analog-devices/Makefile)
798    AC_CONFIG_FILES(newlib/burr-brown/Makefile)
799    AC_CONFIG_FILES(newlib/connectors/Makefile)
800    AC_CONFIG_FILES(newlib/crystal/Makefile)
801    AC_CONFIG_FILES(newlib/electro-optics/Makefile)
802    AC_CONFIG_FILES(newlib/headers/Makefile)
803    AC_CONFIG_FILES(newlib/keystone/Makefile)
804    AC_CONFIG_FILES(newlib/msp430/Makefile)
805    AC_CONFIG_FILES(newlib/not_vetted_ingo/Makefile)
806    AC_CONFIG_FILES(newlib/sockets/Makefile)
807    AC_CONFIG_FILES(newlib/tests/Makefile)
809 AC_CONFIG_FILES(src/Makefile)
810 AC_CONFIG_FILES(src/icons/Makefile)
811 if test -d $srcdir/tools; then
812    AC_CONFIG_FILES(tools/Makefile)
814 if test -d $srcdir/tutorial; then
815    AC_CONFIG_FILES(tutorial/Makefile)
818 AC_CONFIG_FILES(win32/Makefile)
820 AC_OUTPUT
822 with_gui=`echo $with_gui`
823 with_printer=`echo $with_printer`
824 with_exporters=`echo $with_exporters | sed 's/,/ /g'`
826 expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
827 expandedKDEDATADIR=`eval "echo $KDEDATADIR"`
829 AC_MSG_RESULT([
830 ** Configuration summary for $PACKAGE $VERSION:
832    GUI:                      $with_gui
833    Printer:                  $with_printer
834    Exporters:                $with_exporters
835    Build documentation:      $docs_yesno
836    xdg data directory:       $expandedXDGDATADIR
837    KDE data directory:       $expandedKDEDATADIR
838    dmalloc debugging:        $with_dmalloc
839    ElectricFence debugging:  $with_efence
840    CPPFLAGS:                 $CPPFLAGS
841    CFLAGS:                   $CFLAGS
842    LIBS:                     $LIBS