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