]> git.donarmstrong.com Git - lilypond.git/blob - aclocal.m4
release: 1.5.44
[lilypond.git] / aclocal.m4
1 dnl WARNING WARNING WARNING WARNING
2 dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4
3 dnl aclocal.m4   -*-shell-script-*-
4 dnl StepMake subroutines for configure.in
5
6 AC_DEFUN(AC_STEPMAKE_BIBTEX2HTML, [
7     AC_CHECK_PROGS(BIBTEX2HTML, bibtex2html bib2html, error)
8     if test "$BIBTEX2HTML" = "bib2html"; then
9         BIBTEX2HTML_FLAGS='$< $(@)'
10     else
11         BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
12     fi
13     AC_SUBST(BIBTEX2HTML)
14     AC_SUBST(BIBTEX2HTML_FLAGS)
15 ])
16
17
18 AC_DEFUN(AC_STEPMAKE_COMPILE, [
19     # -O is necessary to get inlining
20     CFLAGS=${CFLAGS:-""}
21     CXXFLAGS=${CXXFLAGS:-$CFLAGS}
22     LDFLAGS=${LDFLAGS:-""}
23     checking_b=yes
24     optimise_b=yes
25     profile_b=no
26     debug_b=yes
27
28     AC_ARG_ENABLE(checking,
29     [  --enable-checking       set runtime checks (assert calls).  Default: on],
30     [checking_b=$enableval] )
31
32     AC_ARG_ENABLE(debugging,
33     [  --enable-debugging      compile with debugging info.  Default: on],
34     [debug_b=$enableval])
35
36     AC_ARG_ENABLE(optimising,
37     [  --enable-optimising      compile with optimising.  Default: on],
38     [optimise_b=$enableval])
39
40     AC_ARG_ENABLE(profiling, 
41     [  --enable-profiling      compile with gprof support.  Default: off],
42     [profile_b=$enableval])
43     
44
45     if test "$checking_b" = no; then
46         # ugh
47         AC_DEFINE(NDEBUG)
48         DEFINES="$DEFINES -DNDEBUG"
49     fi
50
51     if test "$optimise_b" = yes; then
52         OPTIMIZE="-O2 -finline-functions"
53     fi
54
55
56     if test $profile_b = yes; then
57         EXTRA_LIBES="-pg"
58         OPTIMIZE="$OPTIMIZE -pg"
59     fi
60
61     if test $debug_b = yes; then        
62         OPTIMIZE="$OPTIMIZE -g"
63     fi
64
65
66     AC_PROG_CC
67     LD='$(CC)'
68     AC_SUBST(LD)
69
70     CFLAGS="$CFLAGS $OPTIMIZE"
71     CPPFLAGS=${CPPFLAGS:-""}
72
73     AC_MSG_CHECKING([for IEEE-conformance compiler flags])
74     save_cflags="$CFLAGS"
75     case "$host" in
76         alpha*-*-*)
77             dnl should do compile test?
78             AC_MSG_RESULT(-mieee)
79             CFLAGS="-mieee $CFLAGS"
80             ;;
81         *)
82             AC_MSG_RESULT([none])
83             ;;
84     esac
85     AC_SUBST(cross_compiling)
86     AC_SUBST(CFLAGS)
87     AC_SUBST(CPPFLAGS)
88     AC_SUBST(LDFLAGS)
89     AC_SUBST(ICFLAGS)
90     AC_SUBST(ILDFLAGS)
91     AC_SUBST(DEFINES)
92     AC_SUBST(EXTRA_LIBES)
93 ])
94
95 AC_DEFUN(AC_STEPMAKE_CXX, [
96     AC_LANG_CPLUSPLUS
97     AC_PROG_CXX
98
99     AC_CHECK_HEADER(FlexLexer.h, true,
100         AC_STEPMAKE_WARN(can"\'"t find flex header. Please install Flex headers correctly))
101
102     CPPFLAGS="$CPPFLAGS $DEFINES"
103     CXXFLAGS="$CXXFLAGS $OPTIMIZE"
104     LDFLAGS="$LDFLAGS $EXTRA_LIBES"
105
106     AC_SUBST(CXXFLAGS)
107     AC_SUBST(CXX)
108     LD='$(CXX)'
109     AC_SUBST(LD)
110 ])
111
112 AC_DEFUN(AC_STEPMAKE_CXXTEMPLATE, [
113     AC_CACHE_CHECK([whether explicit instantiation is needed],
114         lily_cv_need_explicit_instantiation,
115         AC_TRY_LINK([
116     template <class T> struct foo { static int baz; };
117     template <class T> int foo<T>::baz = 1;
118     ], [ return foo<int>::baz; ],
119             lily_cv_need_explicit_instantiation=no,
120             lily_cv_need_explicit_instantiation=yes))
121     if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
122         AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
123     fi
124 ])
125
126 AC_DEFUN(AC_STEPMAKE_DATADIR, [
127     if test "$datadir" = "\${prefix}/share"; then
128             datadir='${prefix}/share/'$package
129     fi
130     DIR_DATADIR=${datadir}
131     presome=${prefix}
132     if test "$prefix" = "NONE"; then
133             presome=${ac_default_prefix}
134     fi
135     DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"`
136
137     AC_SUBST(datadir)
138     AC_SUBST(DIR_DATADIR)
139     
140     dnl yeah, so fuck me gently with a cactus: this doesnt belong here
141     dnl Please take the person responsible for inventing shell-scripts out
142     dnl and shoot him. On behalf of the sane world, thank you.
143     dnl DIR_SHAREDSTATEDIR="foobar"
144     dnl AC_SUBST(DIR_SHAREDSTATEDIR)
145     
146     AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
147 ])
148
149 AC_DEFUN(AC_STEPMAKE_END, [
150     AC_OUTPUT($CONFIGFILE.make:config.make.in)
151
152     # regular in-place build
153     # test for srcdir_build = yes ?
154     if test "$builddir" = "."; then
155         rm -f $srcdir/GNUmakefile
156         cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
157         chmod 444 $srcdir/GNUmakefile
158     else # --srcdir build
159         rm -f GNUmakefile
160         cp $srcdir/make/srcdir.make.in GNUmakefile
161         chmod 444 GNUmakefile
162     fi
163 ])
164
165 AC_DEFUN(AC_STEPMAKE_GXX, [
166     AC_MSG_CHECKING("g++ version")
167     cxx_version=`$CXX --version`
168     AC_MSG_RESULT("$cxx_version")
169     changequote(<<, >>)dnl
170     # urg, egcs: how to check for egcs >= 1.1?
171     if expr "$cxx_version" : '.*2\.[89]' > /dev/null ||
172         expr "$cxx_version" : '.*egcs' > /dev/null ||
173         expr "$cxx_version" : '3\.0' > /dev/null
174     changequote([, ])dnl
175     then
176             true
177     else
178             AC_STEPMAKE_WARN(can\'t find g++ 2.8, 2.9, 3.0 or egcs 1.1)
179     fi
180 ])
181
182 AC_DEFUN(AC_STEPMAKE_GUILE, [
183     ## First, let's just see if we can find Guile at all.
184     AC_MSG_CHECKING("for guile-config")
185     for guile_config in guile-config $target-guile-config $build-guile-config; do
186         AC_MSG_RESULT("$guile_config")
187         if ! $guile_config --version > /dev/null 2>&1 ; then
188             AC_MSG_WARN("cannot execute $guile_config")
189             AC_MSG_CHECKING("if we are cross compiling")
190             guile_config=error
191         else
192             break
193         fi
194     done
195     if test "$guile_config" = "error"; then
196         AC_MSG_ERROR("cannot find guile-config; is Guile installed?")
197         exit 1
198     fi
199     AC_MSG_CHECKING("Guile version")
200     need_guile_version="1.3.4"
201     need_guile_version_numeric=100304
202     guile_version=`$guile_config --version 2>&1 | awk '{print $NF}'`
203     guile_version_numeric=`echo $guile_version | awk -F. '
204 {if ([$]3) {last = [$]3}
205 else {last =0}}
206 {printf "%s%s%s\n",[$]1*100, [$]2*10,last}'`
207     AC_MSG_RESULT("$guile_version")
208     if test $guile_version_numeric -lt $need_guile_version_numeric
209     then
210         AC_STEPMAKE_WARN("Guile version "$need_guile_version" or newer is needed")
211     fi
212     changequote(<<, >>)dnl
213     GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
214     GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
215     changequote([, ])dnl
216     GUILE_FLAGS
217     AC_PATH_PROG(GUILE, guile, error)
218     AC_SUBST(GUILE)
219     AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
220     AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
221 ])
222
223 AC_DEFUN(AC_STEPMAKE_INIT, [
224
225     . $srcdir/VERSION
226     FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
227     if test x$MY_PATCH_LEVEL != x; then
228         FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
229     fi
230
231     # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
232     changequote(<<, >>)dnl
233     PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
234     package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
235     changequote([, ])dnl
236
237     # No versioning on directory names of sub-packages 
238     # urg, urg
239     stepmake=${datadir}/stepmake
240     presome=${prefix}
241     if test "$prefix" = "NONE"; then
242             presome=${ac_default_prefix}
243     fi
244     stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
245
246     # urg, how is this supposed to work?
247     if test "$program_prefix" = "NONE"; then
248           program_prefix=
249     fi
250     if test "$program_suffix" = "NONE"; then
251           program_suffix=
252     fi
253
254     AC_MSG_CHECKING(Package)
255     if test "x$PACKAGE" = "xSTEPMAKE"; then
256         AC_MSG_RESULT(Stepmake package!)
257
258         AC_MSG_CHECKING(builddir)
259         if test "$srcdir" = "."; then
260             builddir=.
261         else
262             absolute_builddir="`pwd`"
263             package_absolute_builddir="`dirname $absolute_builddir`"
264             package_srcdir="`dirname  $srcdir`"
265             builddir="`dirname $package_srcdir`/`basename $package_absolute_builddir`/`basename $absolute_builddir`"
266         fi
267         AC_MSG_RESULT($builddir)
268
269         (cd stepmake 2>/dev/null || mkdir stepmake)
270         (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
271         AC_CONFIG_AUX_DIR(bin)
272         stepmake=stepmake
273     else
274         AC_MSG_RESULT($PACKAGE)
275
276         AC_MSG_CHECKING(builddir)
277         if test "$srcdir" = "."; then
278             builddir=.
279             srcdir_build=no
280         else
281             absolute_builddir="`pwd`"
282 #           builddir="`dirname  $srcdir`/`basename $absolute_builddir`"
283             builddir="`bash $srcdir/buildscripts/walk.sh \"$srcdir\"`"
284             srcdir_build=yes
285         fi
286         AC_MSG_RESULT($builddir)
287         if expr "$srcdir" : '/' > /dev/null 2>&1; then
288             absolute_srcdir=yes
289             AC_STEPMAKE_WARN(Absolute --srcdir specified: $srcdir)
290         fi
291
292         AC_MSG_CHECKING(for stepmake)
293         # Check for installed stepmake
294         if test -d $stepmake; then
295             AC_MSG_RESULT($stepmake)
296         else
297             if test "$absolute_srcdir" != "yes"; then
298                 stepmake='$(depth)'/$srcdir/stepmake
299             else
300                 stepmake=$srcdir/stepmake
301             fi
302             AC_MSG_RESULT($srcdir/stepmake  ($datadir/stepmake not found))
303         fi
304
305         AC_CONFIG_AUX_DIR(\
306           $HOME/usr/local/share/stepmake/bin\
307           $HOME/usr/local/lib/stepmake/bin\
308           $HOME/usr/share/stepmake/bin\
309           $HOME/usr/lib/stepmake/bin\
310           /usr/local/share/stepmake/bin\
311           /usr/local/lib/stepmake/bin\
312           /usr/share/stepmake/bin\
313           /usr/lib/stepmake/bin\
314           stepmake/bin\
315           $srcdir/stepmake/bin\
316         )
317     fi
318
319     AC_SUBST(builddir)
320     AC_SUBST(stepmake)
321     AC_SUBST(package)
322     AC_SUBST(PACKAGE)
323     AC_SUBST(PACKAGE_NAME)
324     AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE_NAME}")
325     AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, "${FULL_VERSION}")
326
327     if test "$package_depth" = "" ; then
328         package_depth="."
329     else
330         package_depth="../$package_depth"
331     fi
332     export package_depth
333     AC_SUBST(package_depth)
334
335     AUTOGENERATE="This file was automatically generated by configure"
336     AC_SUBST(AUTOGENERATE)
337
338     CONFIGSUFFIX=
339     AC_ARG_ENABLE(config,
340     [  --enable-config=CONF    put settings in config-CONF.make and config-CONF.h;
341                             do \`make conf=CONF' to get output in ./out-CONF],
342     [CONFIGURATION=$enableval])
343
344     test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
345     CONFIGFILE=config$CONFIGSUFFIX
346     AC_SUBST(CONFIGSUFFIX)
347      
348     AC_CANONICAL_HOST
349     AC_CHECK_PROGS(MAKE, gmake make, error)
350     AC_CHECK_PROGS(FIND, find, error)
351
352 dnl system supplied INSTALL is unsafe; use our own install.
353 dnl    AC_PROG_INSTALL
354 dnl    if test "$INSTALL" = "bin/install-sh"; then
355 dnl     export INSTALL="\$\(depth\)/bin/install-sh"
356 dnl    fi
357
358     AC_CHECK_PROGS(TAR, tar, error)
359
360     if test "x`uname`" = "xHP-UX"; then
361         AC_PATH_PROG(BASH, bash, /bin/sh)
362         AC_STEPMAKE_WARN(avoiding buggy /bin/sh)
363         AC_PATH_PROG(SHELL, bash, /bin/ksh)
364     else
365         AC_PATH_PROG(BASH, bash, /bin/sh)
366         SHELL=/bin/sh
367         AC_SUBST(SHELL)
368     fi
369
370
371     AC_PATH_PROG(PYTHON, ${PYTHON:-python}, -echo no python)
372     AC_SUBST(PYTHON)
373
374     if test $MAKE != "error" ; then
375         $MAKE -v 2> /dev/null | grep GNU > /dev/null
376         if test "$?" = 1
377         then
378                 AC_STEPMAKE_WARN(Please install *GNU* make) 
379         fi
380     fi 
381
382     AC_CHECK_SEARCH_RESULT($PYTHON, python, You should install Python)
383
384     if test "x$OSTYPE" = "xcygwin32" || test "x$OSTYPE" = "xWindows_NT"; then
385         LN=cp # hard link does not work under cygnus-nt
386         LN_S='cp -r' # symbolic link does not work for native nt
387         ZIP="zip -r -9" #
388         program_suffix=.exe
389         # urg
390         # ROOTSEP=':'
391         # DIRSEP='\\'
392         # PATHSEP=';'
393         #
394         # cygwin fixes all these things.  
395         # it seems these were used because of dos-style TEXINPUTS and
396         # MFINPUTS needed for miktex.
397         # but this breaks parsing of all other cygwin/unix style paths.
398         #
399         # if your (mik)tex breaks, make a:
400         #    /usr/local/bin/tex:
401         #    #!/bin/sh
402         #    TEXINPUTS=`cygpath -pw $TEXINPUTS` /texmf/miktex/bin/tex $*
403         #
404         # and
405         #
406         #    /usr/local/bin/mf:
407         #    #!/bin/sh
408         #    MFINPUTS=`cygpath -pw $MFINPUTS` /texmf/miktex/bin/mf $*
409         #
410         # this way, you may have buildscripts/out/lilypond-profile 
411         # 'automatically' sourced from /usr/etc/profile.d/ too.
412         #
413         ROOTSEP=':'
414         DIRSEP='/'
415         PATHSEP=':'
416         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
417     else
418         ROOTSEP=':'
419         DIRSEP='/'
420         PATHSEP=':'
421         LN=ln
422         LN_S='ln -s'
423         ZIP="zip -r -9"
424         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
425     fi
426     AC_SUBST(program_prefix)
427     AC_SUBST(program_suffix)
428     AC_SUBST(ZIP)
429     AC_SUBST(LN)
430     AC_SUBST(LN_S)
431     AC_SUBST(INSTALL)
432     AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}')
433     AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}')
434     AC_SUBST(PATHSEP)
435     AC_SUBST(DIRSEP)
436   
437     AC_STEPMAKE_DATADIR
438 ])
439
440 AC_DEFUN(AC_STEPMAKE_KPATHSEA, [
441
442     kpathsea_b=yes
443     #FIXME --with-xxx is meant for specifying a PATH too,
444     # so this should read: --enable-kpathsea,
445     # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
446     AC_ARG_WITH(kpathsea,
447     [  --with-kpathsea         use kpathsea lib.  Default: on],
448     [kpathsea_b=$with_kpathsea])
449
450     if test "$kpathsea_b" != "no"; then 
451         AC_HAVE_HEADERS(kpathsea/kpathsea.h)
452         AC_CHECK_LIB(kpathsea, kpse_find_file)
453         AC_CHECK_FUNCS(kpse_find_file,, AC_ERROR(Cannot find kpathsea functions.  You should install kpathsea; see INSTALL.txt.  Rerun ./configure --without-kpathsea only if kpathsea is not available for your platform.))
454     fi
455     AC_MSG_CHECKING(whether to use kpathsea)
456     if test "$kpathsea_b" != no; then
457         AC_MSG_RESULT(yes)
458         KPATHSEA=1
459     else
460         AC_MSG_RESULT(no)
461         KPATHSEA=0
462     fi
463
464     AC_SUBST(KPATHSEA)
465     AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
466 ])
467
468 AC_DEFUN(AC_STEPMAKE_LEXYACC, [
469     # ugh, automake: we want (and check for) bison
470     AC_PROG_YACC
471     # ugh, automake: we want (and check for) flex
472     # AC_PROG_LEX
473     # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
474
475     # AC_DECL_YYTEXT
476     # ugh, ugh
477     ac_cv_prog_lex_root=lex.yy
478
479     AC_CHECK_PROGS(BISON, bison, error)
480     AC_CHECK_PROGS(FLEX, flex, error)
481     AC_CHECK_SEARCH_RESULT($BISON, bison,  Please install Bison, 1.25 or newer)
482     AC_CHECK_SEARCH_RESULT($FLEX,  flex, Please install Flex, 2.5 or newer)
483
484
485 ## Urg. We should fix this configure test. -- so clumsy
486     if test $BISON != "error"; then
487         bison_version=`$BISON --version | head -1 | sed 's/^.* 1\.//g'`
488         if test $bison_version -lt 25; then
489             AC_STEPMAKE_WARN(The bison installed might be too old (1.$bison_version). You might have to install 1.25)
490         fi      
491     fi
492
493     AC_SUBST(BISON)
494     AC_SUBST(FLEX)
495 ])
496
497 AC_DEFUN(AC_STEPMAKE_LIB, [
498     AC_CHECK_PROGS(AR, ar, error)
499     AC_PROG_RANLIB
500
501     AC_SUBST(AR)
502     AC_SUBST(RANLIB)
503 ])
504
505 AC_DEFUN(AC_STEPMAKE_LIBTOOL, [
506     # libtool.info ...
507     # **Never** try to set library version numbers so that they correspond
508     # to the release number of your package.  This is an abuse that only
509     # fosters misunderstanding of the purpose of library versions.
510
511     REVISION=$PATCH_LEVEL
512     # CURRENT=$MINOR_VERSION
513     CURRENT=`expr $MINOR_VERSION + 1`
514     # AGE=$(expr $MAJOR_VERSION + 1)
515     AGE=$MAJOR_VERSION
516     AC_SUBST(CURRENT)
517     AC_SUBST(REVISION)
518     AC_SUBST(AGE)
519 ])
520
521 AC_DEFUN(AC_STEPMAKE_LOCALE, [
522     lang=English
523     ALL_LINGUAS="en nl"
524
525     # with/enable ??
526     AC_ARG_WITH(localedir,
527     [  --with-localedir=LOCALE use LOCALE as locale dir.  Default:
528                             PREFIX/share/locale ],
529     localedir=$with_localedir,
530     localedir='${prefix}/share/locale')
531
532     AC_ARG_WITH(lang,
533     [  --with-lang=LANG        use LANG as language to emit messages],
534     language=$with_lang,
535     language=English)
536
537     AC_MSG_CHECKING(language)    
538     case "$language" in
539       En* | en* | Am* | am* | US* | us*)
540             lang=English;;
541       NL | nl | Du* | du* | Ned* | ned*)
542             lang=Dutch;;
543       "")
544             lang=English;;
545       *)
546             lang=unknown;;
547     esac
548     AC_MSG_RESULT($lang)
549
550     if test "$lang" = "unknown" ; then
551         AC_STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
552     fi
553
554 ])
555
556 AC_DEFUN(AC_STEPMAKE_GETTEXT, [
557     DIR_LOCALEDIR=${localedir}
558     presome=${prefix}
559     if test "$prefix" = "NONE"; then
560             presome=${ac_default_prefix}
561     fi
562     DIR_LOCALEDIR=`echo ${DIR_LOCALEDIR} | sed "s!\\\${prefix}!$presome!"`
563     AC_SUBST(localedir)
564     AC_SUBST(DIR_LOCALEDIR)
565     AC_DEFINE_UNQUOTED(DIR_LOCALEDIR, "${DIR_LOCALEDIR}")
566
567     AC_CHECK_LIB(intl, gettext)
568     AC_CHECK_FUNCS(gettext)
569 ])
570
571 AC_DEFUN(AC_STEPMAKE_MAKEINFO, [
572     AC_CHECK_PROGS(MAKEINFO, makeinfo, error)
573     if test "$MAKEINFO" != "error"; then
574         AC_MSG_CHECKING(whether makeinfo can split html by @node)
575         mkdir -p out
576         makeinfo --html --output=out/split <<EOF
577 \input texinfo
578 \input texinfo @c -*-texinfo-*-
579 @setfilename split.info
580 @settitle split.info
581 @bye
582 EOF
583         if test -d out/split; then
584             SPLITTING_MAKEINFO=yes
585             AC_MSG_RESULT(yes)
586             rm -rf out/split
587         else
588             AC_MSG_RESULT(no)
589             AC_STEPMAKE_WARN(your html documentation will be one large file)
590             rm -rf out/split
591         fi
592     fi
593     AC_SUBST(SPLITTING_MAKEINFO)
594 ])
595
596
597 AC_DEFUN(AC_STEPMAKE_MAN, [
598     AC_CHECK_PROGS(GROFF, groff ditroff, -echo no groff)
599     AC_CHECK_PROGS(TROFF, troff, -echo no troff)
600     AC_CHECK_PROGS(TBL, tbl, cat)
601 ])
602
603 AC_DEFUN(AC_STEPMAKE_MSGFMT, [
604     # AC_CHECK_PROGS(MSGFMT, msgfmt, -echo no msgfmt)
605     AC_CHECK_PROGS(MSGFMT, msgfmt, \$(SHELL) \$(step-bindir)/fake-msgfmt.sh )
606     AC_MSG_CHECKING(whether msgfmt accepts -o)
607     msgfmt_output="`msgfmt -o bla 2>&1 | grep usage`"
608     if test "$msgfmt_output" = ""; then
609         AC_MSG_RESULT(yes)
610     else
611         # urg
612         MSGFMT="\$(SHELL) \$(step-bindir)/fake-msgfmt.sh"
613         AC_MSG_RESULT(no)
614         AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
615     fi
616     if test ! -n "$MSGFMT"; then
617         AC_STEPMAKE_WARN(please install msgfmt from GNU gettext)
618     fi
619 ])
620
621 #why has this been dropped?
622 AC_DEFUN(XXAC_STEPMAKE_TEXMF_DIRS, [
623     AC_ARG_ENABLE(tex-prefix,
624     [  --enable-tex-prefix=DIR   set the tex-directory to find TeX
625                                subdirectories.  Default: PREFIX],
626     [TEXPREFIX=$enableval],
627     [TEXPREFIX=auto] )
628     
629     AC_ARG_ENABLE(tex-dir,
630     [  --enable-tex-dir=DIR      set the directory to put $PACKAGE_NAME TeX files in. ],
631     [TEXDIR=$enableval],
632     [TEXDIR=auto] )
633
634     AC_ARG_ENABLE(mf-dir,
635     [  --enable-mf-dir=DIR       set the directory to put $PACKAGE_NAME MetaFont files in. ],
636     [MFDIR=$enableval],
637     [MFDIR=auto])
638
639     if test "x$TEXPREFIX" = xauto ; then
640         AC_TEX_PREFIX(TEXPREFIX)
641     else
642      find_texprefix=$TEXPREFIX
643     fi
644
645     if test "x$MFDIR" = xauto; then
646         AC_MF_SUBDIR(MFDIR)
647     fi
648         
649     if test "x$TEXDIR" = xauto ; then
650         AC_TEX_SUBDIR(TEXDIR)
651     fi
652     AC_SUBST(TEXPREFIX)
653     AC_SUBST(TEXDIR)
654     AC_SUBST(MFDIR)
655 ])
656
657 AC_DEFUN(AC_STEPMAKE_TEXMF_DIRS, [
658     AC_ARG_ENABLE(tfm-path,
659     [  --enable-tfm-path=PATH  set path of tex directories where tfm files live,
660                             esp.: cmr10.tfm.  Default: use kpsewhich],
661     [tfm_path=$enableval],
662     [tfm_path=auto] )
663
664     AC_CHECK_PROGS(KPSEWHICH, kpsewhich, no)
665     AC_MSG_CHECKING(for tfm path)
666
667     TFM_FONTS="cmr msam"
668
669     if test "x$tfm_path" = xauto ; then
670         if test "x$KPSEWHICH" != "xno" ; then
671             for i in $TFM_FONTS; do
672                 dir=`$KPSEWHICH tfm ${i}10.tfm`
673                 TFM_PATH="$TFM_PATH `dirname $dir`"
674             done
675         else
676             AC_STEPMAKE_WARN(Please specify where cmr10.tfm lives:
677     ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
678         fi
679     else
680          TFM_PATH=$tfm_path
681     fi
682
683     TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
684     AC_MSG_RESULT($TFM_PATH)
685     AC_SUBST(TFM_PATH)
686 ])
687
688 AC_DEFUN(AC_STEPMAKE_TEXMF, [
689     # urg, never know what names these teTeX guys will think up
690
691     AC_CHECK_PROGS(METAFONT, mf, no)
692     if test "x$METAFONT" = "xno"; then
693         AC_CHECK_PROGS(MFONT, mfont, -echo no mf or mfont)
694         METAFONT=$MFONT
695     fi
696
697     AC_CHECK_PROGS(INIMETAFONT, inimf, no)
698     if test "x$INIMETAFONT" = "xno"; then
699         AC_CHECK_PROGS(INIMFONT, inimfont, -echo no inimf or inimfont)
700         INIMETAFONT=$INIMFONT
701     fi
702
703     AC_MSG_CHECKING(for working metafont mode)
704     modelist='ljfour lj4 lj3 lj2 ljet laserjet'
705     for MFMODE in $modelist; do
706         $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
707         if test -f mfput.tfm; then
708             break;
709         fi
710     done
711     AC_MSG_RESULT($MFMODE)
712
713     rm -f mfput.*
714
715     AC_SUBST(METAFONT)
716     AC_SUBST(MFMODE)
717     AC_SUBST(INIMETAFONT)
718 ])
719
720 AC_DEFUN(AC_STEPMAKE_WARN, [
721     AC_MSG_WARN($1)
722     warn_b=yes
723 ])
724
725 AC_DEFUN(AC_STEPMAKE_YODL, [
726     if test "x$YODL" = "x"; then 
727         AC_CHECK_PROGS(STRIPROFF, striproff, -echo no striproff)
728         AC_CHECK_PROGS(YODL, yodl, -echo no yodl)
729         AC_CHECK_PROGS(YODL2HTML, yodl2html, -echo no yodl)
730         AC_CHECK_PROGS(YODL2LATEX, yodl2latex, )
731         AC_CHECK_PROGS(YODL2MAN, yodl2man, -echo no yodl)
732         AC_CHECK_PROGS(YODL2MSLESS, yodl2msless, -echo no yodl)
733         AC_CHECK_PROGS(YODL2TEXINFO, yodl2texinfo, -echo no yodl)
734         AC_CHECK_PROGS(YODL2TXT, yodl2txt, -echo no yodl)
735         YODL2LESS_DIR='$(bindir)/'
736     else
737         AC_SUBST(STRIPROFF)
738         AC_SUBST(YODL)
739         AC_SUBST(YODL2HTML)
740         AC_SUBST(YODL2LATEX)
741         AC_SUBST(YODL2LESS_DIR)
742         AC_SUBST(YODL2MAN)
743         AC_SUBST(YODL2MSLESS)
744         AC_SUBST(YODL2TEXINFO)
745         AC_SUBST(YODL2TXT)
746         export STRIPROFF YODL YODL2HTML YODL2LATEX YODL2MAN YODL2MSLESS YODL2TEXINFO YODL2TXT
747     fi
748     if test "x$YODL" = "-echo no yodl"; then
749         AC_STEPMAKE_WARN(Did not find YODL (Yodl is Yet Oneother Document Language, see http://www.cs.uu.nl/~hanwen/yodl))
750     fi    
751 ])
752
753 dnl should cache result.
754 dnl should  look in $prefix first.
755 dnl should probably assume TDS
756
757 AC_DEFUN(AC_TEX_PREFIX, [
758     
759
760     AC_MSG_CHECKING(TeX/MF root dir directory)    
761
762     find_root_prefix="$prefix"
763     
764
765     test "x$find_root_prefix" = xNONE && find_root_prefix="$ac_default_prefix"
766     find_texpostfix="";
767     for postfix in "/lib/tex/" "/lib/texmf" "/lib" "/tex" "/texmf"; do
768         find_texprefix="$find_root_prefix$postfix"
769         if test -d $find_texprefix; then
770             find_texpostfix=$postfix
771             break;
772         fi
773     done
774     
775     if test "x$find_texpostfix" = x; then
776         find_texpostfix='/lib/texmf/tex'
777         AC_STEPMAKE_WARN(Cannot determine the TeX-directory.  Please use --enable-tex-prefix)
778     fi
779
780     find_texprefix="$find_root_prefix/$find_texpostfix"
781
782     # only assign if variablename not empty
783     if test x != "x[$]$1"; then
784         $1='${prefix}'/"$find_texpostfix"
785     fi
786     AC_MSG_RESULT($find_texprefix)
787
788 ])
789  
790
791 # find a directory inside a prefix, 
792 # $1 the prefix (expanded version)
793 # $2 variable to assign
794 # $3 the directory name 
795 # $4 description
796 AC_DEFUN(AC_FIND_DIR_IN_PREFIX, [
797     
798     AC_MSG_CHECKING($4 directory)    
799     find_dirdir=`(cd $1; 
800       $FIND ./ -type d -a -name $3 -print |sort|head -1|sed 's#^\./##')`
801     
802
803     if test "x$find_dirdir" = x; then
804        find_dirdir="/$3";
805        AC_STEPMAKE_WARN(Cannot determine $4 subdirectory.  Please set from command-line)
806         true
807     fi
808     $2=$find_dirdir
809     AC_MSG_RESULT($1/$find_dirdir)
810 ])
811
812 # ugh.  this is hopeless
813 AC_DEFUN(AC_KPSE_TEX_DIR, [
814         kpse_paths=`(kpsepath -n latex tex; kpsepath -n tex tex) | sed 's/:/ /g' | tr ' ' '\012' |sort | uniq -d`
815         kpse_syspaths=`echo $kpse_paths | grep '!'| sed 's/!//g'`
816         echo $kpse_paths
817         if test -w "$kpse_syspaths";
818         then
819                 dir=`echo $kpse_syspaths | head -1`
820         else
821                 dir=`echo $kpse_paths | grep -v '!'| head -1`
822         fi
823         if test "$prefix" = "NONE"; then
824                 local_prefix=$ac_default_prefix
825                 local_prefix_quote='${prefix}'
826
827         else
828                 local_prefix=$prefix
829                 local_prefix_quote=$prefix
830         fi
831         echo $local_prefix_quote = $local_prefix
832         echo $dir
833         echo $dir  | sed 's!'$local_prefix'!\$local_prefix_quote!g'
834 ])
835
836 AC_DEFUN(AC_TEX_SUBDIR, [
837 dnl    AC_REQUIRE([AC_TEX_PREFIX])
838     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, tex,TeX input)
839     $1="$TEXPREFIX/$$1"
840 ])
841
842 AC_DEFUN(AC_MF_SUBDIR, [
843 dnl     AC_REQUIRE([AC_TEX_PREFIX])
844     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, source, MF input)
845     $1="$TEXPREFIX/$$1"
846 ])
847
848 AC_DEFUN(AC_CHECK_SEARCH_RESULT, [
849         result="`echo \"$1\" | grep echo`"
850         if test "x$1" = "xerror" -o "x$result" != "x"; then
851                 AC_STEPMAKE_WARN(can\'t find $2. $3)
852         fi
853 ])
854
855 dnl   GUILE_FLAGS --- set flags for compiling and linking with Guile
856 dnl
857 dnl   This macro runs the `guile-config' script, installed with Guile,
858 dnl   to find out where Guile's header files and libraries are
859 dnl   installed.  It sets two variables, marked for substitution, as
860 dnl   by AC_SUBST.
861 dnl   
862 dnl     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
863 dnl             code that uses Guile header files.  This is almost
864 dnl             always just a -I flag.
865 dnl   
866 dnl     GUILE_LDFLAGS --- flags to pass to the linker to link a
867 dnl             program against Guile.  This includes `-lguile' for
868 dnl             the Guile library itself, any libraries that Guile
869 dnl             itself requires (like -lqthreads), and so on.  It may
870 dnl             also include a -L flag to tell the compiler where to
871 dnl             find the libraries.
872
873 AC_DEFUN([GUILE_FLAGS],[
874 ## The GUILE_FLAGS macro.
875   AC_MSG_CHECKING(for Guile)
876   if ! $guile_config link > /dev/null ; then
877       AC_MSG_RESULT("cannot execute $guile_config")
878       AC_MSG_ERROR("cannot find guile-config; is Guile installed?")
879       exit 1
880   fi
881   GUILE_CFLAGS="`$guile_config compile`"
882   GUILE_LDFLAGS="`$guile_config link`"
883   AC_SUBST(GUILE_CFLAGS)
884   AC_SUBST(GUILE_LDFLAGS)
885   AC_MSG_RESULT(yes)
886 ])
887
888
889 # Configure paths for GTK+
890 # Owen Taylor     97-11-3
891
892 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
893 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
894 dnl
895 AC_DEFUN(AM_PATH_GTK,
896 [dnl 
897 dnl Get the cflags and libraries from the gtk-config script
898 dnl
899   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
900   min_gtk_version=ifelse([$1], ,1.1.1,$1)
901   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
902   no_gtk=""
903   if test "$GTK_CONFIG" != "no" ; then
904     GTK_CFLAGS=`$GTK_CONFIG --cflags`
905     GTK_LIBS=`$GTK_CONFIG --libs`
906     ac_save_CFLAGS="$CFLAGS"
907     ac_save_LIBS="$LIBS"
908     ac_save_CXXFLAGS="$CXXFLAGS"
909     CFLAGS="$CFLAGS $GTK_CFLAGS"
910     CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
911     LIBS="$LIBS $GTK_LIBS"
912 dnl
913 dnl Now check if the installed GTK is sufficiently new. (Also sanity
914 dnl checks the results of gtk-config to some extent)
915 dnl
916     AC_TRY_RUN([
917 #include <gtk/gtk.h>
918 #include <stdio.h>
919
920 int 
921 main ()
922 {
923   int major, minor, micro;
924
925   if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
926      printf("%s, bad version string\n", "$min_gtk_version");
927      exit(1);
928    }
929
930    return !((gtk_major_version > major) ||
931             ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
932             ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
933 }
934 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
935      CFLAGS="$ac_save_CFLAGS"
936      CXXFLAGS="$ac_save_CXXFLAGS"
937      LIBS="$ac_save_LIBS"
938   else
939      no_gtk=yes
940   fi
941   if test "x$no_gtk" = x ; then
942      AC_MSG_RESULT(yes)
943      ifelse([$2], , :, [$2])     
944   else
945      AC_MSG_RESULT(no)
946      GTK_CFLAGS=""
947      GTK_LIBS=""
948      ifelse([$3], , :, [$3])
949   fi
950   CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
951   AC_SUBST(CXXFLAGS)
952   AC_SUBST(GTK_CFLAGS)
953   AC_SUBST(GTK_LIBS)
954 ])
955
956
957 # Configure paths for GTK--
958 # Erik Andersen 30 May 1998
959 # Modified by Tero Pulkkinen (added the compiler checks... I hope they work..)
960
961 dnl Test for GTK__, and define GTK___CFLAGS and GTK___LIBS
962 dnl   to be used as follows:
963 dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
964 dnl
965
966 dnl Get the cflags and libraries from the gtkmm-config script
967 dnl
968 AC_ARG_WITH(gtkmm-prefix,[  --with-gtkmm-prefix=PREFIX
969                           Prefix where GTK-- is installed (optional)],
970             gtkmm_config_prefix="$withval", gtkmm_config_prefix="")
971 AC_ARG_WITH(gtkmm-exec-prefix,[  --with-gtkmm-exec-prefix=PREFIX
972                           Exec prefix where GTK-- is installed (optional)],
973             gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="")
974 AC_ARG_ENABLE(gtkmmtest, [  --disable-gtkmmtest     Do not try to compile and run a test GTK-- program],
975                     , enable_gtkmmtest=yes)
976
977   if test x$gtkmm_config_exec_prefix != x ; then
978      gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix"
979      if test x${GTKMM_CONFIG+set} != xset ; then
980         GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config
981      fi
982   fi
983   if test x$gtkmm_config_prefix != x ; then
984      gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix"
985      if test x${GTKMM_CONFIG+set} != xset ; then
986         GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config
987      fi
988   fi
989
990
991 AC_DEFUN(AM_PATH_GTKMM,
992 [dnl 
993
994 dnl
995 dnl Check if the installed GTK-- is sufficiently new.
996 dnl
997   AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
998   min_gtkmm_version=ifelse([$1], ,0.9.14,$1)
999
1000   AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version)
1001   no_gtkmm=""
1002   if test "$GTKMM_CONFIG" = "no" ; then
1003     no_gtkmm=yes
1004   else
1005     AC_LANG_SAVE
1006     AC_LANG_CPLUSPLUS
1007
1008     GTK___CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags`
1009     GTK___LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs`
1010     gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1011            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1012     gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1013            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1014     gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \
1015            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1016     if test "x$enable_gtkmmtest" = "xyes" ; then
1017       ac_save_CXXFLAGS="$CXXFLAGS"
1018       ac_save_LIBS="$LIBS"
1019       CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1020       LIBS="$LIBS $GTK___LIBS"
1021 dnl
1022 dnl Now check if the installed GTK-- is sufficiently new. (Also sanity
1023 dnl checks the results of gtkmm-config to some extent
1024 dnl
1025       rm -f conf.gtkmmtest
1026       AC_TRY_RUN([
1027 #include <gtk--.h>
1028 #include <stdio.h>
1029 #include <stdlib.h>
1030
1031 int 
1032 main ()
1033 {
1034   int major, minor, micro;
1035   char *tmp_version;
1036
1037   system ("touch conf.gtkmmtest");
1038
1039   /* HP/UX 0 (%@#!) writes to sscanf strings */
1040   tmp_version = g_strdup("$min_gtkmm_version");
1041   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1042      printf("%s, bad version string\n", "$min_gtkmm_version");
1043      exit(1);
1044    }
1045
1046   if ((gtkmm_major_version != $gtkmm_config_major_version) ||
1047       (gtkmm_minor_version != $gtkmm_config_minor_version) ||
1048       (gtkmm_micro_version != $gtkmm_config_micro_version))
1049     {
1050       printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n", 
1051              $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version,
1052              gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1053       printf ("*** was found! If gtkmm-config was correct, then it is best\n");
1054       printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n");
1055       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1056       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1057       printf("*** required on your system.\n");
1058       printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n");
1059       printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n");
1060       printf("*** before re-running configure\n");
1061     } 
1062 /* GTK-- does not have the GTKMM_*_VERSION constants */
1063 /* 
1064   else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) ||
1065            (gtkmm_minor_version != GTKMM_MINOR_VERSION) ||
1066            (gtkmm_micro_version != GTKMM_MICRO_VERSION))
1067     {
1068       printf("*** GTK-- header files (version %d.%d.%d) do not match\n",
1069              GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION);
1070       printf("*** library (version %d.%d.%d)\n",
1071              gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1072     }
1073 */
1074   else
1075     {
1076       if ((gtkmm_major_version > major) ||
1077         ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) ||
1078         ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro)))
1079       {
1080         return 0;
1081        }
1082      else
1083       {
1084         printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n",
1085                gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version);
1086         printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n",
1087                major, minor, micro);
1088         printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n");
1089         printf("***\n");
1090         printf("*** If you have already installed a sufficiently new version, this error\n");
1091         printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n");
1092         printf("*** being found. The easiest way to fix this is to remove the old version\n");
1093         printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n");
1094         printf("*** correct copy of gtkmm-config. (In this case, you will have to\n");
1095         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1096         printf("*** so that the correct libraries are found at run-time))\n");
1097       }
1098     }
1099   return 1;
1100 }
1101 ],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1102        CXXFLAGS="$ac_save_CXXFLAGS"
1103        LIBS="$ac_save_LIBS"
1104      fi
1105   fi
1106   if test "x$no_gtkmm" = x ; then
1107      AC_MSG_RESULT(yes)
1108      ifelse([$2], , :, [$2])     
1109   else
1110      AC_MSG_RESULT(no)
1111      if test "$GTKMM_CONFIG" = "no" ; then
1112        echo "*** The gtkmm-config script installed by GTK-- could not be found"
1113        echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in"
1114        echo "*** your path, or set the GTK_CONFIG environment variable to the"
1115        echo "*** full path to gtk-config."
1116        echo "*** The gtkmm-config script was not available in GTK-- versions"
1117        echo "*** prior to 0.9.12. Perhaps you need to update your installed"
1118        echo "*** version to 0.9.12 or newer"
1119      else
1120        if test -f conf.gtkmmtest ; then
1121         :
1122        else
1123           echo "*** Could not run GTK-- test program, checking why..."
1124           CXXFLAGS="$CFLAGS $GTKMM_CXXFLAGS"
1125           LIBS="$LIBS $GTK___LIBS"
1126           AC_TRY_LINK([
1127 #include <gtk--.h>
1128 #include <stdio.h>
1129 ],      [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ],
1130         [ echo "*** The test program compiled, but did not run. This usually means"
1131           echo "*** that the run-time linker is not finding GTK-- or finding the wrong"
1132           echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your"
1133           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1134           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1135           echo "*** is required on your system"
1136           echo "***"
1137           echo "*** If you have an old version installed, it is best to remove it, although"
1138           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
1139         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1140           echo "*** exact error that occured. This usually means GTK-- was incorrectly installed"
1141           echo "*** or that you have moved GTK-- since it was installed. In the latter case, you"
1142           echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ])
1143           CXXFLAGS="$ac_save_CXXFLAGS"
1144           LIBS="$ac_save_LIBS"
1145        fi
1146      fi
1147      GTK___CFLAGS=""
1148      GTK__LIBS=""
1149      ifelse([$3], , :, [$3])
1150      AC_LANG_RESTORE
1151   fi
1152   AC_SUBST(GTK___CFLAGS)
1153   AC_SUBST(GTK___LIBS)
1154   rm -f conf.gtkmmtest
1155 ])
1156
1157 # Configure paths for GTK--DRAW
1158 # Derek Quinn Wyatt   98-08-21  (adapted from Jan Nieuwenhuizen's code)
1159
1160 dnl AM_PATH_GTK__DRAW([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1161 dnl Test for GTK--DRAW, and define GTK___CFLAGS and GTK___LIBS
1162 dnl
1163 AC_DEFUN(AM_PATH_GTK__DRAW,
1164 [dnl 
1165 dnl Get the cflags and libraries from the gtk__-config script
1166 dnl
1167   AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no)
1168   min_gtk___version=ifelse([$1], ,0.0.5,$1)
1169   AC_MSG_CHECKING(for GTK--DRAW - version >= $min_gtk___version)
1170   no_gtk__=""
1171   if test "$GTKMM_CONFIG" != "no" ; then
1172     GTK___CFLAGS=`$GTKMM_CONFIG --cflags`
1173     GTK___LIBS=`$GTKMM_CONFIG --libs`
1174     GTK___DLIBS="$GTK___LIBS -lgtkmmdraw"
1175     GTK___LIBS="$GTK___DLIBS"
1176     ac_save_CFLAGS="$CFLAGS"
1177     ac_save_LIBS="$LIBS"
1178     ac_save_CXXFLAGS="$CXXFLAGS"
1179     CFLAGS="$CFLAGS $GTK___CFLAGS"
1180     CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1181     LIBS="$LIBS $GTK___LIBS"
1182 dnl
1183 dnl Now check if the installed GTK__ is sufficiently new. (Also sanity
1184 dnl checks the results of gtk__-config to some extent)
1185 dnl
1186     AC_TRY_RUN([
1187 #include <gtk--.h>
1188 #include <stdio.h>
1189
1190 int 
1191 main ()
1192 {
1193   // urg
1194   return 0;
1195 }
1196 ],, no_gtk__=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1197      CFLAGS="$ac_save_CFLAGS"
1198      CXXFLAGS="$ac_save_CXXFLAGS"
1199      LIBS="$ac_save_LIBS"
1200   else
1201      no_gtk__=yes
1202   fi
1203   if test "x$no_gtk__" = x ; then
1204      AC_MSG_RESULT(yes)
1205      ifelse([$2], , :, [$2])     
1206   else
1207      AC_MSG_RESULT(no)
1208      GTK___CFLAGS=""
1209      GTK___LIBS=""
1210      ifelse([$3], , :, [$3])
1211   fi
1212   CXXFLAGS="$CXXFLAGS $GTK___CFLAGS"
1213   AC_SUBST(CXXFLAGS)
1214   AC_SUBST(GTK___CFLAGS)
1215   AC_SUBST(GTK___LIBS)
1216 ])