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