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