]> git.donarmstrong.com Git - lilypond.git/blob - aclocal.m4
*** empty log message ***
[lilypond.git] / aclocal.m4
1 dnl aclocal.m4   -*-shell-script-*-
2 dnl WARNING WARNING WARNING
3 dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4
4 dnl aclocal.m4   -*-shell-script-*-
5 dnl StepMake subroutines for configure.in
6
7
8 ### mostly interal macros
9
10 # Get full path of executable ($1)
11 AC_DEFUN(STEPMAKE_GET_EXECUTABLE, [
12     type -p "$1" 2>&1 | awk '{print $NF}'
13 ])
14
15
16 # Get version string from executable ($1)
17 AC_DEFUN(STEPMAKE_GET_VERSION, [
18     "$1" --version 2>&1 | grep -v '^$' | head -1 | awk '{print $NF}'
19 ])
20
21 # Calculate numeric version from version string ($1)
22 AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [
23     echo "$1" | awk -F. '
24     {
25       if ([$]3) {last = [$]3}
26       else {last =0}
27     }
28     {printf "%s%s%s\n",[$]1*100, [$]2*10,last}'
29 ])
30
31
32 # Add item ($2) to list ($1, one of 'OPTIONAL', 'REQUIRED')
33 AC_DEFUN(STEPMAKE_ADD_ENTRY, [
34     eval "$1"=\"`eval echo \"'$'$1\" \"$2\"`\"
35 ])
36
37 # Check if tested program ($2) was found ($1).
38 # If not, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED').
39 # We could abort here if a 'REQUIRED' program is not found
40 AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [
41     STEPMAKE_CHECK_SEARCH_RESULT($1)
42     if test $? -ne 0; then
43         STEPMAKE_ADD_ENTRY($3, $2)
44         if test "$3" = "REQUIRED"; then
45             command="echo ERROR: $2 not found"
46             # abort configure process here?
47         else
48             command="- echo $2 not found"
49         fi
50         eval "$1"='$command'
51         false
52     else
53         true
54     fi
55 ])
56
57
58 # Return if tested proram ($1) was found (true) or not (false).
59 AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [
60     r="`eval echo '$'"$1"`"
61     if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
62         true
63     else
64         ##STEPMAKE_WARN(cannot find $2. $3)
65         false
66     fi
67 ])
68
69
70 # Check version of program ($1)
71 # If version is smaller than requested ($3),
72 # add entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED').
73 AC_DEFUN(STEPMAKE_CHECK_VERSION, [
74     r="`eval echo '$'"$1"`"
75     AC_MSG_CHECKING("$r version")
76     exe=`STEPMAKE_GET_EXECUTABLE($r)`
77     ver=`STEPMAKE_GET_VERSION($exe)`
78     num=`STEPMAKE_NUMERIC_VERSION($ver)`
79     req=`STEPMAKE_NUMERIC_VERSION($3)`
80     AC_MSG_RESULT("$ver")
81     if test "$num" -lt "$req"; then
82         STEPMAKE_ADD_ENTRY($2, "$r $3 (installed: $ver)")
83     fi
84 ])
85
86 ### Macros to build configure.in
87
88
89 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
90     STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
91     if test "$BIBTEX2HTML" = "bib2html"; then
92         BIBTEX2HTML_FLAGS='$< $(@)'
93     else
94         BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
95     fi
96     AC_SUBST(BIBTEX2HTML)
97     AC_SUBST(BIBTEX2HTML_FLAGS)
98 ])
99
100
101 AC_DEFUN(STEPMAKE_BISON, [
102     # ugh, automake: we want (and check for) bison
103     AC_PROG_YACC
104     
105     STEPMAKE_PROGS(BISON, bison, $1)
106     
107     # urg.  should test functionality rather than version.
108     if test "$BISON" = "bison" -a -n "$2"; then
109         STEPMAKE_CHECK_VERSION(BISON, $1, $2)
110     fi
111 ])
112
113
114 AC_DEFUN(STEPMAKE_COMPILE, [
115     # -O is necessary to get inlining
116     CFLAGS=${CFLAGS-""}
117     CXXFLAGS=${CXXFLAGS-$CFLAGS}
118     LDFLAGS=${LDFLAGS-""}
119     checking_b=yes
120     optimise_b=yes
121     profile_b=no
122     debug_b=yes
123
124     AC_ARG_ENABLE(checking,
125     [  --enable-checking       set runtime checks (assert calls).  Default: on],
126     [checking_b=$enableval] )
127
128     AC_ARG_ENABLE(debugging,
129     [  --enable-debugging      compile with debugging info.  Default: on],
130     [debug_b=$enableval])
131
132     AC_ARG_ENABLE(optimising,
133     [  --enable-optimising      compile with optimising.  Default: on],
134     [optimise_b=$enableval])
135
136     AC_ARG_ENABLE(profiling, 
137     [  --enable-profiling      compile with gprof support.  Default: off],
138     [profile_b=$enableval])
139     
140
141     if test "$checking_b" = no; then
142         # ugh
143         AC_DEFINE(NDEBUG)
144         DEFINES="$DEFINES -DNDEBUG"
145     fi
146
147     if test "$optimise_b" = yes; then
148         OPTIMIZE="-O2 -finline-functions"
149     fi
150
151
152     if test $profile_b = yes; then
153         EXTRA_LIBES="-pg"
154         OPTIMIZE="$OPTIMIZE -pg"
155     fi
156
157     if test $debug_b = yes; then        
158         OPTIMIZE="$OPTIMIZE -g"
159     fi
160
161
162     AC_PROG_CC
163     STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
164     LD='$(CC)'
165     AC_SUBST(LD)
166
167     CFLAGS="$CFLAGS $OPTIMIZE"
168     CPPFLAGS=${CPPFLAGS-""}
169
170     AC_MSG_CHECKING([for IEEE-conformance compiler flags])
171     save_cflags="$CFLAGS"
172     case "$host" in
173         alpha*-*-*)
174             dnl should do compile test?
175             AC_MSG_RESULT(-mieee)
176             CFLAGS="-mieee $CFLAGS"
177             ;;
178         *)
179             AC_MSG_RESULT([none])
180             ;;
181     esac
182     AC_SUBST(cross_compiling)
183     AC_SUBST(CFLAGS)
184     AC_SUBST(CPPFLAGS)
185     AC_SUBST(LDFLAGS)
186     AC_SUBST(ICFLAGS)
187     AC_SUBST(ILDFLAGS)
188     AC_SUBST(DEFINES)
189     AC_SUBST(EXTRA_LIBES)
190 ])
191
192 AC_DEFUN(STEPMAKE_CXX, [
193     AC_LANG_CPLUSPLUS
194     AC_PROG_CXX
195     STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
196
197     CPPFLAGS="$CPPFLAGS $DEFINES"
198     CXXFLAGS="$CXXFLAGS $OPTIMIZE"
199     LDFLAGS="$LDFLAGS $EXTRA_LIBES"
200
201     AC_SUBST(CXXFLAGS)
202     AC_SUBST(CXX)
203     LD='$(CXX)'
204     AC_SUBST(LD)
205 ])
206
207
208 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
209     AC_CACHE_CHECK([whether explicit instantiation is needed],
210         lily_cv_need_explicit_instantiation,
211         AC_TRY_LINK([
212     template <class T> struct foo { static int baz; };
213     template <class T> int foo<T>::baz = 1;
214     ], [ return foo<int>::baz; ],
215             lily_cv_need_explicit_instantiation=no,
216             lily_cv_need_explicit_instantiation=yes))
217     if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
218         AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
219     fi
220 ])
221
222
223 AC_DEFUN(STEPMAKE_DATADIR, [
224     if test "$datadir" = "\${prefix}/share"; then
225             datadir='${prefix}/share/'$package/$FULL_VERSION
226     fi
227     DIR_DATADIR=${datadir}
228     presome=${prefix}
229     if test "$prefix" = "NONE"; then
230             presome=${ac_default_prefix}
231     fi
232     DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"`
233
234     AC_SUBST(datadir)
235     AC_SUBST(DIR_DATADIR)
236
237     # we used to set DIR_SHAREDSTATEDIR here,
238     # but apparently that broke something
239     
240     AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
241 ])
242
243
244 AC_DEFUN(STEPMAKE_END, [
245     AC_SUBST(OPTIONAL)
246     AC_SUBST(REQUIRED)
247     
248     AC_OUTPUT($CONFIGFILE.make:config.make.in)
249
250     
251     if test -n "$OPTIONAL"; then
252         echo
253         echo "WARNING: Please consider installing optional programs: $OPTIONAL"
254     fi
255
256     if test -n "$REQUIRED"; then
257         echo
258         echo "ERROR: Please install required programs: $REQUIRED"
259     fi
260     
261     if test -n "$OPTIONAL$REQUIRED"; then
262         echo
263         echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
264         echo "Remove config.cache before rerunning ./configure"
265     fi
266     
267     if test -n "$REQUIRED"; then
268         rm -f $srcdir/GNUmakefile
269         exit 1
270     fi
271
272     # regular in-place build
273     # test for srcdir_build = yes ?
274     if test "$builddir" = "."; then
275         rm -f $srcdir/GNUmakefile
276         cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
277         chmod 444 $srcdir/GNUmakefile
278     else # --srcdir build
279         rm -f GNUmakefile
280         cp $srcdir/make/srcdir.make.in GNUmakefile
281         chmod 444 GNUmakefile
282     fi
283 ])
284
285
286 AC_DEFUN(STEPMAKE_FLEX, [
287     # ugh, automake: we want (and check for) flex
288     # AC_PROG_LEX
289     # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
290
291     # AC_DECL_YYTEXT
292     # ugh, ugh
293     ac_cv_prog_lex_root=lex.yy
294     STEPMAKE_PROGS(FLEX, flex, $1)
295 ])
296
297
298 AC_DEFUN(STEPMAKE_FLEXLEXER, [
299     AC_HAVE_HEADERS(FlexLexer.h, true, false)
300     if test $? -ne 0; then
301         warn='FlexLexer.h (flex package)'
302         STEPMAKE_ADD_ENTRY($1, $warn)
303     fi
304 ])
305
306
307 AC_DEFUN(STEPMAKE_GCC, [
308     if test "$GCC" = "yes"; then
309         STEPMAKE_CHECK_VERSION(CC, $1, $2)
310     else
311         warn="$CC (Please install *GNU* cc)"
312         STEPMAKE_ADD_ENTRY($1, $warn)
313     fi
314 ])
315
316
317 AC_DEFUN(STEPMAKE_GETTEXT, [
318     DIR_LOCALEDIR=${localedir}
319     presome=${prefix}
320     if test "$prefix" = "NONE"; then
321             presome=${ac_default_prefix}
322     fi
323     DIR_LOCALEDIR=`echo ${DIR_LOCALEDIR} | sed "s!\\\${prefix}!$presome!"`
324     AC_SUBST(localedir)
325     AC_SUBST(DIR_LOCALEDIR)
326     AC_DEFINE_UNQUOTED(DIR_LOCALEDIR, "${DIR_LOCALEDIR}")
327
328     AC_CHECK_LIB(intl, gettext)
329     AC_CHECK_FUNCS(gettext)
330 ])
331
332
333 AC_DEFUN(STEPMAKE_GUILE, [
334     STEPMAKE_PATH_PROG(GUILE, guile, $1)
335 ])
336
337
338 #   STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
339 #
340 #   This macro runs the guile-config script, installed with Guile,
341 #   to find out where Guile's header files and libraries are
342 #   installed.  It sets two variables, marked for substitution, as
343 #   by AC_SUBST.
344 #   
345 #     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
346 #             code that uses Guile header files.  This is almost
347 #             always just a -I flag.
348 #   
349 #     GUILE_LDFLAGS --- flags to pass to the linker to link a
350 #             program against Guile.  This includes -lguile for
351 #             the Guile library itself, any libraries that Guile
352 #             itself requires (like -lqthreads), and so on.  It may
353 #             also include a -L flag to tell the compiler where to
354 #             find the libraries.
355
356 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
357     exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
358     if test -x $exe; then
359         AC_MSG_CHECKING("guile compile flags")
360         GUILE_CFLAGS="`$guile_config compile`"
361         AC_MSG_RESULT($GUILE_CFLAGS)
362         AC_MSG_CHECKING("guile link flags")
363         GUILE_LDFLAGS="`$guile_config link`"
364         AC_MSG_RESULT($GUILE_LDFLAGS)
365     fi
366     AC_SUBST(GUILE_CFLAGS)
367     AC_SUBST(GUILE_LDFLAGS)
368 ])
369
370
371 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
372     ## First, let's just see if we can find Guile at all.
373     AC_MSG_CHECKING("for guile-config")
374     for guile_config in guile-config $target-guile-config $build-guile-config; do
375         AC_MSG_RESULT("$guile_config")
376         if ! $guile_config --version > /dev/null 2>&1 ; then
377             AC_MSG_WARN("cannot execute $guile_config")
378             AC_MSG_CHECKING("if we are cross compiling")
379             GUILE_CONFIG='echo no guile-config'
380         else
381             GUILE_CONFIG=$guile_config
382             break
383         fi
384     done
385     STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
386     if test $? -ne 0; then
387         STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
388     fi 
389
390     STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
391     # urg.  should test functionality rather than version.
392     if test $? -eq 0 -a -n "$2"; then
393         STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
394     fi
395
396     AC_SUBST(GUILE_CONFIG)
397     
398     guile_version="$ver"
399     changequote(<<, >>)dnl
400     GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
401     GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
402     changequote([, ])dnl
403     STEPMAKE_GUILE_FLAGS
404     AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
405     AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
406 ])
407
408
409 AC_DEFUN(STEPMAKE_GXX, [
410     if test "$GXX" = "yes"; then
411         STEPMAKE_CHECK_VERSION(CXX, $1, $2)
412     else
413         warn="$CXX (Please install *GNU* c++)"
414         STEPMAKE_ADD_ENTRY($1, $warn)
415     fi
416 ])
417
418
419 AC_DEFUN(STEPMAKE_INIT, [
420
421     . $srcdir/VERSION
422     FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
423     if test x$MY_PATCH_LEVEL != x; then
424         FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
425     fi
426
427     # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
428     changequote(<<, >>)dnl
429     PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
430     package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
431     changequote([, ])dnl
432
433     # No versioning on directory names of sub-packages 
434     # urg, urg
435     stepmake=${datadir}/stepmake
436     presome=${prefix}
437     if test "$prefix" = "NONE"; then
438             presome=${ac_default_prefix}
439     fi
440     stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
441
442     # urg, how is this supposed to work?
443     if test "$program_prefix" = "NONE"; then
444           program_prefix=
445     fi
446     if test "$program_suffix" = "NONE"; then
447           program_suffix=
448     fi
449
450     AC_MSG_CHECKING(Package)
451     if test "x$PACKAGE" = "xSTEPMAKE"; then
452         AC_MSG_RESULT(Stepmake package!)
453
454         AC_MSG_CHECKING(builddir)
455         if test "$srcdir" = "."; then
456             builddir=.
457         else
458             absolute_builddir="`pwd`"
459             package_absolute_builddir="`dirname $absolute_builddir`"
460             package_srcdir="`dirname  $srcdir`"
461             builddir="`dirname $package_srcdir`/`basename $package_absolute_builddir`/`basename $absolute_builddir`"
462         fi
463         AC_MSG_RESULT($builddir)
464
465         (cd stepmake 2>/dev/null || mkdir stepmake)
466         (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
467         AC_CONFIG_AUX_DIR(bin)
468         stepmake=stepmake
469     else
470         AC_MSG_RESULT($PACKAGE)
471
472         AC_MSG_CHECKING(builddir)
473         if test "$srcdir" = "."; then
474             builddir=.
475             srcdir_build=no
476         else
477             absolute_builddir="`pwd`"
478 #           builddir="`dirname  $srcdir`/`basename $absolute_builddir`"
479             builddir="`bash $srcdir/buildscripts/walk.sh \"$srcdir\"`"
480             srcdir_build=yes
481         fi
482         AC_MSG_RESULT($builddir)
483         if expr "$srcdir" : '/' > /dev/null 2>&1; then
484             absolute_srcdir=yes
485             STEPMAKE_WARN(Absolute --srcdir specified: $srcdir)
486         fi
487
488         AC_MSG_CHECKING(for stepmake)
489         # Check for installed stepmake
490         if test -d $stepmake; then
491             AC_MSG_RESULT($stepmake)
492         else
493             if test "$absolute_srcdir" != "yes"; then
494                 stepmake='$(depth)'/$srcdir/stepmake
495             else
496                 stepmake=$srcdir/stepmake
497             fi
498             AC_MSG_RESULT($srcdir/stepmake  ($datadir/stepmake not found))
499         fi
500
501         AC_CONFIG_AUX_DIR(\
502           $HOME/usr/local/share/stepmake/bin\
503           $HOME/usr/local/lib/stepmake/bin\
504           $HOME/usr/share/stepmake/bin\
505           $HOME/usr/lib/stepmake/bin\
506           /usr/local/share/stepmake/bin\
507           /usr/local/lib/stepmake/bin\
508           /usr/share/stepmake/bin\
509           /usr/lib/stepmake/bin\
510           stepmake/bin\
511           $srcdir/stepmake/bin\
512         )
513     fi
514
515     AC_SUBST(builddir)
516     AC_SUBST(stepmake)
517     AC_SUBST(package)
518     AC_SUBST(PACKAGE)
519     AC_SUBST(PACKAGE_NAME)
520     AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE_NAME}")
521     AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, "${FULL_VERSION}")
522
523     if test "$package_depth" = "" ; then
524         package_depth="."
525     else
526         package_depth="../$package_depth"
527     fi
528     export package_depth
529     AC_SUBST(package_depth)
530
531     AUTOGENERATE="This file was automatically generated by configure"
532     AC_SUBST(AUTOGENERATE)
533
534     CONFIGSUFFIX=
535     AC_ARG_ENABLE(config,
536     [  --enable-config=CONF    put settings in config-CONF.make and config-CONF.h;
537                             do \`make conf=CONF' to get output in ./out-CONF],
538     [CONFIGURATION=$enableval])
539
540     ##'
541
542     test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
543     CONFIGFILE=config$CONFIGSUFFIX
544     AC_SUBST(CONFIGSUFFIX)
545      
546     AC_CANONICAL_HOST
547     STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
548     STEPMAKE_PROGS(FIND, find, REQUIRED)
549
550     STEPMAKE_PROGS(TAR, tar, REQUIRED)
551
552     if test "x`uname`" = "xHP-UX"; then
553         AC_PATH_PROG(BASH, bash, /bin/sh)
554         STEPMAKE_WARN(avoiding buggy /bin/sh)
555         AC_PATH_PROG(SHELL, bash, /bin/ksh)
556     else
557         AC_PATH_PROG(BASH, bash, /bin/sh)
558         SHELL=/bin/sh
559         AC_SUBST(SHELL)
560     fi
561
562     STEPMAKE_PATH_PROG(PYTHON, python, REQUIRED)
563
564     if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
565         $MAKE -v 2> /dev/null | grep GNU > /dev/null
566         if test "$?" = 1; then
567             warn='make (Please install *GNU* make)'
568             # STEPMAKE_WARN($warn)
569             STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
570         fi
571     fi 
572
573     if test "$OSTYPE" = "cygwin" -o "$OSTYPE" = "cygwin32" -o "$OSTYPE" = "Windows_NT"; then
574         LN=cp # hard link does not work under cygnus-nt
575         LN_S='cp -r' # symbolic link does not work for native nt
576         ZIP="zip -r -9" #
577         program_suffix=.exe
578         ROOTSEP=':'
579         DIRSEP='/'
580         PATHSEP=':'
581         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
582     else
583         ROOTSEP=':'
584         DIRSEP='/'
585         PATHSEP=':'
586         LN=ln
587         LN_S='ln -s'
588         ZIP="zip -r -9"
589         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
590     fi
591     AC_SUBST(program_prefix)
592     AC_SUBST(program_suffix)
593     AC_SUBST(ZIP)
594     AC_SUBST(LN)
595     AC_SUBST(LN_S)
596     AC_SUBST(INSTALL)
597     AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}')
598     AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}')
599     AC_SUBST(DIRSEP)
600     AC_SUBST(PATHSEP)
601     AC_SUBST(ROOTSEP)
602   
603     STEPMAKE_DATADIR
604 ])
605
606
607 AC_DEFUN(STEPMAKE_KPATHSEA, [
608
609     kpathsea_b=yes
610     #FIXME --with-xxx is meant for specifying a PATH too,
611     # so this should read: --enable-kpathsea,
612     # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
613     AC_ARG_WITH(kpathsea,
614     [  --with-kpathsea         use kpathsea lib.  Default: on],
615     [kpathsea_b=$with_kpathsea])
616
617     if test "$kpathsea_b" != "no"; then 
618         AC_HAVE_HEADERS(kpathsea/kpathsea.h)
619         AC_CHECK_LIB(kpathsea, kpse_find_file)
620         AC_CHECK_FUNCS(kpse_find_file,, AC_ERROR(Cannot find kpathsea functions.  You should install kpathsea; see INSTALL.txt.  Rerun ./configure --without-kpathsea only if kpathsea is not available for your platform.))
621     fi
622     AC_MSG_CHECKING(whether to use kpathsea)
623     if test "$kpathsea_b" != no; then
624         AC_MSG_RESULT(yes)
625         KPATHSEA=1
626     else
627         AC_MSG_RESULT(no)
628         KPATHSEA=0
629     fi
630
631     AC_SUBST(KPATHSEA)
632     AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
633 ])
634
635
636 AC_DEFUN(STEPMAKE_LIB, [
637     STEPMAKE_PROGS(AR, ar, $1)
638     AC_PROG_RANLIB
639     STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
640 ])
641
642
643 AC_DEFUN(STEPMAKE_LIBTOOL, [
644     # libtool.info ...
645     # **Never** try to set library version numbers so that they correspond
646     # to the release number of your package.  This is an abuse that only
647     # fosters misunderstanding of the purpose of library versions.
648
649     REVISION=$PATCH_LEVEL
650     # CURRENT=$MINOR_VERSION
651     CURRENT=`expr $MINOR_VERSION + 1`
652     # AGE=$(expr $MAJOR_VERSION + 1)
653     AGE=$MAJOR_VERSION
654     AC_SUBST(CURRENT)
655     AC_SUBST(REVISION)
656     AC_SUBST(AGE)
657 ])
658
659
660 AC_DEFUN(STEPMAKE_LOCALE, [
661     lang=English
662     ALL_LINGUAS="en nl"
663
664     # with/enable ??
665     AC_ARG_WITH(localedir,
666     [  --with-localedir=LOCALE use LOCALE as locale dir.  Default:
667                             PREFIX/share/locale ],
668     localedir=$with_localedir,
669     localedir='${prefix}/share/locale')
670
671     AC_ARG_WITH(lang,
672     [  --with-lang=LANG        use LANG as language to emit messages],
673     language=$with_lang,
674     language=English)
675
676     AC_MSG_CHECKING(language)    
677     case "$language" in
678       En* | en* | Am* | am* | US* | us*)
679             lang=English;;
680       NL | nl | Du* | du* | Ned* | ned*)
681             lang=Dutch;;
682       "")
683             lang=English;;
684       *)
685             lang=unknown;;
686     esac
687     AC_MSG_RESULT($lang)
688
689     if test "$lang" = "unknown" ; then
690         STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
691     fi
692
693 ])
694
695
696 AC_DEFUN(STEPMAKE_MAKEINFO, [
697     STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
698     if test "$MAKEINFO" = "makeinfo"; then
699         AC_MSG_CHECKING(whether makeinfo can split html by @node)
700         mkdir -p out
701         makeinfo --html --output=out/split <<EOF
702 \input texinfo
703 \input texinfo @c -*-texinfo-*-
704 @setfilename split.info
705 @settitle split.info
706 @bye
707 EOF
708         if test -d out/split; then
709             SPLITTING_MAKEINFO=yes
710             AC_MSG_RESULT(yes)
711             rm -rf out/split
712         else
713             AC_MSG_RESULT(no)
714             STEPMAKE_WARN(your html documentation will be one large file)
715             rm -rf out/split
716         fi
717     fi
718     AC_SUBST(SPLITTING_MAKEINFO)
719 ])
720
721
722
723 AC_DEFUN(STEPMAKE_MAN, [
724     STEPMAKE_PROGS(GROFF, groff ditroff, $1)
725     AC_SUBST(GROFF)
726     STEPMAKE_PROGS(TROFF, troff, $1)
727     AC_SUBST(TROFF)
728     STEPMAKE_PROGS(TBL, tbl, $1)
729     AC_SUBST(TBL)
730 ])
731
732
733 AC_DEFUN(STEPMAKE_MSGFMT, [
734     STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
735 ])
736
737
738 # Check for program ($2), set full path result to ($1).
739 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
740 AC_DEFUN(STEPMAKE_PATH_PROG, [
741     AC_CHECK_PROGS($1, $2, no)
742     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
743     if test $? -eq 0; then
744         AC_PATH_PROG($1, $2)
745         if test -n "$4"; then
746             STEPMAKE_CHECK_VERSION($1, $3, $4)
747         fi
748     fi
749 ])
750
751
752 # Check for program in set of names ($2), set result to ($1) .
753 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
754 # If exists, and a minimal version ($4) is required
755 AC_DEFUN(STEPMAKE_PROGS, [
756     AC_CHECK_PROGS($1, $2, no)
757     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
758     if test $? -eq 0 -a -n "$4"; then
759         STEPMAKE_CHECK_VERSION($1, $3, $4)
760     fi
761 ])
762
763
764 AC_DEFUN(STEPMAKE_PERL, [
765     STEPMAKE_PATH_PROG(PERL, perl, $1)
766 ])
767
768
769 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
770     AC_HAVE_HEADERS(python2.2/Python.h python2.1/Python.h python2.0/Python.h python2/Python.h python/Python.h python1.5/Python.h Python.h, PYTHON_HEADER=yes)
771     if test -z "$PYTHON_HEADER"; then
772         warn='python.h (python-devel, python-dev or libpython-dev package)'
773         STEPMAKE_ADD_ENTRY($1, $warn)
774     fi
775 ])
776
777
778 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
779     AC_ARG_ENABLE(tfm-path,
780     [  --enable-tfm-path=PATH  set path of tex directories where tfm files live,
781                             esp.: cmr10.tfm.  Default: use kpsewhich],
782     [tfm_path=$enableval],
783     [tfm_path=auto] )
784
785     # ugh
786     STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
787     AC_MSG_CHECKING(for tfm path)
788
789     TFM_FONTS="cmr msam"
790
791     if test "x$tfm_path" = xauto ; then
792         if test "x$KPSEWHICH" != "xno" ; then
793             for i in $TFM_FONTS; do
794                 dir=`$KPSEWHICH tfm ${i}10.tfm`
795                 TFM_PATH="$TFM_PATH `dirname $dir`"
796             done
797         else
798             STEPMAKE_WARN(Please specify where cmr10.tfm lives:
799     ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
800         fi
801     else
802          TFM_PATH=$tfm_path
803     fi
804
805     TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
806     AC_MSG_RESULT($TFM_PATH)
807     AC_SUBST(TFM_PATH)
808 ])
809
810
811 AC_DEFUN(STEPMAKE_TEXMF, [
812     # urg, never know what names these teTeX guys will think up
813
814     STEPMAKE_PROGS(METAFONT, mf mfont, $1)
815     STEPMAKE_PROGS(INIMETAFONT, inimf inimfont, $1)
816
817     AC_MSG_CHECKING(for working metafont mode)
818     modelist='ljfour lj4 lj3 lj2 ljet laserjet'
819     for MFMODE in $modelist; do
820         $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
821         if test -f mfput.tfm; then
822             break;
823         fi
824     done
825     AC_MSG_RESULT($MFMODE)
826
827     rm -f mfput.*
828
829     AC_SUBST(MFMODE)
830 ])
831
832
833 AC_DEFUN(STEPMAKE_WARN, [
834     AC_MSG_WARN($1)
835     warn_b=yes
836 ])
837
838