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