Ensure GETTEXT_PACKAGE is set, and add missing LINGUAS and POTFILES.in files.
[geda-pcb/gde.git] / configure.ac
blobe7bab7bdfe0d8a132bdf891bf00844edb504e1d3
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 AC_PATH_PROGS(M4, gm4 m4, [none])
308 if test "X$M4" = "Xnone" ; then
309         AC_MSG_ERROR([Did not find a m4 executible.  You need to make sure
310         that m4 is installed on your system and that m4 is in your path])
312 AC_MSG_CHECKING([if $M4 has the division involving negative numbers bug])
313 pcb_m4_r=`echo "eval(-2/2)" | $M4`
314 if test "$pcb_m4_r" != "-1" ; then
315         AC_MSG_RESULT([yes])
316         AC_MSG_ERROR([It appears that $M4 has a bug involving division
317 with negative numbers.  In particular it just returned the result that
318 -2/2 = $pcb_m4_r instead of -1.  This is a known bug in GNU m4-1.4.9.  Please
319 install a non-broken m4.])
320 else
321         AC_MSG_RESULT([no])
325 AC_PATH_PROGS(WISH, wish wish83 wish8.3 wish80 wish8.0 cygwish83 cygwish80,[none])
326 if test "X$WISH" = "Xnone" ; then
327         AC_MSG_ERROR([Did not find the wish executible.  You need to make sure
328         that tcl is installed on your system and that wish is in your path])
331 AC_DEFINE_UNQUOTED(M4,$M4,[m4 executible])
332 GNUM4=$M4
333 AC_SUBST(GNUM4)
334 AC_DEFINE_UNQUOTED(GNUM4,"$M4",[m4 program used by pcb])
336 AC_CHECK_PROGS(LATEX, latex, notfound)
337 AM_CONDITIONAL(MISSING_LATEX, test x$LATEX = xnotfound)
339 AC_CHECK_PROGS(PDFLATEX, pdflatex, notfound)
340 AM_CONDITIONAL(MISSING_PDFLATEX, test x$PDFLATEX = xnotfound)
342 AC_CHECK_PROGS(DVIPS, dvips, notfound)
343 AM_CONDITIONAL(MISSING_DVIPS, test x$DVIPS = xnotfound)
345 AC_CHECK_PROGS(PS2PDF, ps2pdf, notfound)
346 AM_CONDITIONAL(MISSING_PS2PDF, test x$PS2PDF = xnotfound)
348 dnl Checks for libraries.
349 AC_CHECK_LIB(m, sqrt)
350 AC_CHECK_LIB(dl, dlopen)
351 AC_CHECK_LIB(xnet, gethostbyname)
352 AC_CHECK_LIB(fl, yywrap)
353 AC_CHECK_FUNCS(strerror)
354 AC_CHECK_FUNCS(regcomp re_comp)
355 AC_CHECK_FUNCS(logf expf rint)
356 AC_CHECK_FUNCS(vsnprintf)
357 AC_CHECK_FUNCS(getpwuid gethostname getcwd)
358 AC_CHECK_FUNCS(random)
359 AC_CHECK_FUNCS(stat)
361 # normally used for all file i/o
362 AC_CHECK_FUNCS(popen)
364 # for lrealpath.c
365 AC_CHECK_FUNCS(realpath canonicalize_file_name)
366 libiberty_NEED_DECLARATION(canonicalize_file_name)
368 AC_HEADER_STDC
369 AC_CHECK_HEADERS(limits.h string.h sys/types.h regex.h pwd.h)
370 AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h sys/param.h sys/times.h)
371 AC_CHECK_HEADERS(dlfcn.h)
373 if test "x${WIN32}" = "xyes" ; then
374         AC_CHECK_HEADERS(windows.h)
377 for e in $HIDLIST; do
378     case $e in
379       lesstif )
380         AC_PATH_XTRA
381         CPPFLAGS="$CFLAGS $X_CFLAGS"
382         AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS)
383         AC_CHECK_LIB(ICE, main, , , $X_LIBS)
384         AC_CHECK_LIB(SM, main, , , $X_LIBS)
385         AC_CHECK_LIB(Xext, main, , , $X_LIBS)
386         AC_CHECK_LIB(Xt, XtOpenDisplay, , , $X_LIBS)
387         AC_CHECK_LIB(Xmu, main, , , $X_LIBS)
388         AC_CHECK_LIB(Xpm, main, , , $X_LIBS)
389         AC_CHECK_LIB(Xm, XmCreateMainWindow, , , $X_LIBS)
390         case $ac_cv_lib_Xm_XmCreateMainWindow in
391           no )
392             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
393             ;;
394           * ) ;;
395         esac
396         AC_CHECK_HEADERS(Xm/Xm.h)
397         case $ac_cv_header_Xm_Xm_h in
398           no )
399             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
400             ;;
401           * ) ;;
402         esac
403         ;;
405       gtk )
406         # Check for pkg-config
407         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
408         if test "$PKG_CONFIG" = "no"; then
409                 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
410         fi
412         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0, , 
413                 [AC_MSG_ERROR([Cannot find gtk+ >= 2.4.0, install it and rerun ./configure
414 Please review the following errors:
415 $GTK_PKG_ERRORS])]
416         )
417         GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
418         
419         # if we are building for gtk >= 2.8.0, we can use gdk_display_warp_pointer()
420         # otherwise we need XWarpPointer and we'll pull in the required headers with
421         # gdk/gdkx.h and we'll need to link with X11
422         if ! $PKG_CONFIG gtk+-2.0 --atleast-version=2.8.0 ; then
423                 CPPFLAGS="$CFLAGS $GTK_CFLAGS"
424                 AC_CHECK_HEADERS([gdk/gdkx.h])
425         fi
427         # Search for glib
428         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.4.0, , 
429                 [AC_MSG_ERROR([Cannot find glib >= 2.4.0, install it and rerun ./configure.
430 Please review the following errors:
431 $GLIB_PKG_ERRORS])]
432         )
433         GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
434         ;;
436       nelma|png )
437         # Check for gdlib-config for gd (www.boutell.com/gd)
438         AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, no)
439         if test "$GDLIB_CONFIG" = "no"; then
440                 AC_MSG_RESULT([Cannot find gdlib-config.
441 Make sure it is installed and in your PATH.
442 gdlib-config is part of the GD library available from www.boutell.com/gd.
443 This is needed for the png HID.  I will look for libgd anyway and maybe
444 you will get lucky.
446                 if test "$WIN32" != "yes" ; then
447                         AC_CHECK_LIB(gd,main,,
448                         AC_MSG_ERROR([You have requested the nelma and/or png HID  but -lgd could not be found]))
449                 else 
450                         AC_CHECK_LIB(bgd,main,,
451                         AC_MSG_ERROR([You have requested the nelma and/or png HID  but -lbgd could not be found]))
452                 fi
453         else
454                 if test "$WIN32" = "yes" ; then
455                         GD=bgd
456                 else
457                         GD=gd
458                 fi
459                 AC_MSG_CHECKING([for libgd cflags])
460                 GD_CFLAGS="`$GDLIB_CONFIG --cflags`"
461                 AC_MSG_RESULT([$GD_CFLAGS])
462                 AC_MSG_CHECKING([for libgd libs])
463                 GD_LIBS="`$GDLIB_CONFIG --ldflags` `$GDLIB_CONFIG --libs` -l${GD}"
464                 AC_MSG_RESULT([$GD_LIBS])
465         fi
466    
467         # since some linux systems evidently install gdlib-config but fail to
468         # install the headers (nice), check for the header too and fail if it
469         # is not there.
470         CFLAGS="$CFLAGS $GD_CFLAGS"
471         CPPFLAGS="$CPPFLAGS $GD_CFLAGS"
472         AC_CHECK_HEADERS(gd.h)
473         case $ac_cv_header_gd_h in
474              no )
475                 AC_MSG_ERROR([
476 You evidentally do not have a complete installation of the GD library available from www.boutell.com/gd.
477 This is needed for the nelma and/or png HID.
479                 ;;
480              * ) ;;
481         esac
482         
483         # Some versions of gd (prior to the expiration of the
484         # patent related to gif compression) do not support
485         # gif output.  Check for that here.
486         save_LIBS="$LIBS"
487         LIBS="$save_LIBS $GD_LIBS $X_LIBS"
489         AC_MSG_CHECKING([if GIF output from the png HID is desired])
490         AC_ARG_ENABLE([gif],
491                 [  --disable-gif           Disable support for gif output when the png HID is used [[default=include gif support]]],
492                 [
493                 if test "X$enable_gif" != "Xno" ; then
494                         AC_MSG_RESULT([yes])
495                         with_gif=yes
496                 else
497                         AC_MSG_RESULT([no])
498                         with_gif=no
499                 fi
500                 ],
501                 [
502                 AC_MSG_RESULT([yes])
503                 with_gif=yes
504                 ])
505         if test "X$with_gif" = "Xyes" ; then
506                 AC_CHECK_FUNCS(gdImageGif)
507                 if test "$ac_cv_func_gdImageGif" != "yes"; then
508                         AC_MSG_ERROR([Your gd installation does not appear to include gif support.
509 You may need to update your installation of gd or disable
510 gif export with --disable-gif])
511                 fi
512         fi
514         AC_MSG_CHECKING([if JPEG output from the png HID is desired])
515         AC_ARG_ENABLE([jpeg],
516                 [  --disable-jpeg          Disable support for JPEG output when the png HID is used [[default=include JPEG support]]],
517                 [
518                 if test "X$enable_jpeg" != "Xno" ; then
519                         AC_MSG_RESULT([yes])
520                         with_jpeg=yes
521                 else
522                         AC_MSG_RESULT([no])
523                         with_jpeg=no
524                 fi
525                 ],
526                 [
527                 AC_MSG_RESULT([yes])
528                 with_jpeg=yes
529                 ])
530         if test "X$with_jpeg" = "Xyes" ; then
531                 AC_CHECK_FUNCS(gdImageJpeg)
532                 if test "$ac_cv_func_gdImageJpeg" != "yes"; then
533                         AC_MSG_ERROR([Your gd installation does not appear to include JPEG support.
534 You may need to update your installation of gd or disable
535 JPEG export with --disable-jpeg])
536                 fi
537         fi
540         AC_MSG_CHECKING([if PNG output from the png HID is desired])
541         AC_ARG_ENABLE([png],
542                 [  --disable-png           Disable support for PNG output when the png HID is used [[default=include PNG support]]],
543                 [
544                 if test "X$enable_png" != "Xno" ; then
545                         AC_MSG_RESULT([yes])
546                         with_png=yes
547                 else
548                         AC_MSG_RESULT([no])
549                         with_png=no
550                 fi
551                 ],
552                 [
553                 AC_MSG_RESULT([yes])
554                 with_png=yes
555                 ])
556         if test "X$with_png" = "Xyes" ; then
557                 AC_CHECK_FUNCS(gdImagePng)
558                 if test "$ac_cv_func_gdImagePng" != "yes"; then
559                         AC_MSG_ERROR([Your gd installation does not appear to include PNG support.
560 You may need to update your installation of gd or disable
561 PNG export with --disable-png])
562                 fi
563         fi
564         LIBS="$save_LIBS"
565         ;;
567     esac
568 done
571 AM_CONDITIONAL(PNG, test x$with_png = xyes)
572 AM_CONDITIONAL(GIF, test x$with_gif = xyes)
575 # ------------- Xrender -------------------
576 have_xrender=no
577 AC_CHECK_LIB(Xrender,XRenderQueryExtension,have_xrender=yes,have_xrender=no,$X_LIBS)
579 AC_ARG_ENABLE([xrender],
580 [  --disable-xrender        Compile and link with Xrender [default=yes]])
581 case "$have_xrender:$enable_xrender" in
582    no:* ) ;;
583    *:no ) ;;
584    * )
585      X_LIBS="-lXrender $X_LIBS"
586      AC_DEFINE([HAVE_XRENDER], 1,
587                 [Define to 1 if Xrender is available])
588      ;;
589 esac
591 # ------------- dmalloc -------------------
592 dnl dmalloc checks
593 with_dmalloc=no
594 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
595 AC_ARG_ENABLE([dmalloc],
596 [  --enable-dmalloc        Compile and link with dmalloc for malloc debugging [default=no]],
598 if test "X$enable_dmalloc" != "Xno" ; then
599         AC_MSG_RESULT([yes])
600         AC_CHECK_HEADER(dmalloc.h,,
601                 AC_MSG_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
602         AC_CHECK_LIB(dmalloc,main,,
603                 AC_MSG_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
604         DMALLOC_LIBS="-ldmalloc"
605         with_dmalloc=yes
606 else
607         AC_MSG_RESULT([no])
608         DMALLOC_LIBS=""
612         AC_MSG_RESULT([no])
613         DMALLOC_LIBS=""
616 # ------------- ElectricFence -------------------
617 dnl ElectricFence checks
618 with_efence=no
619 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
620 AC_ARG_ENABLE([efence],
621 [  --enable-efence         Link with ElectricFence for malloc debugging [default=no]],
623 if test "X$enable_efence" != "Xno" ; then
624         AC_MSG_RESULT([yes])
625         AC_CHECK_LIB(efence,main,,
626                 AC_MSG_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
627         with_efence=yes
628 else
629         AC_MSG_RESULT([no])
633 AC_MSG_RESULT([no])
636 CFLAGS="$CFLAGS $X_CFLAGS $DBUS_CFLAGS $GTK_CFLAGS"
637 LIBS="$LIBS $XM_LIBS $DBUS_LIBS $X_LIBS $GTK_LIBS $DMALLOC_LIBS $GD_LIBS"
640 # if we have gcc then add -Wall
641 if test "x$GCC" = "xyes"; then
642         if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
643                 CFLAGS="$CFLAGS -Wall"
644         fi
648 # font filename
649 FONTFILENAME=${FONTFILENAME:-"default_font"}
650 AC_SUBST(FONTFILENAME)
651 AC_DEFINE_UNQUOTED(FONTFILENAME,"$FONTFILENAME",[File for default font])
653 # standard autoconf variables
654 CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\""
655 CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\""
656 CPPFLAGS="$CPPFLAGS -DHOST=\\\"\${host}\\\""
658 # directory for old-style library and for fonts
659 PCBLIBDIR=${datadir}/pcb
660 AC_SUBST(PCBLIBDIR)
661 #AC_DEFINE_UNQUOTED(PCBLIBDIR,"$PCBLIBDIR",[Library directory])
662 CPPFLAGS="$CPPFLAGS -DPCBLIBDIR=\\\"$PCBLIBDIR\\\""
664 # name for old-style library
665 LIBRARYFILENAME=pcblib
666 AC_SUBST(LIBRARYFILENAME)
667 AC_DEFINE_UNQUOTED(LIBRARYFILENAME,"$LIBRARYFILENAME",[library file name])
670 # directory for new library
671 PCBTREEDIR=${datadir}/pcb/newlib
672 PCBTREEPATH=${PCBTREEDIR}:${PCBLIBDIR}/pcblib-newlib
673 PCBTREEDIR=${PCBTREEDIR:-"$PCBTREEDIR"}
674 AC_SUBST(PCBTREEDIR)
675 AC_SUBST(PCBTREEPATH)
676 #AC_DEFINE_UNQUOTED(PCBTREEDIR,"$PCBLIB",[top directory for new style pcb library])
677 CPPFLAGS="$CPPFLAGS -DPCBTREEDIR=\\\"$PCBTREEDIR\\\""
678 CPPFLAGS="$CPPFLAGS -DPCBTREEPATH=\\\"$PCBTREEPATH\\\""
680 # Figure out relative paths
681 AC_MSG_CHECKING([for the bindir to pcblibdir relative path])
682 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBLIBDIR:bindir_to_pcblibdir])
683 adl_NORMALIZE_PATH([bindir_to_pcblibdir], [$PCB_DIR_SEPARATOR_S])
684 AC_MSG_RESULT([$bindir_to_pcblibdir])
685 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBLIBDIR, "$bindir_to_pcblibdir", [Relative path from bindir to pcblibdir])
687 AC_MSG_CHECKING([for the bindir to pcbtreedir relative path])
688 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBTREEDIR:bindir_to_pcbtreedir])
689 adl_NORMALIZE_PATH([bindir_to_pcbtreedir], [$PCB_DIR_SEPARATOR_S])
690 AC_MSG_RESULT([$bindir_to_pcbtreedir])
691 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBTREEDIR, "$bindir_to_pcbtreedir", [Relative path from bindir to pcbtreedir])
694 AC_MSG_CHECKING([for the bindir to exec_prefix relative path])
695 adl_COMPUTE_RELATIVE_PATHS([bindir:exec_prefix:bindir_to_execprefix])
696 adl_NORMALIZE_PATH([bindir_to_execprefix], [$PCB_DIR_SEPARATOR_S])
697 AC_MSG_RESULT([$bindir_to_execprefix])
698 AC_DEFINE_UNQUOTED(BINDIR_TO_EXECPREFIX, "$bindir_to_execprefix", [Relative path from bindir to exec_prefix])
701 BTNMOD=${BTNMOD:-"Mod1"}
702 AC_SUBST(BTNMOD)
704 TOPDIRS=
705 for dir in src lib newlib doc example tools tutorial README_FILES
707    test -d $dir/. && TOPDIRS="$TOPDIRS $dir"
708 done
709 AC_SUBST(TOPDIRS)
711 AC_CONFIG_FILES(Makefile intl/Makefile po/Makefile.in)
713 if test -d $srcdir/README_FILES; then
714    AC_CONFIG_FILES(README_FILES/Makefile)
716 if test -d $srcdir/doc; then
717    AC_CONFIG_FILES(doc/Makefile)
719 if test -d $srcdir/example; then
720    AC_CONFIG_FILES(example/Makefile)
721    AC_CONFIG_FILES(example/libraries/Makefile)
723 if test -d $srcdir/lib; then
724    AC_CONFIG_FILES(lib/CreateLibraryContents.sh)
725    AC_CONFIG_FILES(lib/CreateLibrary.sh)
726    AC_CONFIG_FILES(lib/ListLibraryContents.sh)
727    AC_CONFIG_FILES(lib/Makefile)
728    AC_CONFIG_FILES(lib/QueryLibrary.sh)
729    AC_CONFIG_FILES(lib/m4lib_to_newlib.sh)
730    AC_CONFIG_FILES(lib/qfp-ui)
732 if test -d $srcdir/newlib; then
733    AC_CONFIG_FILES(newlib/2_pin_thru-hole_packages/Makefile)
734    AC_CONFIG_FILES(newlib/Makefile)
735    AC_CONFIG_FILES(newlib/analog-devices/Makefile)
736    AC_CONFIG_FILES(newlib/burr-brown/Makefile)
737    AC_CONFIG_FILES(newlib/connectors/Makefile)
738    AC_CONFIG_FILES(newlib/crystal/Makefile)
739    AC_CONFIG_FILES(newlib/electro-optics/Makefile)
740    AC_CONFIG_FILES(newlib/headers/Makefile)
741    AC_CONFIG_FILES(newlib/keystone/Makefile)
742    AC_CONFIG_FILES(newlib/msp430/Makefile)
743    AC_CONFIG_FILES(newlib/not_vetted_ingo/Makefile)
744    AC_CONFIG_FILES(newlib/sockets/Makefile)
745    AC_CONFIG_FILES(newlib/tests/Makefile)
747 AC_CONFIG_FILES(src/Makefile)
748 AC_CONFIG_FILES(src/icons/Makefile)
749 if test -d $srcdir/tools; then
750    AC_CONFIG_FILES(tools/Makefile)
752 if test -d $srcdir/tutorial; then
753    AC_CONFIG_FILES(tutorial/Makefile)
756 AC_CONFIG_FILES(win32/Makefile)
758 AC_OUTPUT
760 with_gui=`echo $with_gui`
761 with_printer=`echo $with_printer`
762 with_exporters=`echo $with_exporters | sed 's/,/ /g'`
764 AC_MSG_RESULT([
765 ** Configuration summary for $PACKAGE $VERSION:
767    GUI:                      $with_gui
768    Printer:                  $with_printer
769    Exporters:                $with_exporters
770    Build documentation:      $docs_yesno
771    dmalloc debugging:        $with_dmalloc
772    ElectricFence debugging:  $with_efence
773    CPPFLAGS:                 $CPPFLAGS
774    CFLAGS:                   $CFLAGS
775    LIBS:                     $LIBS