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