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