]> git.donarmstrong.com Git - lilypond.git/blob - aclocal.m4
* aclocal.m4: Regenerate.
[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/fred/cvs/savannah/lilypond/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     exe=`STEPMAKE_GET_EXECUTABLE($r)`
94     ver=`STEPMAKE_GET_VERSION($exe)`
95     num=`STEPMAKE_NUMERIC_VERSION($ver)`
96     req=`STEPMAKE_NUMERIC_VERSION($3)`
97     AC_MSG_RESULT("$ver")
98     if test "$num" -lt "$req"; then
99         STEPMAKE_ADD_ENTRY($2, "$r $3 (installed: $ver)")
100     fi
101 ])
102
103 ### Macros to build configure.in
104
105
106 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
107     STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
108     if test "$BIBTEX2HTML" = "bib2html"; then
109         BIBTEX2HTML_FLAGS='$< $(@)'
110     else
111         BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
112     fi
113     AC_SUBST(BIBTEX2HTML)
114     AC_SUBST(BIBTEX2HTML_FLAGS)
115 ])
116
117
118 AC_DEFUN(STEPMAKE_BISON, [
119     # ugh, automake: we want (and check for) bison
120     AC_PROG_YACC
121     
122     STEPMAKE_PROGS(BISON, bison, $1)
123     
124     # urg.  should test functionality rather than version.
125     if test "$BISON" = "bison" -a -n "$2"; then
126         STEPMAKE_CHECK_VERSION(BISON, $1, $2)
127     fi
128 ])
129
130
131 AC_DEFUN(STEPMAKE_COMPILE, [
132     # -O is necessary to get inlining
133     CFLAGS=${CFLAGS-""}
134     CXXFLAGS=${CXXFLAGS-$CFLAGS}
135     LDFLAGS=${LDFLAGS-""}
136     checking_b=yes
137     optimise_b=yes
138     profile_b=no
139     debug_b=yes
140
141     AC_ARG_ENABLE(checking,
142     [  --enable-checking       set runtime checks (assert calls).  Default: on],
143     [checking_b=$enableval] )
144
145     AC_ARG_ENABLE(debugging,
146     [  --enable-debugging      compile with debugging info.  Default: on],
147     [debug_b=$enableval])
148
149     AC_ARG_ENABLE(optimising,
150     [  --enable-optimising     compile with optimising.  Default: on],
151     [optimise_b=$enableval])
152
153     AC_ARG_ENABLE(profiling, 
154     [  --enable-profiling      compile with gprof support.  Default: off],
155     [profile_b=$enableval])
156     
157
158     if test "$checking_b" = no; then
159         # ugh
160         AC_DEFINE(NDEBUG)
161         DEFINES="$DEFINES -DNDEBUG"
162     fi
163
164     if test "$optimise_b" = yes; then
165         OPTIMIZE="-O2 -finline-functions"
166     fi
167
168
169     if test $profile_b = yes; then
170         EXTRA_LIBES="-pg"
171         OPTIMIZE="$OPTIMIZE -pg"
172     fi
173
174     if test $debug_b = yes; then        
175         OPTIMIZE="$OPTIMIZE -g"
176     fi
177
178
179     AC_PROG_CC
180     STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
181     LD='$(CC)'
182     AC_SUBST(LD)
183
184     CFLAGS="$CFLAGS $OPTIMIZE"
185     CPPFLAGS=${CPPFLAGS-""}
186
187     AC_MSG_CHECKING([for IEEE-conformance compiler flags])
188     save_cflags="$CFLAGS"
189     case "$host" in
190         alpha*-*-*)
191             dnl should do compile test?
192             AC_MSG_RESULT(-mieee)
193             CFLAGS="-mieee $CFLAGS"
194             ;;
195         *)
196             AC_MSG_RESULT([none])
197             ;;
198     esac
199     AC_SUBST(cross_compiling)
200     AC_SUBST(CFLAGS)
201     AC_SUBST(CPPFLAGS)
202     AC_SUBST(LDFLAGS)
203     AC_SUBST(ICFLAGS)
204     AC_SUBST(ILDFLAGS)
205     AC_SUBST(DEFINES)
206     AC_SUBST(EXTRA_LIBES)
207 ])
208
209 AC_DEFUN(STEPMAKE_CXX, [
210     AC_LANG_CPLUSPLUS
211     AC_PROG_CXX
212     STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
213
214     CPPFLAGS="$CPPFLAGS $DEFINES"
215     CXXFLAGS="$CXXFLAGS $OPTIMIZE"
216     LDFLAGS="$LDFLAGS $EXTRA_LIBES"
217
218     AC_SUBST(CXXFLAGS)
219     AC_SUBST(CXX)
220     LD='$(CXX)'
221     AC_SUBST(LD)
222 ])
223
224
225 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
226     AC_CACHE_CHECK([whether explicit instantiation is needed],
227         lily_cv_need_explicit_instantiation,
228         AC_TRY_LINK([
229     template <class T> struct foo { static int baz; };
230     template <class T> int foo<T>::baz = 1;
231     ], [ return foo<int>::baz; ],
232             lily_cv_need_explicit_instantiation=no,
233             lily_cv_need_explicit_instantiation=yes))
234     if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
235         AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
236     fi
237 ])
238
239
240 AC_DEFUN(STEPMAKE_DATADIR, [
241     presome=${prefix}
242     if test "$prefix" = "NONE"; then
243         presome=${ac_default_prefix}
244     fi
245     datadir=$(echo ${datadir} | sed "s!\\\${prefix}!$presome!")
246     
247     package_datadir=$datadir/$package
248     local_package_datadir=$package_datadir/$FULL_VERSION
249     build_package_datadir=$builddir/share/$package
250     
251     AC_SUBST(datadir)
252     AC_SUBST(package_datadir)
253     AC_SUBST(local_package_datadir)
254     AC_SUBST(build_package_datadir)
255     AC_DEFINE_UNQUOTED(DATADIR, "${datadir}")
256     AC_DEFINE_UNQUOTED(PACKAGE_DATADIR, "${package_datadir}")
257     AC_DEFINE_UNQUOTED(LOCAL_PACKAGE_DATADIR, "${local_package_datadir}")
258     AC_DEFINE_UNQUOTED(BUILD_PACKAGE_DATADIR, "${build_package_datadir}")
259 ])
260
261
262 AC_DEFUN(STEPMAKE_END, [
263     AC_SUBST(OPTIONAL)
264     AC_SUBST(REQUIRED)
265     
266     AC_OUTPUT($CONFIGFILE.make:config.make.in)
267
268     
269     if test -n "$OPTIONAL"; then
270         echo
271         echo "WARNING: Please consider installing optional programs: $OPTIONAL"
272     fi
273
274     if test -n "$REQUIRED"; then
275         echo
276         echo "ERROR: Please install required programs: $REQUIRED"
277     fi
278     
279     if test -n "$OPTIONAL$REQUIRED"; then
280         echo
281         echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
282         echo "Remove config.cache before rerunning ./configure"
283     fi
284     
285     if test -n "$REQUIRED"; then
286         rm -f $srcdir/GNUmakefile
287         exit 1
288     fi
289
290     # regular in-place build
291     # test for srcdir_build = yes ?
292     if test "$srcdir_build" = "yes"; then
293         rm -f $srcdir/GNUmakefile
294         cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
295         chmod 444 $srcdir/GNUmakefile
296     else # --srcdir build
297         rm -f GNUmakefile
298         cp $srcdir/make/srcdir.make.in GNUmakefile
299         chmod 444 GNUmakefile
300     fi
301 ])
302
303
304 AC_DEFUN(STEPMAKE_FLEX, [
305     # ugh, automake: we want (and check for) flex
306     # AC_PROG_LEX
307     # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
308
309     # AC_DECL_YYTEXT
310     # ugh, ugh
311     ac_cv_prog_lex_root=lex.yy
312     STEPMAKE_PROGS(FLEX, flex, $1)
313 ])
314
315
316 AC_DEFUN(STEPMAKE_FLEXLEXER, [
317     AC_HAVE_HEADERS(FlexLexer.h, true, false)
318     if test $? -ne 0; then
319         warn='FlexLexer.h (flex package)'
320         STEPMAKE_ADD_ENTRY($1, $warn)
321     fi
322 ])
323
324
325 AC_DEFUN(STEPMAKE_GCC, [
326     if test "$GCC" = "yes"; then
327         STEPMAKE_CHECK_VERSION(CC, $1, $2)
328     else
329         warn="$CC (Please install *GNU* cc)"
330         STEPMAKE_ADD_ENTRY($1, $warn)
331     fi
332 ])
333
334
335 AC_DEFUN(STEPMAKE_GETTEXT, [
336     presome=${prefix}
337     if test "$prefix" = "NONE"; then
338             presome=${ac_default_prefix}
339     fi
340     localedir=$(echo ${localedir} | sed "s!\\\${prefix}!$presome!")
341     
342     AC_SUBST(localedir)
343     AC_DEFINE_UNQUOTED(LOCALEDIR, "${localedir}")
344     AC_CHECK_LIB(intl, gettext)
345     AC_CHECK_FUNCS(gettext)
346 ])
347
348
349 AC_DEFUN(STEPMAKE_GUILE, [
350     STEPMAKE_PATH_PROG(GUILE, guile, $1)
351 ])
352
353
354 #   STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
355 #
356 #   This macro runs the guile-config script, installed with Guile,
357 #   to find out where Guile's header files and libraries are
358 #   installed.  It sets two variables, marked for substitution, as
359 #   by AC_SUBST.
360 #   
361 #     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
362 #             code that uses Guile header files.  This is almost
363 #             always just a -I flag.
364 #   
365 #     GUILE_LDFLAGS --- flags to pass to the linker to link a
366 #             program against Guile.  This includes -lguile for
367 #             the Guile library itself, any libraries that Guile
368 #             itself requires (like -lqthreads), and so on.  It may
369 #             also include a -L flag to tell the compiler where to
370 #             find the libraries.
371
372 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
373     exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
374     if test -x $exe; then
375         AC_MSG_CHECKING("guile compile flags")
376         GUILE_CFLAGS="`$guile_config compile`"
377         AC_MSG_RESULT($GUILE_CFLAGS)
378         AC_MSG_CHECKING("guile link flags")
379         GUILE_LDFLAGS="`$guile_config link`"
380         AC_MSG_RESULT($GUILE_LDFLAGS)
381     fi
382     AC_SUBST(GUILE_CFLAGS)
383     AC_SUBST(GUILE_LDFLAGS)
384 ])
385
386
387 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
388     ## First, let's just see if we can find Guile at all.
389     AC_MSG_CHECKING("for guile-config")
390     for guile_config in guile-config $target-guile-config $build-guile-config; do
391         AC_MSG_RESULT("$guile_config")
392         if ! $guile_config --version > /dev/null 2>&1 ; then
393             AC_MSG_WARN("cannot execute $guile_config")
394             AC_MSG_CHECKING("if we are cross compiling")
395             GUILE_CONFIG='echo no guile-config'
396         else
397             GUILE_CONFIG=$guile_config
398             break
399         fi
400     done
401     STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
402     if test $? -ne 0; then
403         STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
404     fi 
405
406     STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
407     # urg.  should test functionality rather than version.
408     if test $? -eq 0 -a -n "$2"; then
409         STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
410     fi
411
412     AC_SUBST(GUILE_CONFIG)
413     
414     guile_version="$ver"
415     changequote(<<, >>)dnl
416     GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
417     GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
418     GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
419     changequote([, ])dnl
420     STEPMAKE_GUILE_FLAGS
421     AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
422     AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
423     AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
424 ])
425
426
427 AC_DEFUN(STEPMAKE_GXX, [
428     if test "$GXX" = "yes"; then
429         STEPMAKE_CHECK_VERSION(CXX, $1, $2)
430     else
431         warn="$CXX (Please install *GNU* c++)"
432         STEPMAKE_ADD_ENTRY($1, $warn)
433     fi
434 ])
435
436
437 AC_DEFUN(STEPMAKE_INIT, [
438
439     . $srcdir/VERSION
440     FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
441     if test x$MY_PATCH_LEVEL != x; then
442         FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
443     fi
444
445     # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
446     changequote(<<, >>)dnl
447     PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
448     package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
449     changequote([, ])dnl
450
451     # No versioning on directory names of sub-packages 
452     # urg, urg
453     stepmake=${datadir}/stepmake
454     presome=${prefix}
455     if test "$prefix" = "NONE"; then
456             presome=${ac_default_prefix}
457     fi
458     stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
459
460     # urg, how is this supposed to work?
461     if test "$program_prefix" = "NONE"; then
462           program_prefix=
463     fi
464     if test "$program_suffix" = "NONE"; then
465           program_suffix=
466     fi
467
468     AC_MSG_CHECKING(Package)
469     if test "$PACKAGE" = "STEPMAKE"; then
470         AC_MSG_RESULT(Stepmake package!)
471
472         AC_MSG_CHECKING(builddir)
473         builddir="`pwd`"
474         if test "$srcdir" = "."; then
475             srcdir_build=yes
476         else
477             srcdir_build=no
478             package_builddir="`dirname $builddir`"
479             package_srcdir="`dirname  $srcdir`"
480         fi
481         AC_MSG_RESULT($builddir)
482
483         (cd stepmake 2>/dev/null || mkdir stepmake)
484         (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
485         AC_CONFIG_AUX_DIR(bin)
486         stepmake=stepmake
487     else
488         AC_MSG_RESULT($PACKAGE)
489
490         AC_MSG_CHECKING(builddir)
491         builddir="`pwd`"
492         if test "$srcdir" = "."; then
493             srcdir_build=yes
494         else
495             srcdir_build=no
496         fi
497         AC_MSG_RESULT($builddir)
498
499         AC_MSG_CHECKING(for stepmake)
500         # Check for installed stepmake
501         if test -d $stepmake; then
502             AC_MSG_RESULT($stepmake)
503         else
504             stepmake="`cd $srcdir/stepmake; pwd`"
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 -z "$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     AC_ARG_WITH(kpathsea-include,
617         [  --with-kpathsea-include=DIR
618                           location of the kpathsea include dir],[
619             if test "$withval" = "yes" -o "$withval" = "no"; then
620                 AC_MSG_WARN(Usage: --with-kpathsea-include=includedir)
621             else
622                 CPPFLAGS="$CPPFLAGS -I${withval}"
623             fi
624             ])
625     
626     AC_ARG_WITH(kpathsea-lib,
627         [  --with-kpathsea-lib=DIR location of the kpathsea lib dir],[
628             if test "$withval" = "yes" -o "$withval" = "no"; then
629                 AC_MSG_WARN(Usage: --with-kpathsea-lib=libdir)
630             else
631                 LDFLAGS="$LDFLAGS -L${withval}"
632             fi
633             ])
634     
635     kpathsea_b=yes
636     #FIXME --with-xxx is meant for specifying a PATH too,
637     # so this should read: --enable-kpathsea,
638     # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
639     AC_ARG_WITH(kpathsea,
640     [  --with-kpathsea         use kpathsea lib.  Default: on],
641     [kpathsea_b=$with_kpathsea])
642
643     if test "$kpathsea_b" != "no"; then 
644         AC_HAVE_HEADERS(kpathsea/kpathsea.h)
645         AC_CHECK_LIB(kpathsea, kpse_find_file)
646         AC_CHECK_FUNCS(kpse_find_file,,kpathsea_b=no)
647         if test "$kpathsea_b" = "no"; then
648             warn='kpathsea (libkpathsea-dev or kpathsea-devel package)
649    Else, please specify the location of your kpathsea using
650    --with-kpathea-include and --with-kpathsea-lib options.  You should
651    install kpathsea; see INSTALL.txt.  Rerun ./configure
652    --without-kpathsea only if kpathsea is not available for your
653    platform.'
654             STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
655         fi
656     fi
657     AC_MSG_CHECKING(whether to use kpathsea)
658     if test "$kpathsea_b" != no; then
659         AC_MSG_RESULT(yes)
660         KPATHSEA=1
661     else
662         AC_MSG_RESULT(no)
663         KPATHSEA=0
664     fi
665
666     AC_SUBST(KPATHSEA)
667     AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
668 ])
669
670
671 AC_DEFUN(STEPMAKE_LIB, [
672     STEPMAKE_PROGS(AR, ar, $1)
673     AC_PROG_RANLIB
674     STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
675 ])
676
677
678 AC_DEFUN(STEPMAKE_LIBTOOL, [
679     # libtool.info ...
680     # **Never** try to set library version numbers so that they correspond
681     # to the release number of your package.  This is an abuse that only
682     # fosters misunderstanding of the purpose of library versions.
683
684     REVISION=$PATCH_LEVEL
685     # CURRENT=$MINOR_VERSION
686     CURRENT=`expr $MINOR_VERSION + 1`
687     # AGE=$(expr $MAJOR_VERSION + 1)
688     AGE=$MAJOR_VERSION
689     AC_SUBST(CURRENT)
690     AC_SUBST(REVISION)
691     AC_SUBST(AGE)
692 ])
693
694
695 AC_DEFUN(STEPMAKE_LOCALE, [
696     lang=English
697     ALL_LINGUAS="en nl"
698
699     # with/enable ??
700     AC_ARG_WITH(localedir,
701     [  --with-localedir=LOCALE use LOCALE as locale dir.  Default:
702                             PREFIX/share/locale ],
703     localedir=$with_localedir,
704     localedir='${prefix}/share/locale')
705
706     AC_ARG_WITH(lang,
707     [  --with-lang=LANG        use LANG as language to emit messages],
708     language=$with_lang,
709     language=English)
710
711     AC_MSG_CHECKING(language)    
712     case "$language" in
713       En* | en* | Am* | am* | US* | us*)
714             lang=English;;
715       NL | nl | Du* | du* | Ned* | ned*)
716             lang=Dutch;;
717       "")
718             lang=English;;
719       *)
720             lang=unknown;;
721     esac
722     AC_MSG_RESULT($lang)
723
724     if test "$lang" = "unknown" ; then
725         STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
726     fi
727
728 ])
729
730
731 AC_DEFUN(STEPMAKE_MAKEINFO, [
732     STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
733     if test "$MAKEINFO" = "makeinfo"; then
734         AC_MSG_CHECKING(whether makeinfo can split html by @node)
735         mkdir -p out
736         makeinfo --html --output=out/split <<EOF
737 \input texinfo
738 \input texinfo @c -*-texinfo-*-
739 @setfilename split.info
740 @settitle split.info
741 @bye
742 EOF
743         if test -d out/split; then
744             SPLITTING_MAKEINFO=yes
745             AC_MSG_RESULT(yes)
746             rm -rf out/split
747         else
748             AC_MSG_RESULT(no)
749             STEPMAKE_WARN(your html documentation will be one large file)
750             rm -rf out/split
751         fi
752     fi
753     AC_SUBST(SPLITTING_MAKEINFO)
754 ])
755
756
757
758 AC_DEFUN(STEPMAKE_MAN, [
759     STEPMAKE_PROGS(GROFF, groff ditroff, $1)
760     AC_SUBST(GROFF)
761     STEPMAKE_PROGS(TROFF, troff, $1)
762     AC_SUBST(TROFF)
763     STEPMAKE_PROGS(TBL, tbl, $1)
764     AC_SUBST(TBL)
765 ])
766
767
768 AC_DEFUN(STEPMAKE_MSGFMT, [
769     STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
770 ])
771
772
773 # Check for program ($2), set full path result to ($1).
774 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
775 AC_DEFUN(STEPMAKE_PATH_PROG, [
776     AC_CHECK_PROGS($1, $2, no)
777     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
778     if test $? -eq 0; then
779         AC_PATH_PROG($1, $2)
780         if test -n "$4"; then
781             STEPMAKE_CHECK_VERSION($1, $3, $4)
782         fi
783     fi
784 ])
785
786
787 # Check for program in set of names ($2), set result to ($1) .
788 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
789 # If exists, and a minimal version ($4) is required
790 AC_DEFUN(STEPMAKE_PROGS, [
791     AC_CHECK_PROGS($1, $2, no)
792     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
793     if test $? -eq 0 -a -n "$4"; then
794         STEPMAKE_CHECK_VERSION($1, $3, $4)
795     fi
796 ])
797
798
799 AC_DEFUN(STEPMAKE_PERL, [
800     STEPMAKE_PATH_PROG(PERL, perl, $1)
801 ])
802
803
804 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
805     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)
806     if test -z "$PYTHON_HEADER"; then
807         warn='python.h (python-devel, python-dev or libpython-dev package)'
808         STEPMAKE_ADD_ENTRY($1, $warn)
809     fi
810 ])
811
812
813 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
814     AC_ARG_ENABLE(tfm-path,
815     [  --enable-tfm-path=PATH  set path of tex directories where tfm files live,
816                             esp.: cmr10.tfm.  Default: use kpsewhich],
817     [tfm_path=$enableval],
818     [tfm_path=auto] )
819
820     # ugh
821     STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
822     AC_MSG_CHECKING(for tfm path)
823
824     TFM_FONTS="cmr msam"
825
826     if test "x$tfm_path" = xauto ; then
827         if test "x$KPSEWHICH" != "xno" ; then
828             for i in $TFM_FONTS; do
829                 dir=`$KPSEWHICH tfm ${i}10.tfm`
830                 TFM_PATH="$TFM_PATH `dirname $dir`"
831             done
832         else
833             STEPMAKE_WARN(Please specify where cmr10.tfm lives:
834     ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
835         fi
836     else
837          TFM_PATH=$tfm_path
838     fi
839
840     TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
841     AC_MSG_RESULT($TFM_PATH)
842     AC_SUBST(TFM_PATH)
843 ])
844
845
846 AC_DEFUN(STEPMAKE_TEXMF, [
847     # urg, never know what names these teTeX guys will think up
848
849     STEPMAKE_PROGS(METAFONT, mf mfont, $1)
850     STEPMAKE_PROGS(INIMETAFONT, inimf inimfont, $1)
851
852     AC_MSG_CHECKING(for working metafont mode)
853     modelist='ljfour lj4 lj3 lj2 ljet laserjet'
854     for MFMODE in $modelist; do
855         $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
856         if test -f mfput.tfm; then
857             break;
858         fi
859     done
860     AC_MSG_RESULT($MFMODE)
861
862     rm -f mfput.*
863
864     AC_SUBST(MFMODE)
865 ])
866
867
868 AC_DEFUN(STEPMAKE_WARN, [
869     AC_MSG_WARN($1)
870     warn_b=yes
871 ])
872
873