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