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