1 dnl aclocal.m4 -*-shell-script-*-
2 dnl StepMake subroutines for configure.in
5 ### mostly interal macros
7 # Get full path of executable ($1)
8 AC_DEFUN(STEPMAKE_GET_EXECUTABLE, [
9 ## which doesn't work in ash, if /usr/bin/which isn't installed
10 ## type -p doesn't work in ash
11 ## command -v doesn't work in zsh
12 ## command -v "$1" 2>&1
13 ## this test should work in ash, bash, pdksh (ksh), zsh
14 type -p "$1" 2>/dev/null | tail -n 1 | awk '{print $NF}'
18 # Get version string from executable ($1)
19 AC_DEFUN(STEPMAKE_GET_VERSION, [
20 ## "$1" --version 2>&1 | grep -v '^$' | head -n 1 | awk '{print $NF}'
23 ## Workaround for broken Debian gcc version string:
24 ## gcc (GCC) 3.1.1 20020606 (Debian prerelease)
26 ## -V: Workaround for python
28 ## Assume, and hunt for, dotted version multiplet.
30 changequote(<<, >>)dnl
31 ("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' | head -n 1 | \
32 sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/'
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, [
41 if ([$]3) {three = [$]3}
44 {printf "%d\n", [$]1*1000000 + [$]2*1000 + three}'
48 # Add item ($2) to list ($1, one of 'OPTIONAL', 'REQUIRED')
49 AC_DEFUN(STEPMAKE_ADD_ENTRY, [
50 eval "$1"=\"`eval echo \"'$'$1\" \"$2\"`\"
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?
64 command="- echo $2 not found"
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
80 ##STEPMAKE_WARN(cannot find $2. $3)
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)`
97 if test "$num" -lt "$req"; then
98 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
100 vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION"
101 eval `echo $vervar=$num`
102 ## AC_SUBST(`eval echo $vervar`)
105 # Check version of program ($1)
106 # If version is greater than or equals unsupported ($3),
107 # add entry to unsupported list ($2, 'UNSUPPORTED')
108 AC_DEFUN(STEPMAKE_CHECK_VERSION_UNSUPPORTED, [
109 r="`eval echo '$'"$1"`"
110 AC_MSG_CHECKING([$r version])
111 exe=`STEPMAKE_GET_EXECUTABLE($r)`
112 ver=`STEPMAKE_GET_VERSION($exe)`
113 num=`STEPMAKE_NUMERIC_VERSION($ver)`
114 sup=`STEPMAKE_NUMERIC_VERSION($3)`
115 AC_MSG_RESULT([$ver])
116 if test "$num" -ge "$sup"; then
117 STEPMAKE_ADD_ENTRY($2, ["$r < $3 (installed: $ver)"])
121 ### Macros to build configure.in
124 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
125 STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
126 if test "$BIBTEX2HTML" = "bib2html"; then
127 BIBTEX2HTML_FLAGS='$< $(@)'
129 BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
131 AC_SUBST(BIBTEX2HTML)
132 AC_SUBST(BIBTEX2HTML_FLAGS)
136 AC_DEFUN(STEPMAKE_BISON, [
137 # ugh, automake: we want (and check for) bison
140 STEPMAKE_PROGS(BISON, bison, $1)
142 # urg. should test functionality rather than version.
143 if test "$BISON" = "bison" -a -n "$2"; then
144 STEPMAKE_CHECK_VERSION(BISON, $1, $2)
149 AC_DEFUN(STEPMAKE_COMPILE, [
150 # -O is necessary to get inlining
152 CXXFLAGS=${CXXFLAGS-$CFLAGS}
153 LDFLAGS=${LDFLAGS-""}
160 AC_ARG_ENABLE(checking,
161 [ --enable-checking set runtime checks (assert calls). Default: on],
162 [checking_b=$enableval] )
164 AC_ARG_ENABLE(debugging,
165 [ --enable-debugging compile with debugging info. Default: on],
166 [debug_b=$enableval])
168 AC_ARG_ENABLE(optimising,
169 [ --enable-optimising compile with optimising. Default: on],
170 [optimise_b=$enableval])
172 AC_ARG_ENABLE(profiling,
173 [ --enable-profiling compile with gprof support. Default: off],
174 [profile_b=$enableval])
177 [ --enable-pipe compile with -pipe. Default: on],
180 if test "$checking_b" = no; then
183 DEFINES="$DEFINES -DNDEBUG"
186 if test "$optimise_b" = yes; then
187 OPTIMIZE="-O2 -finline-functions"
190 if test $profile_b = yes; then
192 OPTIMIZE="$OPTIMIZE -pg"
195 if test $debug_b = yes; then
196 OPTIMIZE="$OPTIMIZE -g"
200 STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
204 # If -pipe requested, test if it works and add to CFLAGS.
205 if test "$pipe_b" = yes; then
206 save_cflags="$CFLAGS"
207 CFLAGS="-pipe $CFLAGS";
208 AC_CACHE_CHECK([whether compiler understands -pipe],
209 [stepmake_cflags_pipe],
210 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])],
211 [stepmake_cflags_pipe=yes],
212 [stepmake_cflags_pipe=no]))
214 if test $stepmake_cflags_pipe = yes; then
215 OPTIMIZE="$OPTIMIZE -pipe"
219 CFLAGS="$CFLAGS $OPTIMIZE"
220 CPPFLAGS=${CPPFLAGS-""}
222 AC_MSG_CHECKING([for IEEE-conformance compiler flags])
223 save_cflags="$CFLAGS"
226 dnl should do compile test?
227 AC_MSG_RESULT(-mieee)
228 CFLAGS="-mieee $CFLAGS"
231 AC_MSG_RESULT([none])
235 AC_SUBST(cross_compiling)
242 AC_SUBST(EXTRA_LIBES)
245 AC_DEFUN(STEPMAKE_CXX, [
248 STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
250 CPPFLAGS="$CPPFLAGS $DEFINES"
251 CXXFLAGS="$CXXFLAGS $OPTIMIZE"
252 LDFLAGS="$LDFLAGS $EXTRA_LIBES"
261 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
262 AC_CACHE_CHECK([whether explicit instantiation is needed],
263 lily_cv_need_explicit_instantiation,
264 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
265 template <class T> struct foo { static int baz; };
266 template <class T> int foo<T>::baz = 1;
267 ]], [[ return foo<int>::baz; ]])],[lily_cv_need_explicit_instantiation=no],[lily_cv_need_explicit_instantiation=yes]))
268 if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
269 AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
274 AC_DEFUN(STEPMAKE_DATADIR, [
275 if test "$datadir" = "\${prefix}/share"; then
276 datadir='${prefix}/share'
279 if test "$prefix" = "NONE"; then
280 presome=${ac_default_prefix}
283 build_package_datadir=$ugh_ugh_autoconf250_builddir/share/$package
285 DATADIR=`echo ${datadir} | sed "s!\\\${prefix}!$presome!"`
286 BUILD_PACKAGE_DATADIR=`echo ${build_package_datadir} | sed "s!\\\${prefix}!$presome!"`
289 AC_SUBST(build_package_datadir)
290 AC_DEFINE_UNQUOTED(DATADIR, ["${DATADIR}"])
291 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_DATADIR, ["${BUILD_PACKAGE_DATADIR}"])
294 ## ugh: cut & paste programming from datadir.
295 AC_DEFUN(STEPMAKE_LIBDIR, [
297 if test "$libdir" = "\${exec_prefix}/lib"; then
298 libdir='${exec_prefix}/lib'
301 build_package_libdir=$ugh_ugh_autoconf250_builddir/lib/$package
303 LIBDIR=`echo ${libdir} | sed "s!\\\${exec_prefix}!$presome!"`
304 BUILD_PACKAGE_LIBDIR=`echo ${build_package_libdir} | sed "s!\\\${exec_prefix}!$presome!"`
307 AC_SUBST(build_package_libdir)
308 AC_DEFINE_UNQUOTED(LIBDIR, ["${LIBDIR}"])
309 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_LIBDIR, ["${BUILD_PACKAGE_LIBDIR}"])
313 AC_DEFUN(STEPMAKE_END, [
317 AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in])
320 if test -n "$OPTIONAL"; then
322 echo "WARNING: Please consider installing optional programs: $OPTIONAL"
325 if test -n "$REQUIRED"; then
327 echo "ERROR: Please install required programs: $REQUIRED"
330 if test -n "$UNSUPPORTED"; then
332 echo "ERROR: Please use older version of programs: $UNSUPPORTED"
335 if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
337 echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
338 if test -f config.cache ; then
339 echo "Remove config.cache before rerunning ./configure"
343 if test -n "$REQUIRED$UNSUPPORTED"; then
344 rm -f $srcdir/GNUmakefile
348 # regular in-place build
349 # test for srcdir_build = yes ?
350 if test "$srcdir_build" = "yes"; then
351 rm -f $srcdir/GNUmakefile
352 cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
353 chmod 444 $srcdir/GNUmakefile
354 else # --srcdir build
356 cp $srcdir/make/srcdir.make.in GNUmakefile
357 chmod 444 GNUmakefile
362 AC_DEFUN(STEPMAKE_FLEX, [
363 # ugh, automake: we want (and check for) flex
365 # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
369 ac_cv_prog_lex_root=lex.yy
370 STEPMAKE_PROGS(FLEX, flex, $1)
374 AC_DEFUN(STEPMAKE_FLEXLEXER, [
375 AC_CHECK_HEADERS([FlexLexer.h],[true],[false])
376 if test $? -ne 0; then
377 warn='FlexLexer.h (flex package)'
378 STEPMAKE_ADD_ENTRY($1, $warn)
380 # check for yyFlexLexer.yy_current_buffer,
381 # in 2.5.4 <= flex < 2.5.29
383 AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
384 [stepmake_flexlexer_yy_current_buffer],
385 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
387 #include <FlexLexer.h>
388 class yy_flex_lexer: public yyFlexLexer
393 yy_current_buffer = 0;
397 [stepmake_flexlexer_yy_current_buffer=yes],
398 [stepmake_flexlexer_yy_current_buffer=no]))
399 if test $stepmake_flexlexer_yy_current_buffer = yes; then
400 AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
406 AC_DEFUN(STEPMAKE_GCC, [
407 if test "$GCC" = "yes"; then
408 STEPMAKE_CHECK_VERSION(CC, $1, $2)
410 warn="$CC (Please install *GNU* cc)"
411 STEPMAKE_ADD_ENTRY($1, $warn)
415 AC_DEFUN(STEPMAKE_GETTEXT, [
417 if test "$prefix" = "NONE"; then
418 presome=${ac_default_prefix}
420 LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
423 AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
424 # ouch. autoconf <= 2.57's gettext check fails for
425 # g++ >= 3.3 (with -std=gnu++98, the default).
426 # While the check is OK for g++ -std=c++98,
427 # LilyPond needs GNU g++, so who is to blame here?
428 # Use a workaround until this is resolved:
429 # for g++ >= 3.3, select C language.
431 STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
432 if test -n "$GCC_UNSUPPORTED"; then
433 AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
434 AC_MSG_WARN([Trying gcc, cross fingers.])
437 AC_CHECK_LIB(intl, gettext)
438 AC_CHECK_FUNCS(gettext)
439 if test -n "$GCC_UNSUPPORTED"; then
445 AC_DEFUN(STEPMAKE_GUILE, [
446 STEPMAKE_PATH_PROG(GUILE, guile, $1)
450 # STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
452 # This macro runs the guile-config script, installed with Guile,
453 # to find out where Guile's header files and libraries are
454 # installed. It sets two variables, marked for substitution, as
457 # GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
458 # code that uses Guile header files. This is almost
459 # always just a -I flag.
461 # GUILE_LDFLAGS --- flags to pass to the linker to link a
462 # program against Guile. This includes -lguile for
463 # the Guile library itself, any libraries that Guile
464 # itself requires (like -lqthreads), and so on. It may
465 # also include a -L flag to tell the compiler where to
466 # find the libraries.
468 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
469 exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
470 if test -x $exe; then
471 AC_MSG_CHECKING([guile compile flags])
472 GUILE_CFLAGS="`$guile_config compile`"
473 AC_MSG_RESULT($GUILE_CFLAGS)
474 AC_MSG_CHECKING([guile link flags])
475 GUILE_LDFLAGS="`$guile_config link`"
476 AC_MSG_RESULT($GUILE_LDFLAGS)
478 AC_SUBST(GUILE_CFLAGS)
479 AC_SUBST(GUILE_LDFLAGS)
483 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
484 ## First, let's just see if we can find Guile at all.
485 AC_MSG_CHECKING([for guile-config])
486 for guile_config in $GUILE_CONFIG guile-config $target-guile-config $build-guile-config; do
487 AC_MSG_RESULT([$guile_config])
488 if ! $guile_config --version > /dev/null 2>&1 ; then
489 AC_MSG_WARN([cannot execute $guile_config])
490 AC_MSG_CHECKING([if we are cross compiling])
491 GUILE_CONFIG='echo no guile-config'
493 GUILE_CONFIG=$guile_config
497 STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
498 if test $? -ne 0; then
499 STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
502 STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
503 # urg. should test functionality rather than version.
504 if test $? -eq 0 -a -n "$2"; then
505 STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
508 AC_SUBST(GUILE_CONFIG)
511 changequote(<<, >>)dnl
512 GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
513 GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
514 GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
517 save_CPPFLAGS="$CPPFLAGS"
519 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
520 LIBS="$GUILE_LDFLAGS $LIBS"
521 AC_CHECK_HEADERS([libguile.h])
522 AC_CHECK_LIB(guile, scm_boot_guile)
523 AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no)
524 if test "$libguile_b" = "no"; then
525 warn='libguile (libguile-dev, guile-devel or guile-dev
527 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
529 CPPFLAGS="$save_CPPFLAGS"
531 AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
532 AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
533 AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
537 AC_DEFUN(STEPMAKE_GXX, [
538 if test "$GXX" = "yes"; then
539 STEPMAKE_CHECK_VERSION(CXX, $1, $2)
541 warn="$CXX (Please install *GNU* c++)"
542 STEPMAKE_ADD_ENTRY($1, $warn)
547 AC_DEFUN(STEPMAKE_INIT, [
551 FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
552 if test x$MY_PATCH_LEVEL != x; then
553 FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
556 # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
557 changequote(<<, >>)dnl
558 PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
559 package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
562 # No versioning on directory names of sub-packages
564 stepmake=${datadir}/stepmake
566 if test "$prefix" = "NONE"; then
567 presome=${ac_default_prefix}
569 stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
571 # urg, how is this supposed to work?
572 if test "$program_prefix" = "NONE"; then
575 if test "$program_suffix" = "NONE"; then
579 AC_MSG_CHECKING(Package)
580 if test "$PACKAGE" = "STEPMAKE"; then
581 AC_MSG_RESULT(Stepmake package!)
583 AC_MSG_CHECKING(builddir)
585 ugh_ugh_autoconf250_builddir="`pwd`"
587 if test "$srcdir" = "."; then
591 package_builddir="`dirname $ugh_ugh_autoconf250_builddir`"
592 package_srcdir="`dirname $srcdir`"
594 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
596 (cd stepmake 2>/dev/null || mkdir stepmake)
597 (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
598 # only possible with autoconf < 2.50 -- hardcoded in configure.in
599 # AC_CONFIG_AUX_DIR(bin)
602 AC_MSG_RESULT($PACKAGE)
604 AC_MSG_CHECKING(builddir)
605 ugh_ugh_autoconf250_builddir="`pwd`"
606 if test "$srcdir" = "."; then
611 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
613 AC_MSG_CHECKING(for stepmake)
614 # Check for installed stepmake
615 if test -d $stepmake; then
616 AC_MSG_RESULT($stepmake)
618 stepmake="`cd $srcdir/stepmake; pwd`"
619 AC_MSG_RESULT([$srcdir/stepmake ($datadir/stepmake not found)])
622 # only possible with autoconf < 2.50 -- hardcoded in configure.in
623 # AC_CONFIG_AUX_DIR(\
625 # $srcdir/stepmake/bin\
629 AC_SUBST(ugh_ugh_autoconf250_builddir)
633 AC_SUBST(PACKAGE_NAME)
634 # We don't need the upper case variant,
635 # so stick to macros are uppercase convention.
636 # AC_DEFINE_UNQUOTED(package, ["${package}"])
637 # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
638 AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
639 AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
640 AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
642 if test -z "$package_depth"; then
645 package_depth="../$package_depth"
648 AC_SUBST(package_depth)
650 AUTOGENERATE="This file was automatically generated by configure"
651 AC_SUBST(AUTOGENERATE)
654 AC_ARG_ENABLE(config,
655 [ --enable-config=CONF put settings in config-CONF.make and config-CONF.h;
656 do \`make conf=CONF' to get output in ./out-CONF],
657 [CONFIGURATION=$enableval])
661 test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
662 CONFIGFILE=config$CONFIGSUFFIX
663 AC_SUBST(CONFIGSUFFIX)
666 STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
667 STEPMAKE_PROGS(FIND, find, REQUIRED)
669 STEPMAKE_PROGS(TAR, tar, REQUIRED)
671 if test "$(echo 2)" != "2" ||
672 test "x`uname`" = "xHP-UX"; then
673 AC_PATH_PROG(KSH, ksh, /bin/ksh)
674 AC_PATH_PROG(BASH, bash, $KSH)
675 STEPMAKE_WARN(avoiding buggy /bin/sh)
676 AC_PATH_PROG(SHELL, bash, $KSH)
679 AC_PATH_PROG(BASH, bash, $SHELL)
683 STEPMAKE_PYTHON(REQUIRED, 1.5)
685 if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
686 $MAKE -v 2> /dev/null | grep GNU > /dev/null
687 if test "$?" = 1; then
688 warn='make (Please install *GNU* make)'
689 # STEPMAKE_WARN($warn)
690 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
694 if test "$OSTYPE" = "cygwin" -o "$OSTYPE" = "cygwin32" -o "$OSTYPE" = "Windows_NT"; then
695 LN=cp # hard link does not work under cygnus-nt
696 LN_S='cp -r' # symbolic link does not work for native nt
702 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
710 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
712 AC_SUBST(program_prefix)
713 AC_SUBST(program_suffix)
718 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
719 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
729 AC_DEFUN(STEPMAKE_KPATHSEA, [
731 AC_ARG_WITH(kpathsea-include,
732 [ --with-kpathsea-include=DIR
733 location of the kpathsea include dir],[
734 if test "$withval" = "yes" -o "$withval" = "no"; then
735 AC_MSG_WARN(Usage: --with-kpathsea-include=includedir)
737 CPPFLAGS="$CPPFLAGS -I${withval}"
741 AC_ARG_WITH(kpathsea-lib,
742 [ --with-kpathsea-lib=DIR location of the kpathsea lib dir],[
743 if test "$withval" = "yes" -o "$withval" = "no"; then
744 AC_MSG_WARN(Usage: --with-kpathsea-lib=libdir)
746 LDFLAGS="$LDFLAGS -L${withval}"
751 #FIXME --with-xxx is meant for specifying a PATH too,
752 # so this should read: --enable-kpathsea,
753 # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
754 AC_ARG_WITH(kpathsea,
755 [ --with-kpathsea use kpathsea lib. Default: on],
756 [kpathsea_b=$with_kpathsea])
758 if test "$kpathsea_b" != "no"; then
759 AC_CHECK_HEADERS([kpathsea/kpathsea.h],,kpathsea_b=no)
760 AC_CHECK_LIB(kpathsea, kpse_find_file)
761 AC_CHECK_FUNCS(kpse_find_file,,kpathsea_b=no)
762 if test "$kpathsea_b" = "no"; then
763 warn='kpathsea (libkpathsea-dev, kpathsea-devel or tetex-devel
765 Else, please specify the directories where kpathsea/kpathsea.h and
766 libkpathsea.a are installed using --with-kpathsea-include and
767 --with-kpathsea-lib options. You should install kpathsea; see
768 INSTALL.txt. Rerun ./configure --without-kpathsea only if kpathsea
769 is not available for your platform.'
770 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
773 AC_MSG_CHECKING(whether to use kpathsea)
774 if test "$kpathsea_b" != no; then
783 AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
787 AC_DEFUN(STEPMAKE_LIB, [
788 STEPMAKE_PROGS(AR, ar, $1)
790 STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
794 AC_DEFUN(STEPMAKE_LIBTOOL, [
796 # **Never** try to set library version numbers so that they correspond
797 # to the release number of your package. This is an abuse that only
798 # fosters misunderstanding of the purpose of library versions.
800 REVISION=$PATCH_LEVEL
801 # CURRENT=$MINOR_VERSION
802 CURRENT=`expr $MINOR_VERSION + 1`
803 # AGE=`expr $MAJOR_VERSION + 1`
811 AC_DEFUN(STEPMAKE_LOCALE, [
816 AC_ARG_WITH(localedir,
817 [ --with-localedir=LOCALE use LOCALE as locale dir. Default:
818 PREFIX/share/locale ],
819 localedir=$with_localedir,
820 localedir='${prefix}/share/locale')
823 [ --with-lang=LANG use LANG as language to emit messages],
827 AC_MSG_CHECKING(language)
829 En* | en* | Am* | am* | US* | us*)
831 NL | nl | Du* | du* | Ned* | ned*)
840 if test "$lang" = "unknown" ; then
841 STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
847 AC_DEFUN(STEPMAKE_MAKEINFO, [
848 STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
849 if test "$MAKEINFO" = "makeinfo"; then
850 AC_MSG_CHECKING(whether makeinfo can split html by @node)
852 makeinfo --html --output=out/split <<EOF
854 \input texinfo @c -*-texinfo-*-
855 @setfilename split.info
859 if test -d out/split; then
860 SPLITTING_MAKEINFO=yes
865 STEPMAKE_WARN(your html documentation will be one large file)
869 AC_SUBST(SPLITTING_MAKEINFO)
874 AC_DEFUN(STEPMAKE_MAN, [
875 STEPMAKE_PROGS(GROFF, groff ditroff, $1)
877 STEPMAKE_PROGS(TROFF, troff, $1)
879 STEPMAKE_PROGS(TBL, tbl, $1)
884 AC_DEFUN(STEPMAKE_MSGFMT, [
885 STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
889 # Check for program ($2), set full path result to ($1).
890 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
891 AC_DEFUN(STEPMAKE_PATH_PROG, [
892 AC_CHECK_PROGS($1, $2, no)
893 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
894 if test $? -eq 0; then
896 if test -n "$4"; then
897 STEPMAKE_CHECK_VERSION($1, $3, $4)
903 # Check for program in set of names ($2), set result to ($1) .
904 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
905 # If exists, and a minimal version ($4) is required
906 AC_DEFUN(STEPMAKE_PROGS, [
907 AC_CHECK_PROGS($1, $2, no)
908 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
909 if test $? -eq 0 -a -n "$4"; then
910 STEPMAKE_CHECK_VERSION($1, $3, $4)
915 AC_DEFUN(STEPMAKE_PERL, [
916 STEPMAKE_PATH_PROG(PERL, perl, $1)
920 AC_DEFUN(STEPMAKE_PYTHON, [
922 AC_MSG_CHECKING([for python])
923 for python in $PYTHON python python2 python2.3 python2.2 python2.1 python2.0; do
924 AC_MSG_RESULT([$python])
925 if ! $python -V > /dev/null 2>&1 ; then
926 #AC_MSG_WARN([cannot execute $python])
927 PYTHON='echo no python'
930 STEPMAKE_CHECK_VERSION(python, pv, $2)
931 if test -z "$pv"; then
937 if test -n "$pv"; then
938 STEPMAKE_ADD_ENTRY($1, $pv)
940 AC_PATH_PROG(PYTHON, $PYTHON)
944 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
945 unset PYTHON_HEADER PYTHON_INCLUDE
946 if test -n "$PYTHON"; then
947 changequote(<<, >>)dnl
948 # alternatively, for python >= 2.0
949 # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
950 PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
954 ##AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
955 if test -z "$PYTHON_HEADER"; then
956 #URG -- how to extend include path?
957 ac_compile="$ac_compile -I$PYTHON_INCLUDE"
958 ac_cpp="$ac_cpp -I$PYTHON_INCLUDE"
959 CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDE"
960 AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
963 if test -z "$PYTHON_HEADER"; then
964 warn="$PYTHON_INCLUDE/Python.h (python-devel, python-dev or libpython-dev package)"
965 STEPMAKE_ADD_ENTRY($1, $warn)
970 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
971 AC_ARG_ENABLE(tfm-path,
972 [ --enable-tfm-path=PATH set path of tex directories where tfm files live,
973 esp.: cmr10.tfm. Default: use kpsewhich],
974 [tfm_path=$enableval],
978 STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
979 AC_MSG_CHECKING(for tfm path)
983 if test "x$tfm_path" = xauto ; then
984 if test "x$KPSEWHICH" != "xno" ; then
985 for i in $TFM_FONTS; do
986 dir=`$KPSEWHICH tfm ${i}10.tfm`
987 TFM_PATH="$TFM_PATH `dirname $dir`"
990 STEPMAKE_WARN(Please specify where cmr10.tfm lives:
991 ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts)
997 TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
998 AC_MSG_RESULT($TFM_PATH)
1003 AC_DEFUN(STEPMAKE_TEXMF, [
1004 # urg, never know what names these teTeX guys will think up
1006 STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
1007 STEPMAKE_PROGS(INIMETAFONT, inimf inimfont, $1)
1009 AC_MSG_CHECKING(for working metafont mode)
1010 modelist='ljfour lj4 lj3 lj2 ljet laserjet'
1011 for MFMODE in $modelist; do
1012 $METAFONT "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
1013 if test -f mfput.tfm; then
1017 AC_MSG_RESULT($MFMODE)
1025 AC_DEFUN(STEPMAKE_WARN, [
1031 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1032 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1033 dnl also defines GSTUFF_PKG_ERRORS on error
1034 AC_DEFUN(PKG_CHECK_MODULES, [
1037 if test -z "$PKG_CONFIG"; then
1038 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1041 if test "$PKG_CONFIG" = "no" ; then
1042 echo "*** The pkg-config script could not be found. Make sure it is"
1043 echo "*** in your path, or set the PKG_CONFIG environment variable"
1044 echo "*** to the full path to pkg-config."
1045 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1047 PKG_CONFIG_MIN_VERSION=0.9.0
1048 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1049 AC_MSG_CHECKING(for $2)
1051 if $PKG_CONFIG --exists "$2" ; then
1055 AC_MSG_CHECKING($1_CFLAGS)
1056 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1057 AC_MSG_RESULT($$1_CFLAGS)
1059 AC_MSG_CHECKING($1_LIBS)
1060 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1061 AC_MSG_RESULT($$1_LIBS)
1065 ## If we have a custom action on failure, don't print errors, but
1066 ## do set a variable so people can do so.
1067 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1068 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1074 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1075 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1079 if test $succeeded = yes; then
1080 ifelse([$3], , :, [$3])
1082 ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
1087 AC_DEFUN(STEPMAKE_FREETYPE2, [
1088 PKG_CHECK_MODULES(FREETYPE2, freetype2 >= 0, have_freetype2=true, true)
1089 if $have_freetype2 ; then
1090 AC_DEFINE(HAVE_FREETYPE2)
1091 AC_SUBST(FREETYPE2_CFLAGS)
1092 AC_SUBST(FREETYPE2_LIBS)
1096 AC_DEFUN(STEPMAKE_GTK2, [
1097 PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.4.0, have_gtk2=true, true)
1098 if $have_gtk2 ; then
1099 AC_DEFINE(HAVE_GTK2)
1100 AC_SUBST(GTK2_CFLAGS)
1105 AC_DEFUN(STEPMAKE_PANGO, [
1106 PKG_CHECK_MODULES(PANGO, pango >= 1.5.0, have_pango_cvs=true, true)
1107 if $have_pango_cvs ; then
1108 AC_DEFINE(HAVE_PANGO_CVS)
1109 PANGO_CFLAGS="$PANGO_CFLAGS $GTK2_CFLAGS"
1110 PANGO_LIBS="$PANGO_LIBS $GTK2_LIBS"
1111 CPPFLAGS="$PANGO_CFLAGS $CPPFLAGS"
1112 LIBS="$PANGO_LIBS $LIBS"
1113 AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1114 AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1115 AC_SUBST(PANGO_CFLAGS)
1116 AC_SUBST(PANGO_LIBS)