Updated gettext to 0.11.5
[geda-gaf/whiteaudio.git] / gschem / configure.in
blob59a1d1609eedefcb66b6ab21173d87c8eaff051f
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT
3 AC_CONFIG_SRCDIR([noweb/gschem.nw])
5 dnl Initialize automake stuff
6 PACKAGE=geda-gschem
8 DATADIR=gEDA
10 # new way of doing version
11 VERSION=20021103
13 echo Configuring gschem version $VERSION
15 dnl --disable-strokes : turn off stroke support
16 AC_ARG_ENABLE(strokes,
17     [  --disable-strokes       Disable stroke support (don't use LibStroke at all)],
18     [
19         if test $enableval = "no"; then
20                 no_strokes=yes
21         fi
22     ])
24 dnl --disable-gdgeda : turn off libgdgeda support
25 AC_ARG_ENABLE(gdgeda,
26     [  --disable-gdgeda        Disable libgdgeda support (don't use libgdgeda at all)],
27     [
28         if test $enableval = "no"; then
29                 no_gdgeda=yes
30         fi
31     ])
33 dnl --enable-debug : turn on debugging support (normally off)
34 AC_ARG_ENABLE(debug,
35     [  --enable-debug          Enable debugging support],
36     [
37         if test $enableval = "no"; then
38                 debug=yes
39         fi
40     ])
42 dnl Change default location of gtk-config
43 AC_ARG_WITH(gtk-config, [  --with-gtk-config=path  Change where gtk-config is located], [opt_gtkconfig=$withval])
45 dnl Change default location for rc files
46 AC_ARG_WITH(rcdir, [  --with-rcdir=path       Change where the system-*rc files are installed], [opt_rcdir=$withval])
48 dnl Initialize automake stuff
49 dnl AM_INIT_AUTOMAKE($PACKAGE, $GEDA_VER_MAJOR.$GEDA_VER_MINOR.$GEDA_VER_MICRO, no-define)
50 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
52 dnl Create a configuration header
53 AM_CONFIG_HEADER(config.h)
55 dnl Build time sanity check...
56 AM_SANITY_CHECK
58 dnl Initialize maintainer mode
59 AM_MAINTAINER_MODE
61 dnl Checks for programs.
62 AC_PROG_CC
63 dnl AC_PROG_LEX
64 dnl AC_PROG_LEX()
65 AC_PROG_MAKE_SET
67 AC_CYGWIN
69 if test "$CYGWIN" = "yes"; then
70           AC_MSG_ERROR(Building gEDA/gaf under cygwin is not supported)       
73 AC_MINGW32
75 dnl Guile stuff
76 GUILE_FLAGS
78 dnl Check if scm_run_hook are defined 
79 AC_CHECK_LIB(guile, scm_run_hook,,
80         AC_MSG_ERROR(**Upgrade Guile**  At least version >= 1.3.2),
81         $GUILE_LDFLAGS)
83 dnl Restore LIBS. Apperantly AC_CHECK_LIB destroys it.
84 LIBS="$ac_save_LIBS"
86 dnl Check if scm_hook_empty_p are defined 
87 AC_CHECK_LIB(guile, scm_hook_empty_p,,
88         AC_MSG_ERROR(**Upgrade Guile**  At least version >= 1.3.2),
89         $GUILE_LDFLAGS)
91 dnl Restore LIBS. Apperantly AC_CHECK_LIB destroys it.
92 LIBS="$ac_save_LIBS"
94 saved_cflags="$CFLAGS"
95 saved_ldflags="$LDFLAGS"
97 dnl Checks for header files.
98 AC_PATH_X
99 AC_PATH_XTRA
101 CFLAGS="$X_CFLAGS $CFLAGS"
102 LDFLAGS="$X_LDFLAGS $X_LIBS $LDFLAGS"
103 X_EXTRA_LIBS="$X_EXTRA_LIBS -lX11 -lm"
105 dnl Checks for X libraries.
106 AC_CHECK_LIB(X11, XOpenDisplay, X_LIBS="-lX11", X_LIBS=no, $X_EXTRA_LIBS)
107 AC_CHECK_LIB(Xext, XShmAttach, X_LIBS="-lXext $X_LIBS", X_EXT=no, $X_EXTRA_LIBS)
108 dnl AC_CHECK_LIB(Xext, XShmAttach, X_LIBS="-lXext $X_LIBS", XEXT=no, $X_EXTRA_LIBS)
110 if test "$MINGW32" = "no" -o "$MINGW32"x = x; then
111         if test "$X_LIBS" = no; then
112           AC_MSG_ERROR(Cannot find -lX11 library)
113         fi
114 else
115         echo X11 not required for MINGW32 port
118 dnl Checking for rint in math library
119 AC_CHECK_LIB(m, rint, AC_DEFINE(HAS_RINT), no_RINT="yes")
121 dnl Checking for dynamic lib
122 AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", DL_LIB="")
124 if eval "test x$opt_gtkconfig != x" ; then
126         if test ! -r "$opt_gtkconfig"; then
128                 AC_MSG_ERROR(Cannot find $opt_gtkconfig -- be sure that this pathname is correct)
130         else
131                 GTK_CONFIG=$opt_gtkconfig
132         fi
133 else
134         AM_PATH_GTK(1.2.3,,AC_MSG_ERROR([*** GTK+ >= 1.2.3 not installed - please install first ***]))
137 if test $GTK_CONFIG = "no"; then
138         AC_MSG_ERROR(Cannot find gtk-config -- be sure that gtk >= 0.99.7 is installed)
141         gtk_ldflags="`$GTK_CONFIG --libs`"
142         gtk_cflags="`$GTK_CONFIG --cflags`"
144 # search for libgdgeda-config
145 AC_PATH_PROG(LIBGDGEDACONFIG, libgdgeda-config, no, ${PATH})
147 if test $LIBGDGEDACONFIG = "no" -o no_gdgeda = yes; then
148          GDGEDA_LIB=""
149          libgdgeda_ldflags=""
150          libgdgeda_cflags=""
151 else
152          libgdgeda_ldflags=`$LIBGDGEDACONFIG --libs`
153          libgdgeda_cflags=`$LIBGDGEDACONFIG --cflags`
154          GD_EXTRA="$libgdgeda_cflags $libgdgeda_ldflags -lm"
155          X_CFLAGS="$libgdgeda_cflags"
157          AC_CHECK_LIB(z, uncompress, Z_LIB="-lz", Z_LIB=no)
158          if test $Z_LIB = no; then
159                 AC_MSG_ERROR(Cannot find libz (zlib), be sure to install zlib; it is required for libgdgeda)
160          else
162                 PNG_EXTRA="-lz -lm"
163                 AC_CHECK_LIB(png, png_read_png, PNG_LIB="-lpng", PNG_LIB=no, $PNG_EXTRA)
165                 if test $PNG_LIB = no; then
166                         AC_MSG_ERROR(Cannot find libpng, be sure to install png; it is required for libgdgeda)
167                 else
168                         AC_CHECK_LIB(gdgeda, gdImageColorAllocate, GDGEDA_LIB="-lgdgeda", GDGEDA_LIB=no, $GD_EXTRA)
170                         if test $GDGEDA_LIB = no; then
171                                 GDGEDA_LIB=""
172                                 libgdgeda_ldflags=""
173                                 libgdgeda_cflags=""
174                         else
175                                 AC_DEFINE(HAS_LIBZ)
176                                 AC_DEFINE(HAS_LIBPNG)
177                                 AC_DEFINE(HAS_LIBGDGEDA)
178                         fi
179                 fi
180         fi
183 # search for gtkextra-config
184 AC_PATH_PROG(GTKEXTRACONFIG, gtkextra-config, no, ${PATH})
186 if test $GTKEXTRACONFIG = "no"; then
187         gtkextra_ldflags=""
188         gtkextra_cflags=""
189 else
190         gtkextra_ldflags=`$GTKEXTRACONFIG --libs`
191         gtkextra_cflags=`$GTKEXTRACONFIG --cflags`
192         GTK_EXTRA="$gtk_cflags $gtkextra_cflags $gtkextra_ldflags $gtk_ldflags -lm"
193         AC_CHECK_LIB(gtkextra, gtk_sheet_new, GTKEXTRA_LIB="-lgtkextra", GTKEXTRA_LIB=no, $GTK_EXTRA)
194         if test $GTKEXTRA_LIB = "no"; then
195                 AC_MSG_ERROR(gtkextra library improperly installed)
196         else    
197                 AC_DEFINE(HAS_LIBGTKEXTRA)
198         fi
201 # search for libgeda-config
202 AC_PATH_PROG(LIBGEDACONFIG, libgeda-config, no, ${PATH})
204 if test $LIBGEDACONFIG = "no"; then
205         AC_MSG_ERROR(Cannot find libgeda-config -- be sure that libgeda is installed)
209 libgeda_version=`$LIBGEDACONFIG --version`
210 if test $libgeda_version != $VERSION; then
211         AC_MSG_ERROR(Found a different version of libgeda-config: $LIBGEDACONFIG -- Make sure your PATH variable is correct)
215 # search for gesym-config
216 AC_PATH_PROG(GESYMCONFIG, gesym-config, no, ${PATH})
218 if test $GESYMCONFIG = "no"; then
219           AC_MSG_ERROR(Cannot find gesym-config -- be sure that the symbols are installed)
220         fi
222 gesym_version=`$GESYMCONFIG --version`
223 if test $gesym_version != $VERSION; then                                                AC_MSG_ERROR(Found a different version of gesym-config: $GESYMCONFIG -- Make sure your PATH variable is correct)
226 AC_CHECK_LIB(stroke, stroke_init, STROKE_LIB="-lstroke", STROKE_LIB=no)
228 if test $STROKE_LIB = no; then
229         STROKE_LIB=""
230 else 
231         if test "$no_strokes" = "yes"; then
232                 echo found libstroke, but disabling strokes
233                 STROKE_LIB=""
234         else 
235                 AC_DEFINE(HAS_LIBSTROKE)
236         fi
239 # here is where the final X ld/c flags get set
240 LDEXTRA=
241 CFEXTRA=
242 GTK=
243 GDK=
244 GLIB=
245 X_LDFLAGS="`$LIBGEDACONFIG --libs` $libgdgeda_ldflags $gtkextra_ldflags $gtk_ldflags"
246 X_CFLAGS="$gtk_cflags $libgdgeda_cflags $gtkextra_cflags `$LIBGEDACONFIG --cflags`"
247 gtkversion=`$GTK_CONFIG --version | cut -d. -f1,2`
249 AC_DEFINE_UNQUOTED(GTKVERSION, "$gtkversion")
251 dnl old way of doing this, see if new way works 
252 dnl CFLAGS="$CFLAGS $CFEXTRA `$GTK_CONFIG --cflags`"
254 CFLAGS="`$GTK_CONFIG --cflags` $CFLAGS $CFEXTRA"
255 LDFLAGS="$LDEXTRA `$GTK_CONFIG --libs` $LDFLAGS"
257 AC_MSG_CHECKING([for the rest of gtk])
258 AC_TRY_COMPILE(
259 [#include <gtk/gtk.h>],
260 [GtkArgSetFunc arg_set_func;],
261 gtk_found=yes,
262 gtk_found=no)
263 AC_MSG_RESULT($gtk_found)
265 if test $gtk_found = no; then
266         AC_MSG_ERROR(Cannot include/link gtk/gdk/glib--check CFLAGS/LDFLAGS)
269 LDFLAGS="$saved_ldflags $LDEXTRA"
270 CFLAGS="$saved_cflags $CFEXTRA"
272 if ! test "$MINGW32" = "no" -o "$MINGW32"x = x; then
273         echo Including -fnative-struct in CFLAGS for MINGW32 port
274         echo Including -mwindows in CFLAGS for MINGW32 port
275         echo Including -lregex in LDFLAGS for MINGW32 port
276         CFLAGS="$CFLAGS -fnative-struct -mwindows"
277         X_LDFLAGS="-lregex -liberty $X_LDFLAGS"
278         PATHSEP=\\\\
279         OTHERPATHSEP=/
280 else
281         PATHSEP=/
282         OTHERPATHSEP=\\\\
285 if test "$debug" = "yes"; then
286         CFLAGS="$CFLAGS -g"
290 # Tangling is required if there is no C source files in the src/ 
291 # directory. Therefore they need to be extracted from the documented
292 # sources in noweb/ either with notangle or notangle_guile.scm.
294 # notangle is the utility that comes with the noweb package.
295 # notangle_guile.scm is a script that act the same as notangle
296 # but only require a guile interpreter with built-in module regex
297 # and getopt-long
299 # search for notangle
300 AC_PATH_PROG(NOTANGLE, notangle, no, ${PATH})
301 # BUG: should check *ALL* files and dependencies!
302 cfiles=`\ls -1 src/gschem.c 2> /dev/null`
303 exit_status=$?
305 if test "$NOTANGLE" = "no" -a "$exit_status" = "1"; then
306         # notangle not found, and no C sources in src 
307         # need notangle_guile.scm
308         echo "** Cannot find notangle (part of noweb) : using notangle_guile.scm instead **"
309         
310         # find the guile interpreter
311         AC_PATH_PROG(GUILEINTERP, guile, no, ${PATH})
312         if test "$GUILEINTERP" = "no"; then
313            AC_MSG_ERROR(guile interpreter is required)
314         fi
315   
316         # check (ice-9 getopt-long) module in guile
317         AC_MSG_CHECKING([for getopt-long module in guile])
318         guilegetopt=`$GUILEINTERP -c  '(use-modules (ice-9 getopt-long))' 2> /dev/null`
319         exit_status=$?
320         if test "$exit_status" = "1"; then
321            AC_MSG_RESULT([no])
322            echo "no support for getopt-long module in guile interpreter"
323            AC_MSG_ERROR(this module is required by notangle_guile.scm but is not available in the interpreter)
324         fi
325         AC_MSG_RESULT([yes])
327         # check (ice-9 regex) module in guile
328         AC_MSG_CHECKING([for regex module in guile])
329         guileregex=`$GUILEINTERP -c  '(use-modules (ice-9 regex))' 2> /dev/null`
330         exit_status=$?
331         if test ! "$exit_status" = "0"; then
332            AC_MSG_RESULT([no])
333            echo "no support for regex module in guile interpreter"
334            AC_MSG_ERROR(this module is required by notangle_guile.scm but is not available in the interpreter)
335         fi
336         AC_MSG_RESULT([yes])
338         # set NOTANGLE and NOTANGLEROOT to use notangle_guile.scm
339         # as the result of the previous tests
340         #  - NOTANGLE is the relative pathname to script from the source dir
341         #  - NOTANGLEROOT is the option to give the root code chunk name
342         #  - NOTANGLEFLAGS are other flags to notangle_guile.scm
343         NOTANGLE="../scripts/notangle_guile.scm"
344         NOTANGLEROOT="--rootname="
345         NOTANGLEFLAGS=""
347         echo "--            notangle_guile.scm should work fine on this system           --"
349 else
350         # NOTANGLE has been set by AC_PATH_PROG above
351         NOTANGLEROOT="-R"
352         NOTANGLEFLAGS="-L"
357 # Weaving is extracting the documentation from the noweb files.
358 # The noweb package provides noweave to weave these files.
360 # The documentation is here written in Texinfo. A backend is 
361 # provided in scripts to format the code chunks in Texinfo.
363 # The noweave program is therefore required to produce the 
364 # documentation but building documentation is optionnal.
367 # search for noweave
368 AC_PATH_PROG(NOWEAVE, noweave, no, ${PATH})
369 # search for AWK
370 #  the noweb texinfo backend is based on awk. If awk is not available,
371 #  the backend will not work, and therefore it disables the 
372 #  documentation creation.
373 AC_PROG_AWK
375 if test "$NOWEAVE" = "no" -o "$AWK" = "no"; then 
376         # noweave is not available on the system
377         echo "** Cannot find noweave (part of noweb)! **"
378         echo "**   Documentation creation disabled    **"
379         NOWEAVE=echo
381         # prevent from weaving the nw files
382         # but does not prevent from processing gschemdoc
383         builddoc=false
385 else 
386         # noweave is available on the system.
387         # now checking if the tools for Texinfo files processing
388         # is installed.
389         # The docs can be either processed to produce dvi, html or info
390         # with texi2dvi, texi2html or makeinfo respectively
391         # Note : these tests on makeinfo and texi2dvi are no more 
392         #        needed as automake makes them for us
394         # enable the weaving of the nw files to get documentation
395         builddoc=true
399 # depending on variable builddoc, weaving is performed or not
400 # using conditionnal in docs/Makefile.in
401 AM_CONDITIONAL(BUILDDOC, test x$builddoc = xtrue)
403 # search for texi2html
404 # it looks like automake does not take care of html doc creation
405 AC_PATH_PROG(TEXI2HTML, texi2html, no, ${PATH})
407 if test "$TEXI2HTML" = "no"; then 
408    echo "**   Cannot find texi2html     **"
409    echo "** HTML file creation disabled **"
410    TEXI2HTML=echo
414 # search for indent
415 AC_PATH_PROG(INDENT, indent, no, ${PATH})
417 if ! test "$INDENT" = "no"; then 
418         indentversion=`$INDENT --version | grep GNU`
419 else 
420         indentversion=
423 if test "$INDENT" = "no" -o "$indentversion"x = x; then 
424         AC_PATH_PROG(GINDENT, gindent, no, ${PATH})
426         if test "$GINDENT" = "no"; then 
427                 echo "** Cannot find GNU indent or gindent, C code formatting disabled **"
428                 INDENT=echo
429         else
430                 INDENT=$GINDENT
431         fi
434 AC_HEADER_STDC
435 AC_HEADER_SYS_WAIT
436 AC_HEADER_DIRENT
437 AC_CHECK_HEADERS(unistd.h string.h stdlib.h \
438                  stdarg.h assert.h fcntl.h errno.h sys/param.h)
440 dnl Checks for typedefs, structures, and compiler characteristics.
441 AC_C_CONST
443 dnl Checks for library functions.
444 AC_TYPE_SIGNAL
445 AC_CHECK_FUNCS(getcwd strstr vsnprintf snprintf)
447 AC_MSG_CHECKING([for optarg in unistd.h])
448 AC_TRY_COMPILE(
449 [#include <unistd.h>],
450 [ char *string = optarg; int i = optind; ],
451 optarg_found=yes,
452 optarg_found=no)
453 AC_MSG_RESULT($optarg_found)
455 if test $optarg_found = yes; then
456                 AC_DEFINE(OPTARG_IN_UNISTD)
459 gedatopdir=`$GESYMCONFIG --toplevel`
460 HOME=`echo $HOME`
462 if eval "test x$opt_rcdir = x"; then
463         # path was not specified with --with-rcdir
464         # don't set the GEDARCDIR in config.h
465         AC_DEFINE_UNQUOTED(GEDARCDIR, "none")
466         GEDARCDIR="$gedatopdir"
467 else
468         # path WAS specified with --with-rcdir
469         AC_DEFINE_UNQUOTED(GEDARCDIR, "$opt_rcdir")
470         GEDARCDIR="$opt_rcdir"
474 AC_DEFINE_UNQUOTED(GEDADATADIR, "$gedatopdir")
475 GEDADATADIR=$gedatopdir
477 AM_GNU_GETTEXT
478 AM_GNU_GETTEXT_VERSION(0.11.5)
480 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
482 AC_SUBST(HOME)
483 AC_SUBST(GTKVERSION)
484 AC_SUBST(GEDARCDIR)
485 AC_SUBST(GEDADATADIR)
486 AC_SUBST(PATHSEP)
487 AC_SUBST(OTHERPATHSEP)
489 AC_SUBST(X_CFLAGS)
490 AC_SUBST(X_LDFLAGS)
491 AC_SUBST(X_LIBS)
492 AC_SUBST(STROKE_LIB)
493 AC_SUBST(DL_LIB)
494 AC_SUBST(GTK)
495 AC_SUBST(GDK)
496 AC_SUBST(GLIB)
498 AC_SUBST(NOTANGLE)
499 AC_SUBST(NOTANGLEROOT)
500 AC_SUBST(NOTANGLEFLAGS)
501 AC_SUBST(GUILEINTERP)
502 AC_SUBST(NOWEAVE)
503 AC_SUBST(TEXI2HTML)
504 AC_SUBST(INDENT)
506 AC_CONFIG_FILES([Makefile m4/Makefile po/Makefile.in intl/Makefile \
507                 src/Makefile        \
508                 include/Makefile    \
509                 scheme/Makefile     \
510                 bitmap/Makefile     \
511                 scripts/Makefile    \
512                 examples/Makefile   \
513                 docs/Makefile       \
514                 lib/Makefile        \
515                 noweb/Makefile      \
516                 tests/Makefile      \
517                 lib/system-gschemrc \
518                 scripts/geda_totexi \
519                 scripts/notangle_guile.scm ])
520 AC_CONFIG_COMMANDS([geda_totexi-chmod],[[chmod +x scripts/geda_totexi]],[[]])
521 AC_CONFIG_COMMANDS([notangle_guile.scm-chmod],[[chmod +x scripts/notangle_guile.scm]],[[]])
522 AC_OUTPUT