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