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