]> git.donarmstrong.com Git - lilypond.git/blob - aclocal.m4
Fix for ash as /bin/sh.
[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_CPLUSPLUS
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_OUTPUT($CONFIGFILE.make:config.make.in)
255
256     
257     if test -n "$OPTIONAL"; then
258         echo
259         echo "WARNING: Please consider installing optional programs: $OPTIONAL"
260     fi
261
262     if test -n "$REQUIRED"; then
263         echo
264         echo "ERROR: Please install required programs: $REQUIRED"
265     fi
266     
267     if test -n "$OPTIONAL$REQUIRED"; then
268         echo
269         echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
270         echo "Remove config.cache before rerunning ./configure"
271     fi
272     
273     if test -n "$REQUIRED"; then
274         rm -f $srcdir/GNUmakefile
275         exit 1
276     fi
277
278     # regular in-place build
279     # test for srcdir_build = yes ?
280     if test "$builddir" = "."; then
281         rm -f $srcdir/GNUmakefile
282         cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
283         chmod 444 $srcdir/GNUmakefile
284     else # --srcdir build
285         rm -f GNUmakefile
286         cp $srcdir/make/srcdir.make.in GNUmakefile
287         chmod 444 GNUmakefile
288     fi
289 ])
290
291
292 AC_DEFUN(STEPMAKE_FLEX, [
293     # ugh, automake: we want (and check for) flex
294     # AC_PROG_LEX
295     # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
296
297     # AC_DECL_YYTEXT
298     # ugh, ugh
299     ac_cv_prog_lex_root=lex.yy
300     STEPMAKE_PROGS(FLEX, flex, $1)
301 ])
302
303
304 AC_DEFUN(STEPMAKE_FLEXLEXER, [
305     AC_HAVE_HEADERS(FlexLexer.h, true, false)
306     if test $? -ne 0; then
307         warn='FlexLexer.h (flex package)'
308         STEPMAKE_ADD_ENTRY($1, $warn)
309     fi
310 ])
311
312
313 AC_DEFUN(STEPMAKE_GCC, [
314     if test "$GCC" = "yes"; then
315         STEPMAKE_CHECK_VERSION(CC, $1, $2)
316     else
317         warn="$CC (Please install *GNU* cc)"
318         STEPMAKE_ADD_ENTRY($1, $warn)
319     fi
320 ])
321
322
323 AC_DEFUN(STEPMAKE_GETTEXT, [
324     DIR_LOCALEDIR=${localedir}
325     presome=${prefix}
326     if test "$prefix" = "NONE"; then
327             presome=${ac_default_prefix}
328     fi
329     DIR_LOCALEDIR=`echo ${DIR_LOCALEDIR} | sed "s!\\\${prefix}!$presome!"`
330     AC_SUBST(localedir)
331     AC_SUBST(DIR_LOCALEDIR)
332     AC_DEFINE_UNQUOTED(DIR_LOCALEDIR, "${DIR_LOCALEDIR}")
333
334     AC_CHECK_LIB(intl, gettext)
335     AC_CHECK_FUNCS(gettext)
336 ])
337
338
339 AC_DEFUN(STEPMAKE_GUILE, [
340     STEPMAKE_PATH_PROG(GUILE, guile, $1)
341 ])
342
343
344 #   STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
345 #
346 #   This macro runs the guile-config script, installed with Guile,
347 #   to find out where Guile's header files and libraries are
348 #   installed.  It sets two variables, marked for substitution, as
349 #   by AC_SUBST.
350 #   
351 #     GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
352 #             code that uses Guile header files.  This is almost
353 #             always just a -I flag.
354 #   
355 #     GUILE_LDFLAGS --- flags to pass to the linker to link a
356 #             program against Guile.  This includes -lguile for
357 #             the Guile library itself, any libraries that Guile
358 #             itself requires (like -lqthreads), and so on.  It may
359 #             also include a -L flag to tell the compiler where to
360 #             find the libraries.
361
362 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
363     exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
364     if test -x $exe; then
365         AC_MSG_CHECKING("guile compile flags")
366         GUILE_CFLAGS="`$guile_config compile`"
367         AC_MSG_RESULT($GUILE_CFLAGS)
368         AC_MSG_CHECKING("guile link flags")
369         GUILE_LDFLAGS="`$guile_config link`"
370         AC_MSG_RESULT($GUILE_LDFLAGS)
371     fi
372     AC_SUBST(GUILE_CFLAGS)
373     AC_SUBST(GUILE_LDFLAGS)
374 ])
375
376
377 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
378     ## First, let's just see if we can find Guile at all.
379     AC_MSG_CHECKING("for guile-config")
380     for guile_config in guile-config $target-guile-config $build-guile-config; do
381         AC_MSG_RESULT("$guile_config")
382         if ! $guile_config --version > /dev/null 2>&1 ; then
383             AC_MSG_WARN("cannot execute $guile_config")
384             AC_MSG_CHECKING("if we are cross compiling")
385             GUILE_CONFIG='echo no guile-config'
386         else
387             GUILE_CONFIG=$guile_config
388             break
389         fi
390     done
391     STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
392     if test $? -ne 0; then
393         STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
394     fi 
395
396     STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
397     # urg.  should test functionality rather than version.
398     if test $? -eq 0 -a -n "$2"; then
399         STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
400     fi
401
402     AC_SUBST(GUILE_CONFIG)
403     
404     guile_version="$ver"
405     changequote(<<, >>)dnl
406     GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
407     GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
408     changequote([, ])dnl
409     STEPMAKE_GUILE_FLAGS
410     AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
411     AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
412 ])
413
414
415 AC_DEFUN(STEPMAKE_GXX, [
416     if test "$GXX" = "yes"; then
417         STEPMAKE_CHECK_VERSION(CXX, $1, $2)
418     else
419         warn="$CXX (Please install *GNU* c++)"
420         STEPMAKE_ADD_ENTRY($1, $warn)
421     fi
422 ])
423
424
425 AC_DEFUN(STEPMAKE_INIT, [
426
427     . $srcdir/VERSION
428     FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
429     if test x$MY_PATCH_LEVEL != x; then
430         FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
431     fi
432
433     # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
434     changequote(<<, >>)dnl
435     PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
436     package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
437     changequote([, ])dnl
438
439     # No versioning on directory names of sub-packages 
440     # urg, urg
441     stepmake=${datadir}/stepmake
442     presome=${prefix}
443     if test "$prefix" = "NONE"; then
444             presome=${ac_default_prefix}
445     fi
446     stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
447
448     # urg, how is this supposed to work?
449     if test "$program_prefix" = "NONE"; then
450           program_prefix=
451     fi
452     if test "$program_suffix" = "NONE"; then
453           program_suffix=
454     fi
455
456     AC_MSG_CHECKING(Package)
457     if test "x$PACKAGE" = "xSTEPMAKE"; then
458         AC_MSG_RESULT(Stepmake package!)
459
460         AC_MSG_CHECKING(builddir)
461         if test "$srcdir" = "."; then
462             builddir=.
463         else
464             absolute_builddir="`pwd`"
465             package_absolute_builddir="`dirname $absolute_builddir`"
466             package_srcdir="`dirname  $srcdir`"
467             builddir="`dirname $package_srcdir`/`basename $package_absolute_builddir`/`basename $absolute_builddir`"
468         fi
469         AC_MSG_RESULT($builddir)
470
471         (cd stepmake 2>/dev/null || mkdir stepmake)
472         (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
473         AC_CONFIG_AUX_DIR(bin)
474         stepmake=stepmake
475     else
476         AC_MSG_RESULT($PACKAGE)
477
478         AC_MSG_CHECKING(builddir)
479         if test "$srcdir" = "."; then
480             builddir=.
481             srcdir_build=no
482         else
483             absolute_builddir="`pwd`"
484 #           builddir="`dirname  $srcdir`/`basename $absolute_builddir`"
485             builddir="`bash $srcdir/buildscripts/walk.sh \"$srcdir\"`"
486             srcdir_build=yes
487         fi
488         AC_MSG_RESULT($builddir)
489         if expr "$srcdir" : '/' > /dev/null 2>&1; then
490             absolute_srcdir=yes
491             STEPMAKE_WARN(Absolute --srcdir specified: $srcdir)
492         fi
493
494         AC_MSG_CHECKING(for stepmake)
495         # Check for installed stepmake
496         if test -d $stepmake; then
497             AC_MSG_RESULT($stepmake)
498         else
499             if test "$absolute_srcdir" != "yes"; then
500                 stepmake='$(depth)'/$srcdir/stepmake
501             else
502                 stepmake=$srcdir/stepmake
503             fi
504             AC_MSG_RESULT($srcdir/stepmake  ($datadir/stepmake not found))
505         fi
506
507         AC_CONFIG_AUX_DIR(\
508           $HOME/usr/local/share/stepmake/bin\
509           $HOME/usr/local/lib/stepmake/bin\
510           $HOME/usr/share/stepmake/bin\
511           $HOME/usr/lib/stepmake/bin\
512           /usr/local/share/stepmake/bin\
513           /usr/local/lib/stepmake/bin\
514           /usr/share/stepmake/bin\
515           /usr/lib/stepmake/bin\
516           stepmake/bin\
517           $srcdir/stepmake/bin\
518         )
519     fi
520
521     AC_SUBST(builddir)
522     AC_SUBST(stepmake)
523     AC_SUBST(package)
524     AC_SUBST(PACKAGE)
525     AC_SUBST(PACKAGE_NAME)
526     AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE_NAME}")
527     AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, "${FULL_VERSION}")
528
529     if test "$package_depth" = "" ; then
530         package_depth="."
531     else
532         package_depth="../$package_depth"
533     fi
534     export package_depth
535     AC_SUBST(package_depth)
536
537     AUTOGENERATE="This file was automatically generated by configure"
538     AC_SUBST(AUTOGENERATE)
539
540     CONFIGSUFFIX=
541     AC_ARG_ENABLE(config,
542     [  --enable-config=CONF    put settings in config-CONF.make and config-CONF.h;
543                             do \`make conf=CONF' to get output in ./out-CONF],
544     [CONFIGURATION=$enableval])
545
546     ##'
547
548     test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
549     CONFIGFILE=config$CONFIGSUFFIX
550     AC_SUBST(CONFIGSUFFIX)
551      
552     AC_CANONICAL_HOST
553     STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
554     STEPMAKE_PROGS(FIND, find, REQUIRED)
555
556     STEPMAKE_PROGS(TAR, tar, REQUIRED)
557
558     if test "x`uname`" = "xHP-UX"; then
559         AC_PATH_PROG(BASH, bash, /bin/sh)
560         STEPMAKE_WARN(avoiding buggy /bin/sh)
561         AC_PATH_PROG(SHELL, bash, /bin/ksh)
562     else
563         AC_PATH_PROG(BASH, bash, /bin/sh)
564         SHELL=/bin/sh
565         AC_SUBST(SHELL)
566     fi
567
568     STEPMAKE_PATH_PROG(PYTHON, python, REQUIRED)
569
570     if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
571         $MAKE -v 2> /dev/null | grep GNU > /dev/null
572         if test "$?" = 1; then
573             warn='make (Please install *GNU* make)'
574             # STEPMAKE_WARN($warn)
575             STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
576         fi
577     fi 
578
579     if test "$OSTYPE" = "cygwin" -o "$OSTYPE" = "cygwin32" -o "$OSTYPE" = "Windows_NT"; then
580         LN=cp # hard link does not work under cygnus-nt
581         LN_S='cp -r' # symbolic link does not work for native nt
582         ZIP="zip -r -9" #
583         program_suffix=.exe
584         ROOTSEP=':'
585         DIRSEP='/'
586         PATHSEP=':'
587         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
588     else
589         ROOTSEP=':'
590         DIRSEP='/'
591         PATHSEP=':'
592         LN=ln
593         LN_S='ln -s'
594         ZIP="zip -r -9"
595         INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
596     fi
597     AC_SUBST(program_prefix)
598     AC_SUBST(program_suffix)
599     AC_SUBST(ZIP)
600     AC_SUBST(LN)
601     AC_SUBST(LN_S)
602     AC_SUBST(INSTALL)
603     AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}')
604     AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}')
605     AC_SUBST(DIRSEP)
606     AC_SUBST(PATHSEP)
607     AC_SUBST(ROOTSEP)
608   
609     STEPMAKE_DATADIR
610 ])
611
612
613 AC_DEFUN(STEPMAKE_KPATHSEA, [
614
615     kpathsea_b=yes
616     #FIXME --with-xxx is meant for specifying a PATH too,
617     # so this should read: --enable-kpathsea,
618     # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
619     AC_ARG_WITH(kpathsea,
620     [  --with-kpathsea         use kpathsea lib.  Default: on],
621     [kpathsea_b=$with_kpathsea])
622
623     if test "$kpathsea_b" != "no"; then 
624         AC_HAVE_HEADERS(kpathsea/kpathsea.h)
625         AC_CHECK_LIB(kpathsea, kpse_find_file)
626         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.))
627     fi
628     AC_MSG_CHECKING(whether to use kpathsea)
629     if test "$kpathsea_b" != no; then
630         AC_MSG_RESULT(yes)
631         KPATHSEA=1
632     else
633         AC_MSG_RESULT(no)
634         KPATHSEA=0
635     fi
636
637     AC_SUBST(KPATHSEA)
638     AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
639 ])
640
641
642 AC_DEFUN(STEPMAKE_LIB, [
643     STEPMAKE_PROGS(AR, ar, $1)
644     AC_PROG_RANLIB
645     STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
646 ])
647
648
649 AC_DEFUN(STEPMAKE_LIBTOOL, [
650     # libtool.info ...
651     # **Never** try to set library version numbers so that they correspond
652     # to the release number of your package.  This is an abuse that only
653     # fosters misunderstanding of the purpose of library versions.
654
655     REVISION=$PATCH_LEVEL
656     # CURRENT=$MINOR_VERSION
657     CURRENT=`expr $MINOR_VERSION + 1`
658     # AGE=$(expr $MAJOR_VERSION + 1)
659     AGE=$MAJOR_VERSION
660     AC_SUBST(CURRENT)
661     AC_SUBST(REVISION)
662     AC_SUBST(AGE)
663 ])
664
665
666 AC_DEFUN(STEPMAKE_LOCALE, [
667     lang=English
668     ALL_LINGUAS="en nl"
669
670     # with/enable ??
671     AC_ARG_WITH(localedir,
672     [  --with-localedir=LOCALE use LOCALE as locale dir.  Default:
673                             PREFIX/share/locale ],
674     localedir=$with_localedir,
675     localedir='${prefix}/share/locale')
676
677     AC_ARG_WITH(lang,
678     [  --with-lang=LANG        use LANG as language to emit messages],
679     language=$with_lang,
680     language=English)
681
682     AC_MSG_CHECKING(language)    
683     case "$language" in
684       En* | en* | Am* | am* | US* | us*)
685             lang=English;;
686       NL | nl | Du* | du* | Ned* | ned*)
687             lang=Dutch;;
688       "")
689             lang=English;;
690       *)
691             lang=unknown;;
692     esac
693     AC_MSG_RESULT($lang)
694
695     if test "$lang" = "unknown" ; then
696         STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
697     fi
698
699 ])
700
701
702 AC_DEFUN(STEPMAKE_MAKEINFO, [
703     STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
704     if test "$MAKEINFO" = "makeinfo"; then
705         AC_MSG_CHECKING(whether makeinfo can split html by @node)
706         mkdir -p out
707         makeinfo --html --output=out/split <<EOF
708 \input texinfo
709 \input texinfo @c -*-texinfo-*-
710 @setfilename split.info
711 @settitle split.info
712 @bye
713 EOF
714         if test -d out/split; then
715             SPLITTING_MAKEINFO=yes
716             AC_MSG_RESULT(yes)
717             rm -rf out/split
718         else
719             AC_MSG_RESULT(no)
720             STEPMAKE_WARN(your html documentation will be one large file)
721             rm -rf out/split
722         fi
723     fi
724     AC_SUBST(SPLITTING_MAKEINFO)
725 ])
726
727
728
729 AC_DEFUN(STEPMAKE_MAN, [
730     STEPMAKE_PROGS(GROFF, groff ditroff, $1)
731     AC_SUBST(GROFF)
732     STEPMAKE_PROGS(TROFF, troff, $1)
733     AC_SUBST(TROFF)
734     STEPMAKE_PROGS(TBL, tbl, $1)
735     AC_SUBST(TBL)
736 ])
737
738
739 AC_DEFUN(STEPMAKE_MSGFMT, [
740     STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
741 ])
742
743
744 # Check for program ($2), set full path result to ($1).
745 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
746 AC_DEFUN(STEPMAKE_PATH_PROG, [
747     AC_CHECK_PROGS($1, $2, no)
748     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
749     if test $? -eq 0; then
750         AC_PATH_PROG($1, $2)
751         if test -n "$4"; then
752             STEPMAKE_CHECK_VERSION($1, $3, $4)
753         fi
754     fi
755 ])
756
757
758 # Check for program in set of names ($2), set result to ($1) .
759 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
760 # If exists, and a minimal version ($4) is required
761 AC_DEFUN(STEPMAKE_PROGS, [
762     AC_CHECK_PROGS($1, $2, no)
763     STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
764     if test $? -eq 0 -a -n "$4"; then
765         STEPMAKE_CHECK_VERSION($1, $3, $4)
766     fi
767 ])
768
769
770 AC_DEFUN(STEPMAKE_PERL, [
771     STEPMAKE_PATH_PROG(PERL, perl, $1)
772 ])
773
774
775 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
776     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)
777     if test -z "$PYTHON_HEADER"; then
778         warn='python.h (python-devel, python-dev or libpython-dev package)'
779         STEPMAKE_ADD_ENTRY($1, $warn)
780     fi
781 ])
782
783
784 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
785     AC_ARG_ENABLE(tfm-path,
786     [  --enable-tfm-path=PATH  set path of tex directories where tfm files live,
787                             esp.: cmr10.tfm.  Default: use kpsewhich],
788     [tfm_path=$enableval],
789     [tfm_path=auto] )
790
791     # ugh
792     STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
793     AC_MSG_CHECKING(for tfm path)
794
795     TFM_FONTS="cmr msam"
796
797     if test "x$tfm_path" = xauto ; then
798         if test "x$KPSEWHICH" != "xno" ; then
799             for i in $TFM_FONTS; do
800                 dir=`$KPSEWHICH tfm ${i}10.tfm`
801                 TFM_PATH="$TFM_PATH `dirname $dir`"
802             done
803         else
804             STEPMAKE_WARN(Please specify where cmr10.tfm lives:
805     ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
806         fi
807     else
808          TFM_PATH=$tfm_path
809     fi
810
811     TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
812     AC_MSG_RESULT($TFM_PATH)
813     AC_SUBST(TFM_PATH)
814 ])
815
816
817 AC_DEFUN(STEPMAKE_TEXMF, [
818     # urg, never know what names these teTeX guys will think up
819
820     STEPMAKE_PROGS(METAFONT, mf mfont, $1)
821     STEPMAKE_PROGS(INIMETAFONT, inimf inimfont, $1)
822
823     AC_MSG_CHECKING(for working metafont mode)
824     modelist='ljfour lj4 lj3 lj2 ljet laserjet'
825     for MFMODE in $modelist; do
826         $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
827         if test -f mfput.tfm; then
828             break;
829         fi
830     done
831     AC_MSG_RESULT($MFMODE)
832
833     rm -f mfput.*
834
835     AC_SUBST(MFMODE)
836 ])
837
838
839 AC_DEFUN(STEPMAKE_WARN, [
840     AC_MSG_WARN($1)
841     warn_b=yes
842 ])
843
844