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