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