Commit pcb.desktop.in template menu file for translation
[geda-pcb/gde.git] / configure.ac
blob7f6687e92772ed32eea958c0ff00ff296d00114b
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 AM_CONFIG_HEADER(config.h)
10 AM_MAINTAINER_MODE
12 dnl determine host type
13 AC_CANONICAL_HOST
14 AC_MSG_CHECKING(for windows)
15 PCB_PATH_DELIMETER=":"
16 PCB_DIR_SEPARATOR_S="/"
17 PCB_DIR_SEPARATOR_C='/'
18 case $host in
19         *-*-cygwin* )
20                 CFLAGS="$CFLAGS ${CYGWIN_CFLAGS}"
21                 CPPFLAGS="$CPPFLAGS ${CYGWIN_CPPFLAGS}"
22                 ;;
24         *-*-mingw* )
25                 WIN32=yes
26                 CFLAGS="$CFLAGS ${MINGW_CFLAGS:--mms-bitfields -mwindows}"
27                 CPPFLAGS="$CPPFLAGS ${MINGW_CPPFLAGS:--mms-bitfields -mwindows}"
28                 ;;
30         * )
31                 WIN32=no
32                 ;;
33 esac
35 AC_MSG_RESULT($WIN32)
36 AC_SUBST(WIN32)
37 AM_CONDITIONAL(WIN32, test x$WIN32 = xyes)
38 if test "x$WIN32" = "xyes" ; then
39         PCB_PATH_DELIMETER=";"
40         PCB_DIR_SEPARATOR_S="\\\\"
41         PCB_DIR_SEPARATOR_C='\\'
44 AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_C,'$PCB_DIR_SEPARATOR_C',[Directory separator char])
45 AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_S,"$PCB_DIR_SEPARATOR_S",[Directory separator string])
46 AC_DEFINE_UNQUOTED(PCB_PATH_DELIMETER,"$PCB_PATH_DELIMETER",[Search path separator string])
49 dnl Checks for programs.
50 AC_PROG_CC
51 AC_C_INLINE
52 AC_PROG_CC_STDC
53 AM_PROG_CC_C_O
54 AC_PROG_CPP
55 AC_PROG_AWK
57 AM_PROG_LEX
58 AC_PATH_PROG(LEX_PATH, $LEX, [notfound])
59 if test "$LEX_PATH" = "notfound" ; then
60         AC_MSG_ERROR([Couldn't find a usable lex program.
61 Please install flex which is available from
62 ftp://ftp.gnu.org/pub/non-gnu/flex/
67 AC_PROG_YACC
68 AC_PATH_PROG(YACC_PATH, $YACC, [notfound])
69 if test "$YACC_PATH" = "notfound" ; then
70         AC_MSG_ERROR([Couldn't find a usable yacc program.
71 Please install bison which is available from
72 ftp://ftp.gnu.org/pub/gnu/bison/
76 AC_PROG_INSTALL
77 AC_PROG_RANLIB
80 # Used for building the win32 icons.
82 AC_PATH_PROG(TGIF, tgif, notfound)
83 AM_CONDITIONAL(MISSING_TGIF, test x$TGIF = xnotfound)
84 AC_PATH_PROG(XPMTOPPM, xpmtoppm, notfound)
85 AC_PATH_PROG(PPMTOWINICON, ppmtowinicon, notfound)
86 AM_CONDITIONAL(MISSING_XPMTOPPM, test x$PPMTOWINICON = xnotfound -o x$XPMTOPPM = xnotfound)
87 AC_PATH_PROG(CONVERT, convert, notfound)
88 AM_CONDITIONAL(MISSING_CONVERT, test x$CONVERT = xnotfound)
90 docs_yesno=yes
92 AC_MSG_CHECKING([if the documentation should be built])
93 AC_ARG_ENABLE([doc],
94 [  --enable-doc            Build and install the documentation [[default=yes]]],
96 if test "X$enable_doc" = "Xno" ; then
97         DOC=""
98         AC_MSG_RESULT([no])
99         docs_yesno=no
100 else
101         DOC=doc
102         AC_MSG_RESULT([yes])
103         docs_yesno=yes
107 DOC=doc
108 AC_MSG_RESULT([yes])
109 docs_yesno=yes
111 AC_SUBST(DOC)
113 if test "X$docs_yesno" = "Xyes" -a "X$USE_MAINTAINER_MODE" = "Xyes" ; then
114    AC_CHECK_PROGS(MKINFO, makeinfo, no)
115    if test "X$MKINFO" != "Xno"; then
116       AC_MSG_CHECKING([for GNU makeinfo version >= 4.6])
117       v=`$MKINFO --version | grep "GNU texinfo"`
118       if test $? -ne 0; then
119          AC_MSG_RESULT([non-GNU])
120          MKINFO="no"
121       fi
122    fi
123    if test "X$MKINFO" != "Xno"; then
124       vmajor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\1/'`
125       vminor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
126       AC_MSG_RESULT([$vmajor.$vminor])
127       if test "$vmajor" -lt 4 \
128               || (test "$vmajor" -eq 4 && test "$vminor" -lt 6); then
129          MKINFO=no
130       fi
131    fi
132    if test "X$MKINFO" = "Xno"; then
133       AC_MSG_ERROR([You have requested a maintainer-mode build and a build
134 of the documentation.  For this to work, you must have version 4.6 or newer of
135 the GNU texinfo package.  You seem to have
140    fi
142    AC_CHECK_PROGS(TEXI2DVI, texi2dvi, no)
143    if test "X$TEXI2DVI" = "Xno"; then
144       AC_MSG_ERROR([You have requested a maintainer-mode build and a build
145 of the documentation.  For this to work, you must have the texi2dvi program
146 installed.])
147    fi
150         AC_PATH_PROG(PERL, perl, notfound)
151         if test "X$PERL" = "Xnotfound"; then
152                         AC_MSG_ERROR([You have requested a maintainer-mode build and a build
153 of the documentation.  For this to work, you must have perl installed.
155         fi
158 # FIXME:  for now, only try to add -rdynamic if we're using gcc.  We really
159 # need to figure out what the correct test is here.  In the mean time, this
160 # should let things build with SunPRO again.
161 if test "x$GCC" = "xyes"; then
162 AC_MSG_CHECKING([If the compiler accepts -rdynamic])
163 old_LDFLAGS="$LDFLAGS"
164 LDFLAGS="$LDFLAGS -rdynamic"
165 AC_LINK_IFELSE([int main(){}],
166         [AC_MSG_RESULT([yes])],
167         [LDFLAGS="$old_LDFLAGS"
168         AC_MSG_RESULT([no])
169         ])
172 # ------------- HID config -------------------
174 hid_guis=""
175 hid_printers=""
176 hid_exporters=""
177 hid_always=""
179 for hid in `cd $srcdir/src/hid; echo *`; do
180     F=$srcdir/src/hid/$hid/hid.conf
181     if test -f $F 
182     then
183     echo checking $F
184         . $F
185         case $type in
186           gui ) hid_guis="$hid_guis $hid" ;;
187           printer ) hid_printers="$hid_printers $hid" ;;
188           export ) hid_exporters="$hid_exporters $hid" ;;
189           always ) hid_always="$hid_always $hid" ;;
190         esac
191     fi
192 done
194 AC_MSG_CHECKING([for which gui to use])
195 AC_ARG_WITH([gui],
196 [  --with-gui=            Specify the GUI to use: batch gtk lesstif [[default=gtk]]],
198 [with_gui=gtk]
200 AC_MSG_RESULT([$with_gui])
201 case " $hid_guis no none " in
202      *\ $with_gui\ * ) HIDLIST="$with_gui" ;;
203      * ) AC_MSG_ERROR([$with_gui is not a valid gui]) ;;
204 esac
206 if test x"$with_gui" = x"none" -o x"$with_gui" = x"no"
207 then
208     HIDLIST=
211 AC_MSG_CHECKING([for whether to use DBUS])
212 AC_ARG_ENABLE([dbus],
213 [  --enable-dbus           Enable DBUS IPC],
214 [],[enable_dbus=no])
216 AC_MSG_RESULT([$enable_dbus])
217 AM_CONDITIONAL(WITH_DBUS, test x$enable_dbus = xyes)
219 if test "x$enable_dbus" = "xyes"; then
220         case " $with_gui " in
221                 *\ gtk\ *) ;;
222                 *\ lesstif\ *) ;;
223                 * ) AC_MSG_ERROR([DBUS enabled but only works with a mainloop capable GUI HID.
224 Either do not use --enable-dbus or enable the gtk or lesstif GUI HID.])
225         esac
226         
227         # Check for pkg-config
228         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
229         if test "$PKG_CONFIG" = "no"; then
230                 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
231         fi
233         PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.61,
234                 [saved_LIBS="$LIBS"
235                  LIBS="$LIBS $DBUS_LIBS"
236                  AC_CHECK_FUNCS(dbus_watch_get_unix_fd)
237                  LIBS="$saved_LIBS" ],
238                 [AC_MSG_ERROR([Cannot find dbus-1 >= 0.61, install it and rerun ./configure
239 Please review the following errors:
240 $DBUS_PKG_ERRORS])]
241         )
242         DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
243         
244         AC_DEFINE([HAVE_DBUS], 1,
245                 [Define to 1 if DBUS IPC is to be compiled in])
249 AC_MSG_CHECKING([for which printer to use])
250 AC_ARG_WITH([printer],
251 [  --with-printer=        Specify the printer: lpr [[default=lpr]]],
252 [],[with_printer=lpr])
253 AC_MSG_RESULT([$with_printer])
254 case " $hid_printers " in
255      *\ $with_printer\ * )
256          HIDLIST="$HIDLIST $with_printer"
257          ;;
258      * ) AC_MSG_ERROR([$with_printer is not a valid printer]) ;;
259 esac
261 AC_MSG_CHECKING([for which exporters to use])
262 AC_ARG_WITH([exporters],
263 [  --with-exporters=       Enable export devices: bom gerber nelma png ps [[default=bom gerber nelma png ps]]],
264 [],[with_exporters=$hid_exporters])
265 AC_MSG_RESULT([$with_exporters])
266 for e in `echo $with_exporters | sed 's/,/ /g'`; do
267     case " $hid_exporters " in
268       *\ $e\ * )
269          HIDLIST="$HIDLIST $e"
270          ;;
271       * ) AC_MSG_ERROR([$e is not a valid exporter]) ;;
272     esac
273 done
275 if test "X$enable_jpeg" = "Xno" -a "X$enable_gif" = "Xno" -a "X$enable_png" = "Xno" ; then
276         case " ${HIDLIST} " in
277                 *\ png\ *)
278                         AC_MSG_ERROR([you have requested the png HID but turned off all output
279 formats!  If you do not want gif/jpeg/png output, use --with-exporters to list
280 which exporters you want and do not list png there.])
281                         ;;
283                 *)
284                         ;;
285         esac
288 for e in $HIDLIST; do
289     HIDLIBS="$HIDLIBS lib$e.a"
290 done
292 AC_SUBST(HIDLIST)
293 AC_SUBST(HIDLIBS)
295 # ------------- end HID config -------------------
297 AC_PATH_PROGS(M4, gm4 m4, [none])
298 if test "X$M4" = "Xnone" ; then
299         AC_MSG_ERROR([Did not find a m4 executible.  You need to make sure
300         that m4 is installed on your system and that m4 is in your path])
302 AC_MSG_CHECKING([if $M4 has the division involving negative numbers bug])
303 pcb_m4_r=`echo "eval(-2/2)" | $M4`
304 if test "$pcb_m4_r" != "-1" ; then
305         AC_MSG_RESULT([yes])
306         AC_MSG_ERROR([It appears that $M4 has a bug involving division
307 with negative numbers.  In particular it just returned the result that
308 -2/2 = $pcb_m4_r instead of -1.  This is a known bug in GNU m4-1.4.9.  Please
309 install a non-broken m4.])
310 else
311         AC_MSG_RESULT([no])
315 AC_PATH_PROGS(WISH, wish wish83 wish8.3 wish80 wish8.0 cygwish83 cygwish80,[none])
316 if test "X$WISH" = "Xnone" ; then
317         AC_MSG_ERROR([Did not find the wish executible.  You need to make sure
318         that tcl is installed on your system and that wish is in your path])
321 AC_DEFINE_UNQUOTED(M4,$M4,[m4 executible])
322 GNUM4=$M4
323 AC_SUBST(GNUM4)
324 AC_DEFINE_UNQUOTED(GNUM4,"$M4",[m4 program used by pcb])
326 AC_CHECK_PROGS(LATEX, latex, notfound)
327 AM_CONDITIONAL(MISSING_LATEX, test x$LATEX = xnotfound)
329 AC_CHECK_PROGS(PDFLATEX, pdflatex, notfound)
330 AM_CONDITIONAL(MISSING_PDFLATEX, test x$PDFLATEX = xnotfound)
332 AC_CHECK_PROGS(DVIPS, dvips, notfound)
333 AM_CONDITIONAL(MISSING_DVIPS, test x$DVIPS = xnotfound)
335 AC_CHECK_PROGS(PS2PDF, ps2pdf, notfound)
336 AM_CONDITIONAL(MISSING_PS2PDF, test x$PS2PDF = xnotfound)
338 dnl Checks for libraries.
339 AC_CHECK_LIB(m, sqrt)
340 AC_CHECK_LIB(dl, dlopen)
341 AC_CHECK_LIB(xnet, gethostbyname)
342 AC_CHECK_LIB(fl, yywrap)
343 AC_CHECK_FUNCS(strerror)
344 AC_CHECK_FUNCS(regcomp re_comp)
345 AC_CHECK_FUNCS(logf expf rint)
346 AC_CHECK_FUNCS(vsnprintf)
347 AC_CHECK_FUNCS(getpwuid gethostname getcwd)
348 AC_CHECK_FUNCS(random)
349 AC_CHECK_FUNCS(stat)
351 # normally used for all file i/o
352 AC_CHECK_FUNCS(popen)
354 # for lrealpath.c
355 AC_CHECK_FUNCS(realpath canonicalize_file_name)
356 libiberty_NEED_DECLARATION(canonicalize_file_name)
358 AC_HEADER_STDC
359 AC_CHECK_HEADERS(limits.h string.h sys/types.h regex.h pwd.h)
360 AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h sys/param.h sys/times.h)
361 AC_CHECK_HEADERS(dlfcn.h)
363 if test "x${WIN32}" = "xyes" ; then
364         AC_CHECK_HEADERS(windows.h)
367 for e in $HIDLIST; do
368     case $e in
369       lesstif )
370         AC_PATH_XTRA
371         CPPFLAGS="$CFLAGS $X_CFLAGS"
372         AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS)
373         AC_CHECK_LIB(ICE, main, , , $X_LIBS)
374         AC_CHECK_LIB(SM, main, , , $X_LIBS)
375         AC_CHECK_LIB(Xext, main, , , $X_LIBS)
376         AC_CHECK_LIB(Xt, XtOpenDisplay, , , $X_LIBS)
377         AC_CHECK_LIB(Xmu, main, , , $X_LIBS)
378         AC_CHECK_LIB(Xpm, main, , , $X_LIBS)
379         AC_CHECK_LIB(Xm, XmCreateMainWindow, , , $X_LIBS)
380         case $ac_cv_lib_Xm_XmCreateMainWindow in
381           no )
382             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
383             ;;
384           * ) ;;
385         esac
386         AC_CHECK_HEADERS(Xm/Xm.h)
387         case $ac_cv_header_Xm_Xm_h in
388           no )
389             AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
390             ;;
391           * ) ;;
392         esac
393         ;;
395       gtk )
396         # Check for pkg-config
397         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
398         if test "$PKG_CONFIG" = "no"; then
399                 AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
400         fi
402         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0, , 
403                 [AC_MSG_ERROR([Cannot find gtk+ >= 2.4.0, install it and rerun ./configure
404 Please review the following errors:
405 $GTK_PKG_ERRORS])]
406         )
407         GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
408         
409         # if we are building for gtk >= 2.8.0, we can use gdk_display_warp_pointer()
410         # otherwise we need XWarpPointer and we'll pull in the required headers with
411         # gdk/gdkx.h and we'll need to link with X11
412         if ! $PKG_CONFIG gtk+-2.0 --atleast-version=2.8.0 ; then
413                 CPPFLAGS="$CFLAGS $GTK_CFLAGS"
414                 AC_CHECK_HEADERS([gdk/gdkx.h])
415         fi
417         # Search for glib
418         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.4.0, , 
419                 [AC_MSG_ERROR([Cannot find glib >= 2.4.0, install it and rerun ./configure.
420 Please review the following errors:
421 $GLIB_PKG_ERRORS])]
422         )
423         GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
424         ;;
426       nelma|png )
427         # Check for gdlib-config for gd (www.boutell.com/gd)
428         AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, no)
429         if test "$GDLIB_CONFIG" = "no"; then
430                 AC_MSG_RESULT([Cannot find gdlib-config.
431 Make sure it is installed and in your PATH.
432 gdlib-config is part of the GD library available from www.boutell.com/gd.
433 This is needed for the png HID.  I will look for libgd anyway and maybe
434 you will get lucky.
436                 if test "$WIN32" != "yes" ; then
437                         AC_CHECK_LIB(gd,main,,
438                         AC_MSG_ERROR([You have requested the nelma and/or png HID  but -lgd could not be found]))
439                 else 
440                         AC_CHECK_LIB(bgd,main,,
441                         AC_MSG_ERROR([You have requested the nelma and/or png HID  but -lbgd could not be found]))
442                 fi
443         else
444                 if test "$WIN32" = "yes" ; then
445                         GD=bgd
446                 else
447                         GD=gd
448                 fi
449                 AC_MSG_CHECKING([for libgd cflags])
450                 GD_CFLAGS="`$GDLIB_CONFIG --cflags`"
451                 AC_MSG_RESULT([$GD_CFLAGS])
452                 AC_MSG_CHECKING([for libgd libs])
453                 GD_LIBS="`$GDLIB_CONFIG --ldflags` `$GDLIB_CONFIG --libs` -l${GD}"
454                 AC_MSG_RESULT([$GD_LIBS])
455         fi
456    
457         # since some linux systems evidently install gdlib-config but fail to
458         # install the headers (nice), check for the header too and fail if it
459         # is not there.
460         CFLAGS="$CFLAGS $GD_CFLAGS"
461         CPPFLAGS="$CPPFLAGS $GD_CFLAGS"
462         AC_CHECK_HEADERS(gd.h)
463         case $ac_cv_header_gd_h in
464              no )
465                 AC_MSG_ERROR([
466 You evidentally do not have a complete installation of the GD library available from www.boutell.com/gd.
467 This is needed for the nelma and/or png HID.
469                 ;;
470              * ) ;;
471         esac
472         
473         # Some versions of gd (prior to the expiration of the
474         # patent related to gif compression) do not support
475         # gif output.  Check for that here.
476         save_LIBS="$LIBS"
477         LIBS="$save_LIBS $GD_LIBS $X_LIBS"
479         AC_MSG_CHECKING([if GIF output from the png HID is desired])
480         AC_ARG_ENABLE([gif],
481                 [  --disable-gif           Disable support for gif output when the png HID is used [[default=include gif support]]],
482                 [
483                 if test "X$enable_gif" != "Xno" ; then
484                         AC_MSG_RESULT([yes])
485                         with_gif=yes
486                 else
487                         AC_MSG_RESULT([no])
488                         with_gif=no
489                 fi
490                 ],
491                 [
492                 AC_MSG_RESULT([yes])
493                 with_gif=yes
494                 ])
495         if test "X$with_gif" = "Xyes" ; then
496                 AC_CHECK_FUNCS(gdImageGif)
497                 if test "$ac_cv_func_gdImageGif" != "yes"; then
498                         AC_MSG_ERROR([Your gd installation does not appear to include gif support.
499 You may need to update your installation of gd or disable
500 gif export with --disable-gif])
501                 fi
502         fi
504         AC_MSG_CHECKING([if JPEG output from the png HID is desired])
505         AC_ARG_ENABLE([jpeg],
506                 [  --disable-jpeg          Disable support for JPEG output when the png HID is used [[default=include JPEG support]]],
507                 [
508                 if test "X$enable_jpeg" != "Xno" ; then
509                         AC_MSG_RESULT([yes])
510                         with_jpeg=yes
511                 else
512                         AC_MSG_RESULT([no])
513                         with_jpeg=no
514                 fi
515                 ],
516                 [
517                 AC_MSG_RESULT([yes])
518                 with_jpeg=yes
519                 ])
520         if test "X$with_jpeg" = "Xyes" ; then
521                 AC_CHECK_FUNCS(gdImageJpeg)
522                 if test "$ac_cv_func_gdImageJpeg" != "yes"; then
523                         AC_MSG_ERROR([Your gd installation does not appear to include JPEG support.
524 You may need to update your installation of gd or disable
525 JPEG export with --disable-jpeg])
526                 fi
527         fi
530         AC_MSG_CHECKING([if PNG output from the png HID is desired])
531         AC_ARG_ENABLE([png],
532                 [  --disable-png           Disable support for PNG output when the png HID is used [[default=include PNG support]]],
533                 [
534                 if test "X$enable_png" != "Xno" ; then
535                         AC_MSG_RESULT([yes])
536                         with_png=yes
537                 else
538                         AC_MSG_RESULT([no])
539                         with_png=no
540                 fi
541                 ],
542                 [
543                 AC_MSG_RESULT([yes])
544                 with_png=yes
545                 ])
546         if test "X$with_png" = "Xyes" ; then
547                 AC_CHECK_FUNCS(gdImagePng)
548                 if test "$ac_cv_func_gdImagePng" != "yes"; then
549                         AC_MSG_ERROR([Your gd installation does not appear to include PNG support.
550 You may need to update your installation of gd or disable
551 PNG export with --disable-png])
552                 fi
553         fi
554         LIBS="$save_LIBS"
555         ;;
557     esac
558 done
561 AM_CONDITIONAL(PNG, test x$with_png = xyes)
562 AM_CONDITIONAL(GIF, test x$with_gif = xyes)
565 # ------------- Xrender -------------------
566 have_xrender=no
567 AC_CHECK_LIB(Xrender,XRenderQueryExtension,have_xrender=yes,have_xrender=no,$X_LIBS)
569 AC_ARG_ENABLE([xrender],
570 [  --disable-xrender        Compile and link with Xrender [default=yes]])
571 case "$have_xrender:$enable_xrender" in
572    no:* ) ;;
573    *:no ) ;;
574    * )
575      X_LIBS="-lXrender $X_LIBS"
576      AC_DEFINE([HAVE_XRENDER], 1,
577                 [Define to 1 if Xrender is available])
578      ;;
579 esac
581 # ------------- dmalloc -------------------
582 dnl dmalloc checks
583 with_dmalloc=no
584 AC_MSG_CHECKING([if dmalloc debugging should be enabled])
585 AC_ARG_ENABLE([dmalloc],
586 [  --enable-dmalloc        Compile and link with dmalloc for malloc debugging [default=no]],
588 if test "X$enable_dmalloc" != "Xno" ; then
589         AC_MSG_RESULT([yes])
590         AC_CHECK_HEADER(dmalloc.h,,
591                 AC_MSG_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
592         AC_CHECK_LIB(dmalloc,main,,
593                 AC_MSG_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
594         DMALLOC_LIBS="-ldmalloc"
595         with_dmalloc=yes
596 else
597         AC_MSG_RESULT([no])
598         DMALLOC_LIBS=""
602         AC_MSG_RESULT([no])
603         DMALLOC_LIBS=""
606 # ------------- ElectricFence -------------------
607 dnl ElectricFence checks
608 with_efence=no
609 AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
610 AC_ARG_ENABLE([efence],
611 [  --enable-efence         Link with ElectricFence for malloc debugging [default=no]],
613 if test "X$enable_efence" != "Xno" ; then
614         AC_MSG_RESULT([yes])
615         AC_CHECK_LIB(efence,main,,
616                 AC_MSG_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
617         with_efence=yes
618 else
619         AC_MSG_RESULT([no])
623 AC_MSG_RESULT([no])
626 CFLAGS="$CFLAGS $X_CFLAGS $DBUS_CFLAGS $GTK_CFLAGS"
627 LIBS="$LIBS $XM_LIBS $DBUS_LIBS $X_LIBS $GTK_LIBS $DMALLOC_LIBS $GD_LIBS"
630 # if we have gcc then add -Wall
631 if test "x$GCC" = "xyes"; then
632         if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
633                 CFLAGS="$CFLAGS -Wall"
634         fi
638 # font filename
639 FONTFILENAME=${FONTFILENAME:-"default_font"}
640 AC_SUBST(FONTFILENAME)
641 AC_DEFINE_UNQUOTED(FONTFILENAME,"$FONTFILENAME",[File for default font])
643 # standard autoconf variables
644 CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\""
645 CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\""
646 CPPFLAGS="$CPPFLAGS -DHOST=\\\"\${host}\\\""
648 # directory for old-style library and for fonts
649 PCBLIBDIR=${datadir}/pcb
650 AC_SUBST(PCBLIBDIR)
651 #AC_DEFINE_UNQUOTED(PCBLIBDIR,"$PCBLIBDIR",[Library directory])
652 CPPFLAGS="$CPPFLAGS -DPCBLIBDIR=\\\"$PCBLIBDIR\\\""
654 # name for old-style library
655 LIBRARYFILENAME=pcblib
656 AC_SUBST(LIBRARYFILENAME)
657 AC_DEFINE_UNQUOTED(LIBRARYFILENAME,"$LIBRARYFILENAME",[library file name])
660 # directory for new library
661 PCBTREEDIR=${datadir}/pcb/newlib
662 PCBTREEPATH=${PCBTREEDIR}:${PCBLIBDIR}/pcblib-newlib
663 PCBTREEDIR=${PCBTREEDIR:-"$PCBTREEDIR"}
664 AC_SUBST(PCBTREEDIR)
665 AC_SUBST(PCBTREEPATH)
666 #AC_DEFINE_UNQUOTED(PCBTREEDIR,"$PCBLIB",[top directory for new style pcb library])
667 CPPFLAGS="$CPPFLAGS -DPCBTREEDIR=\\\"$PCBTREEDIR\\\""
668 CPPFLAGS="$CPPFLAGS -DPCBTREEPATH=\\\"$PCBTREEPATH\\\""
670 # Figure out relative paths
671 AC_MSG_CHECKING([for the bindir to pcblibdir relative path])
672 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBLIBDIR:bindir_to_pcblibdir])
673 adl_NORMALIZE_PATH([bindir_to_pcblibdir], [$PCB_DIR_SEPARATOR_S])
674 AC_MSG_RESULT([$bindir_to_pcblibdir])
675 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBLIBDIR, "$bindir_to_pcblibdir", [Relative path from bindir to pcblibdir])
677 AC_MSG_CHECKING([for the bindir to pcbtreedir relative path])
678 adl_COMPUTE_RELATIVE_PATHS([bindir:PCBTREEDIR:bindir_to_pcbtreedir])
679 adl_NORMALIZE_PATH([bindir_to_pcbtreedir], [$PCB_DIR_SEPARATOR_S])
680 AC_MSG_RESULT([$bindir_to_pcbtreedir])
681 AC_DEFINE_UNQUOTED(BINDIR_TO_PCBTREEDIR, "$bindir_to_pcbtreedir", [Relative path from bindir to pcbtreedir])
684 AC_MSG_CHECKING([for the bindir to exec_prefix relative path])
685 adl_COMPUTE_RELATIVE_PATHS([bindir:exec_prefix:bindir_to_execprefix])
686 adl_NORMALIZE_PATH([bindir_to_execprefix], [$PCB_DIR_SEPARATOR_S])
687 AC_MSG_RESULT([$bindir_to_execprefix])
688 AC_DEFINE_UNQUOTED(BINDIR_TO_EXECPREFIX, "$bindir_to_execprefix", [Relative path from bindir to exec_prefix])
691 BTNMOD=${BTNMOD:-"Mod1"}
692 AC_SUBST(BTNMOD)
694 TOPDIRS=
695 for dir in src lib newlib doc example tools tutorial README_FILES
697    test -d $dir/. && TOPDIRS="$TOPDIRS $dir"
698 done
699 AC_SUBST(TOPDIRS)
701 AC_CONFIG_FILES(Makefile)
702 if test -d $srcdir/README_FILES; then
703    AC_CONFIG_FILES(README_FILES/Makefile)
705 if test -d $srcdir/doc; then
706    AC_CONFIG_FILES(doc/Makefile)
708 if test -d $srcdir/example; then
709    AC_CONFIG_FILES(example/Makefile)
710    AC_CONFIG_FILES(example/libraries/Makefile)
712 if test -d $srcdir/lib; then
713    AC_CONFIG_FILES(lib/CreateLibraryContents.sh)
714    AC_CONFIG_FILES(lib/CreateLibrary.sh)
715    AC_CONFIG_FILES(lib/ListLibraryContents.sh)
716    AC_CONFIG_FILES(lib/Makefile)
717    AC_CONFIG_FILES(lib/QueryLibrary.sh)
718    AC_CONFIG_FILES(lib/m4lib_to_newlib.sh)
719    AC_CONFIG_FILES(lib/qfp-ui)
721 if test -d $srcdir/newlib; then
722    AC_CONFIG_FILES(newlib/2_pin_thru-hole_packages/Makefile)
723    AC_CONFIG_FILES(newlib/Makefile)
724    AC_CONFIG_FILES(newlib/analog-devices/Makefile)
725    AC_CONFIG_FILES(newlib/burr-brown/Makefile)
726    AC_CONFIG_FILES(newlib/connectors/Makefile)
727    AC_CONFIG_FILES(newlib/crystal/Makefile)
728    AC_CONFIG_FILES(newlib/electro-optics/Makefile)
729    AC_CONFIG_FILES(newlib/headers/Makefile)
730    AC_CONFIG_FILES(newlib/keystone/Makefile)
731    AC_CONFIG_FILES(newlib/msp430/Makefile)
732    AC_CONFIG_FILES(newlib/not_vetted_ingo/Makefile)
733    AC_CONFIG_FILES(newlib/sockets/Makefile)
734    AC_CONFIG_FILES(newlib/tests/Makefile)
736 AC_CONFIG_FILES(src/Makefile)
737 AC_CONFIG_FILES(src/icons/Makefile)
738 if test -d $srcdir/tools; then
739    AC_CONFIG_FILES(tools/Makefile)
741 if test -d $srcdir/tutorial; then
742    AC_CONFIG_FILES(tutorial/Makefile)
745 AC_CONFIG_FILES(win32/Makefile)
747 AC_OUTPUT
749 with_gui=`echo $with_gui`
750 with_printer=`echo $with_printer`
751 with_exporters=`echo $with_exporters | sed 's/,/ /g'`
753 AC_MSG_RESULT([
754 ** Configuration summary for $PACKAGE $VERSION:
756    GUI:                      $with_gui
757    Printer:                  $with_printer
758    Exporters:                $with_exporters
759    Build documentation:      $docs_yesno
760    dmalloc debugging:        $with_dmalloc
761    ElectricFence debugging:  $with_efence
762    CPPFLAGS:                 $CPPFLAGS
763    CFLAGS:                   $CFLAGS
764    LIBS:                     $LIBS