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 changequote(<<, >>)dnl
30 ## Assume and hunt for dotted version multiplet.
31 ## use eval trickery, because we cannot use multi-level $() instead of ``
32 ## for compatibility reasons.
33 ## FIXME: what systems still do not have $() in /bin/sh?
34 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' \
36 | sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \
37 -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
38 if test -z "$_ver"; then
39 ## If empty, try date [fontforge]
40 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \
42 | sed -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
49 # Calculate simplistic numeric version from version string ($1)
50 # As yet, we have no need for something more elaborate.
51 AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [
54 if ([$]3) {three = [$]3}
57 {printf "%.0f\n", [$]1*1000000 + [$]2*1000 + three}'
61 # Add item ($2) to list ($1, one of 'OPTIONAL', 'REQUIRED')
62 AC_DEFUN(STEPMAKE_ADD_ENTRY, [
63 eval "$1"=\"`eval echo \"'$'$1\" \"$2\"`\"
66 # Check if tested program ($2) was found ($1).
67 # If not, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED').
68 # We could abort here if a 'REQUIRED' program is not found
69 AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [
70 STEPMAKE_CHECK_SEARCH_RESULT($1)
71 if test $? -ne 0; then
72 STEPMAKE_ADD_ENTRY($3, $2)
73 if test "$3" = "REQUIRED"; then
74 command="echo ERROR: $2 not found"
75 # abort configure process here?
77 command="- echo $2 not found"
87 # Return if tested proram ($1) was found (true) or not (false).
88 AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [
89 r="`eval echo '$'"$1"`"
90 if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
93 ##STEPMAKE_WARN(cannot find $2. $3)
99 # Check version of program ($1)
100 # If version ($4: optional argument, supply if version cannot be
101 # parsed using --version or -V ) is smaller than requested ($3), add
102 # entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED').
103 AC_DEFUN(STEPMAKE_CHECK_VERSION, [
104 r="`eval echo '$'"$1"`"
105 AC_MSG_CHECKING([$r version])
106 exe=`STEPMAKE_GET_EXECUTABLE($r)`
107 if test -n "$4"; then
110 ver=`STEPMAKE_GET_VERSION($exe)`
112 num=`STEPMAKE_NUMERIC_VERSION($ver)`
113 req=`STEPMAKE_NUMERIC_VERSION($3)`
114 AC_MSG_RESULT([$ver])
115 if test "$num" -lt "$req"; then
116 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
118 vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION"
119 eval `echo $vervar=$num`
120 ## AC_SUBST(`eval echo $vervar`)
123 # Check version of program ($1)
124 # If version is greater than or equals unsupported ($3),
125 # add entry to unsupported list ($2, 'UNSUPPORTED')
126 AC_DEFUN(STEPMAKE_CHECK_VERSION_UNSUPPORTED, [
127 r="`eval echo '$'"$1"`"
128 AC_MSG_CHECKING([$r version])
129 exe=`STEPMAKE_GET_EXECUTABLE($r)`
130 ver=`STEPMAKE_GET_VERSION($exe)`
131 num=`STEPMAKE_NUMERIC_VERSION($ver)`
132 sup=`STEPMAKE_NUMERIC_VERSION($3)`
133 AC_MSG_RESULT([$ver])
134 if test "$num" -ge "$sup"; then
135 STEPMAKE_ADD_ENTRY($2, ["$r < $3 (installed: $ver)"])
139 ### Macros to build configure.in
142 AC_DEFUN(STEPMAKE_BIBTEX2HTML, [
143 STEPMAKE_PROGS(BIBTEX2HTML, bibtex2html bib2html, $1)
144 if test "$BIBTEX2HTML" = "bib2html"; then
145 BIBTEX2HTML_FLAGS='$< $(@)'
147 BIBTEX2HTML_FLAGS='-o $(@D)/$(*F) $<'
149 AC_SUBST(BIBTEX2HTML)
150 AC_SUBST(BIBTEX2HTML_FLAGS)
154 AC_DEFUN(STEPMAKE_BISON, [
155 # ugh, automake: we want (and check for) bison
158 STEPMAKE_PROGS(BISON, bison, $1)
160 # urg. should test functionality rather than version.
161 if test "$BISON" = "bison" -a -n "$2"; then
162 STEPMAKE_CHECK_VERSION(BISON, $1, $2)
167 AC_DEFUN(STEPMAKE_COMPILE, [
168 # -O is necessary to get inlining
170 CXXFLAGS=${CXXFLAGS-$CFLAGS}
171 LDFLAGS=${LDFLAGS-""}
177 AC_ARG_ENABLE(debugging,
178 [ --enable-debugging compile with debugging info. Default: on],
179 [debug_b=$enableval])
181 AC_ARG_ENABLE(optimising,
182 [ --enable-optimising compile with optimising. Default: on],
183 [optimise_b=$enableval])
185 AC_ARG_ENABLE(profiling,
186 [ --enable-profiling compile with gprof support. Default: off],
187 [profile_b=$enableval])
190 [ --enable-pipe compile with -pipe. Default: on],
193 if test "$optimise_b" = yes; then
195 DEFINES="$DEFINES -DNDEBUG"
196 OPTIMIZE="-O2 -finline-functions"
199 if test $profile_b = yes; then
201 OPTIMIZE="$OPTIMIZE -pg"
204 if test $debug_b = yes; then
205 OPTIMIZE="$OPTIMIZE -g"
209 STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
213 # If -pipe requested, test if it works and add to CFLAGS.
214 if test "$pipe_b" = yes; then
215 save_cflags="$CFLAGS"
216 CFLAGS="-pipe $CFLAGS";
217 AC_CACHE_CHECK([whether compiler understands -pipe],
218 [stepmake_cflags_pipe],
219 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])],
220 [stepmake_cflags_pipe=yes],
221 [stepmake_cflags_pipe=no]))
223 if test $stepmake_cflags_pipe = yes; then
224 OPTIMIZE="$OPTIMIZE -pipe"
228 CFLAGS="$CFLAGS $OPTIMIZE"
229 CPPFLAGS=${CPPFLAGS-""}
231 AC_MSG_CHECKING([for IEEE-conformance compiler flags])
232 save_cflags="$CFLAGS"
235 dnl should do compile test?
236 AC_MSG_RESULT(-mieee)
237 CFLAGS="-mieee $CFLAGS"
240 AC_MSG_RESULT([none])
244 AC_SUBST(cross_compiling)
251 AC_SUBST(EXTRA_LIBES)
254 AC_DEFUN(STEPMAKE_CXX, [
257 STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
259 CPPFLAGS="$CPPFLAGS $DEFINES"
260 CXXFLAGS="$CXXFLAGS $OPTIMIZE"
261 LDFLAGS="$LDFLAGS $EXTRA_LIBES"
270 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
271 AC_CACHE_CHECK([whether explicit instantiation is needed],
272 lily_cv_need_explicit_instantiation,
273 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
274 template <class T> struct foo { static int baz; };
275 template <class T> int foo<T>::baz = 1;
276 ]], [[ return foo<int>::baz; ]])],[lily_cv_need_explicit_instantiation=no],[lily_cv_need_explicit_instantiation=yes]))
277 if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
278 AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
283 AC_DEFUN(STEPMAKE_DATADIR, [
284 if test "$datadir" = "\${prefix}/share"; then
285 datadir='${prefix}/share'
288 if test "$prefix" = "NONE"; then
289 presome=${ac_default_prefix}
292 build_package_datadir=$ugh_ugh_autoconf250_builddir/share/$package
294 DATADIR=`echo ${datadir} | sed "s!\\\${prefix}!$presome!"`
295 BUILD_PACKAGE_DATADIR=`echo ${build_package_datadir} | sed "s!\\\${prefix}!$presome!"`
298 AC_SUBST(build_package_datadir)
299 AC_DEFINE_UNQUOTED(DATADIR, ["${DATADIR}"])
300 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_DATADIR, ["${BUILD_PACKAGE_DATADIR}"])
303 ## ugh: cut & paste programming from datadir.
304 AC_DEFUN(STEPMAKE_LIBDIR, [
306 if test "$libdir" = "\${exec_prefix}/lib"; then
307 libdir='${exec_prefix}/lib'
310 build_package_libdir=$ugh_ugh_autoconf250_builddir/lib/$package
312 LIBDIR=`echo ${libdir} | sed "s!\\\${exec_prefix}!$presome!"`
313 BUILD_PACKAGE_LIBDIR=`echo ${build_package_libdir} | sed "s!\\\${exec_prefix}!$presome!"`
316 AC_SUBST(build_package_libdir)
317 AC_DEFINE_UNQUOTED(LIBDIR, ["${LIBDIR}"])
318 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_LIBDIR, ["${BUILD_PACKAGE_LIBDIR}"])
322 AC_DEFUN(STEPMAKE_END, [
326 AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in])
329 if test -n "$OPTIONAL"; then
331 echo "WARNING: Please consider installing optional programs: $OPTIONAL"
334 if test -n "$REQUIRED"; then
336 echo "ERROR: Please install required programs: $REQUIRED"
339 if test -n "$UNSUPPORTED"; then
341 echo "ERROR: Please use older version of programs: $UNSUPPORTED"
344 if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
346 echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
347 if test -f config.cache ; then
348 echo "Remove config.cache before rerunning ./configure"
352 if test -n "$REQUIRED$UNSUPPORTED"; then
353 rm -f $srcdir/GNUmakefile
357 # regular in-place build
358 # test for srcdir_build = yes ?
359 if test "$srcdir_build" = "yes"; then
360 rm -f $srcdir/GNUmakefile
361 cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
362 chmod 444 $srcdir/GNUmakefile
363 else # --srcdir build
365 cp $srcdir/make/srcdir.make.in GNUmakefile
366 chmod 444 GNUmakefile
371 AC_DEFUN(STEPMAKE_FLEX, [
372 # ugh, automake: we want (and check for) flex
374 # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
378 ac_cv_prog_lex_root=lex.yy
379 STEPMAKE_PROGS(FLEX, flex, $1)
383 AC_DEFUN(STEPMAKE_FLEXLEXER, [
384 AC_CHECK_HEADERS([FlexLexer.h],[true],[false])
385 if test $? -ne 0; then
386 warn='FlexLexer.h (flex package)'
387 STEPMAKE_ADD_ENTRY($1, $warn)
389 # check for yyFlexLexer.yy_current_buffer,
390 # in 2.5.4 <= flex < 2.5.29
392 AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
393 [stepmake_flexlexer_yy_current_buffer],
394 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
396 #include <FlexLexer.h>
397 class yy_flex_lexer: public yyFlexLexer
402 yy_current_buffer = 0;
406 [stepmake_flexlexer_yy_current_buffer=yes],
407 [stepmake_flexlexer_yy_current_buffer=no]))
408 if test $stepmake_flexlexer_yy_current_buffer = yes; then
409 AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
415 AC_DEFUN(STEPMAKE_GCC, [
416 if test "$GCC" = "yes"; then
417 STEPMAKE_CHECK_VERSION(CC, $1, $2)
419 warn="$CC (Please install *GNU* cc)"
420 STEPMAKE_ADD_ENTRY($1, $warn)
424 AC_DEFUN(STEPMAKE_GETTEXT, [
426 if test "$prefix" = "NONE"; then
427 presome=${ac_default_prefix}
429 LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
432 AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
433 # ouch. autoconf <= 2.57's gettext check fails for
434 # g++ >= 3.3 (with -std=gnu++98, the default).
435 # While the check is OK for g++ -std=c++98,
436 # LilyPond needs GNU g++, so who is to blame here?
437 # Use a workaround until this is resolved:
438 # for g++ >= 3.3, select C language.
440 STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
441 if test -n "$GCC_UNSUPPORTED"; then
442 AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
443 AC_MSG_WARN([Trying gcc, cross fingers.])
446 AC_CHECK_LIB(intl, gettext)
447 AC_CHECK_FUNCS(gettext)
448 if test -n "$GCC_UNSUPPORTED"; then
454 AC_DEFUN(STEPMAKE_GUILE, [
455 STEPMAKE_PATH_PROG(GUILE, guile, $1)
459 # STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
461 # This macro runs the guile-config script, installed with Guile,
462 # to find out where Guile's header files and libraries are
463 # installed. It sets two variables, marked for substitution, as
466 # GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
467 # code that uses Guile header files. This is almost
468 # always just a -I flag.
470 # GUILE_LDFLAGS --- flags to pass to the linker to link a
471 # program against Guile. This includes -lguile for
472 # the Guile library itself, any libraries that Guile
473 # itself requires (like -lqthreads), and so on. It may
474 # also include a -L flag to tell the compiler where to
475 # find the libraries.
477 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
478 exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
479 if test -x $exe; then
480 AC_MSG_CHECKING([guile compile flags])
481 GUILE_CFLAGS="`$guile_config compile`"
482 AC_MSG_RESULT($GUILE_CFLAGS)
483 AC_MSG_CHECKING([guile link flags])
484 GUILE_LDFLAGS="`$guile_config link`"
485 AC_MSG_RESULT($GUILE_LDFLAGS)
487 AC_SUBST(GUILE_CFLAGS)
488 AC_SUBST(GUILE_LDFLAGS)
492 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
493 ## First, let's just see if we can find Guile at all.
494 test -n "$target_alias" && target_guile_config=$target_alias-guile-config
495 test -n "$host_alias" && host_guile_config=$host_alias-guile-config
496 AC_MSG_CHECKING([for guile-config])
497 for guile_config in $GUILE_CONFIG $target_guile_config $host_guile_config $build_guile_config guile-config; do
498 AC_MSG_RESULT([$guile_config])
499 if ! $guile_config --version > /dev/null 2>&1 ; then
500 AC_MSG_WARN([cannot execute $guile_config])
501 AC_MSG_CHECKING([if we are cross compiling])
502 GUILE_CONFIG='echo no guile-config'
504 GUILE_CONFIG=$guile_config
508 STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
509 if test $? -ne 0; then
510 STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
513 STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
514 # urg. should test functionality rather than version.
515 if test $? -eq 0 -a -n "$2"; then
516 STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
519 AC_SUBST(GUILE_CONFIG)
522 changequote(<<, >>)dnl
523 GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
524 GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
525 GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
528 save_CPPFLAGS="$CPPFLAGS"
530 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
531 LIBS="$GUILE_LDFLAGS $LIBS"
532 AC_CHECK_HEADERS([libguile.h])
533 AC_CHECK_LIB(guile, scm_boot_guile)
534 AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no)
535 if test "$libguile_b" = "no"; then
536 warn='libguile (libguile-dev, guile-devel or guile-dev
538 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
540 CPPFLAGS="$save_CPPFLAGS"
542 AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
543 AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
544 AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
548 AC_DEFUN(STEPMAKE_DLOPEN, [
549 AC_CHECK_LIB(dl, dlopen)
550 AC_CHECK_FUNCS(dlopen)
553 AC_DEFUN(STEPMAKE_GXX, [
554 if test "$GXX" = "yes"; then
555 STEPMAKE_CHECK_VERSION(CXX, $1, $2)
557 warn="$CXX (Please install *GNU* c++)"
558 STEPMAKE_ADD_ENTRY($1, $warn)
563 AC_DEFUN(STEPMAKE_INIT, [
567 FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
568 if test x$MY_PATCH_LEVEL != x; then
569 FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
571 export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL
572 # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
573 changequote(<<, >>)dnl
574 PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
575 package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
578 # No versioning on directory names of sub-packages
580 stepmake=${datadir}/stepmake
582 if test "$prefix" = "NONE"; then
583 presome=${ac_default_prefix}
585 stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
587 # urg, how is this supposed to work?
588 if test "$program_prefix" = "NONE"; then
591 if test "$program_suffix" = "NONE"; then
595 AC_MSG_CHECKING(Package)
596 if test "$PACKAGE" = "STEPMAKE"; then
597 AC_MSG_RESULT(Stepmake package!)
599 AC_MSG_CHECKING(builddir)
601 ugh_ugh_autoconf250_builddir="`pwd`"
603 if test "$srcdir" = "."; then
607 package_builddir="`dirname $ugh_ugh_autoconf250_builddir`"
608 package_srcdir="`dirname $srcdir`"
610 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
612 (cd stepmake 2>/dev/null || mkdir stepmake)
613 (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
614 # only possible with autoconf < 2.50 -- hardcoded in configure.in
615 # AC_CONFIG_AUX_DIR(bin)
618 AC_MSG_RESULT($PACKAGE)
620 AC_MSG_CHECKING(builddir)
621 ugh_ugh_autoconf250_builddir="`pwd`"
622 if test "$srcdir" = "."; then
627 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
629 AC_MSG_CHECKING(for stepmake)
630 # Check for installed stepmake
631 if test -d $stepmake; then
632 AC_MSG_RESULT($stepmake)
634 stepmake="`cd $srcdir/stepmake; pwd`"
635 AC_MSG_RESULT([$srcdir/stepmake ($datadir/stepmake not found)])
638 # only possible with autoconf < 2.50 -- hardcoded in configure.in
639 # AC_CONFIG_AUX_DIR(\
641 # $srcdir/stepmake/bin\
645 AC_SUBST(ugh_ugh_autoconf250_builddir)
649 AC_SUBST(PACKAGE_NAME)
650 AC_SUBST(MAJOR_VERSION)
651 AC_SUBST(MINOR_VERSION)
653 # We don't need the upper case variant,
654 # so stick to macros are uppercase convention.
655 # AC_DEFINE_UNQUOTED(package, ["${package}"])
656 # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
657 AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
658 AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
659 AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
661 if test -z "$package_depth"; then
664 package_depth="../$package_depth"
667 AC_SUBST(package_depth)
669 AUTOGENERATE="This file was automatically generated by configure"
670 AC_SUBST(AUTOGENERATE)
673 AC_ARG_ENABLE(config,
674 [ --enable-config=CONF put settings in config-CONF.make and config-CONF.h;
675 do \`make conf=CONF' to get output in ./out-CONF],
676 [CONFIGURATION=$enableval])
680 test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
681 CONFIGFILE=config$CONFIGSUFFIX
682 AC_SUBST(CONFIGSUFFIX)
685 STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
686 STEPMAKE_PROGS(FIND, find, REQUIRED)
688 STEPMAKE_PROGS(TAR, tar, REQUIRED)
690 if test "$(echo 2)" != "2" ||
691 test "x`uname`" = "xHP-UX"; then
692 AC_PATH_PROG(KSH, ksh, /bin/ksh)
693 AC_PATH_PROG(BASH, bash, $KSH)
694 STEPMAKE_WARN(avoiding buggy /bin/sh)
695 AC_PATH_PROG(SHELL, bash, $KSH)
698 AC_PATH_PROG(BASH, bash, $SHELL)
702 STEPMAKE_PYTHON(REQUIRED, 1.5)
704 if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
705 $MAKE -v 2> /dev/null | grep GNU > /dev/null
706 if test "$?" = 1; then
707 warn='make (Please install *GNU* make)'
708 # STEPMAKE_WARN($warn)
709 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
713 if test "$OSTYPE" = "cygwin" -o "$OSTYPE" = "cygwin32" -o "$OSTYPE" = "Windows_NT"; then
714 LN=cp # hard link does not work under cygnus-nt
715 LN_S='cp -r' # symbolic link does not work for native nt
721 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
729 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-sh -c"
731 AC_SUBST(program_prefix)
732 AC_SUBST(program_suffix)
737 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
738 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
748 AC_DEFUN(STEPMAKE_KPATHSEA, [
750 AC_ARG_WITH(kpathsea-include,
751 [ --with-kpathsea-include=DIR
752 location of the kpathsea include dir],[
753 if test "$withval" = "yes" -o "$withval" = "no"; then
754 AC_MSG_WARN(Usage: --with-kpathsea-include=includedir)
756 CPPFLAGS="$CPPFLAGS -I${withval}"
760 AC_ARG_WITH(kpathsea-lib,
761 [ --with-kpathsea-lib=DIR location of the kpathsea lib dir],[
762 if test "$withval" = "yes" -o "$withval" = "no"; then
763 AC_MSG_WARN(Usage: --with-kpathsea-lib=libdir)
765 LDFLAGS="$LDFLAGS -L${withval}"
770 #FIXME --with-xxx is meant for specifying a PATH too,
771 # so this should read: --enable-kpathsea,
772 # or --with-kpathsea-include=PATH --with-kpathsea-lib=PATH
773 AC_ARG_WITH(kpathsea,
774 [ --with-kpathsea use kpathsea lib. Default: on],
775 [kpathsea_b=$with_kpathsea])
778 if test "$kpathsea_b" != "no"; then
779 AC_CHECK_HEADERS([kpathsea/kpathsea.h],,kpathsea_b=no)
780 AC_CHECK_LIB(kpathsea, kpse_find_file)
781 AC_CHECK_FUNCS(kpse_find_file,,kpathsea_b=no)
782 if test "$kpathsea_b" = "no"; then
783 warn='kpathsea (libkpathsea-dev, kpathsea-devel or tetex-devel
785 Else, please specify the directories where kpathsea/kpathsea.h and
786 libkpathsea.a are installed using --with-kpathsea-include and
787 --with-kpathsea-lib options. You should install kpathsea; see
788 INSTALL.txt. Rerun ./configure --without-kpathsea only if kpathsea
789 is not available for your platform.'
790 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
794 save_CFLAGS="$CFLAGS"
795 CFLAGS=$(echo "-shared $CFLAGS" | sed -e 's/ -g//')
796 AC_MSG_CHECKING([for shared libkpathsea])
797 AC_TRY_LINK([#include <kpathsea/kpathsea.h>],
798 [kpse_var_expand ("\$TEXMF");],
799 [have_libkpathsea_so=maybe;
800 shared_size=`wc -c conftest`;
801 shared_size=`echo $shared_size | sed -e 's/ .*//g'`],
802 [have_libkpathsea_so=no])
804 if test "$have_libkpathsea_so" = "maybe"; then
805 if test $shared_size -lt 40000 ; then
806 have_libkpathsea_so=yes
808 have_libkpathsea_so=no
812 AC_MSG_RESULT($have_libkpathsea_so)
813 if test "$have_libkpathsea_so" = "yes"; then
814 AC_DEFINE(HAVE_LIBKPATHSEA_SO)
816 CFLAGS="$save_CFLAGS"
818 KPATHSEA_LIBS="$LIBS"
820 AC_MSG_CHECKING(whether to use kpathsea)
821 if test "$kpathsea_b" != no; then
830 AC_SUBST(KPATHSEA_LIBS)
831 AC_SUBST(HAVE_LIBKPATHSEA_SO, $have_libkpathsea_so)
832 AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
836 AC_DEFUN(STEPMAKE_LIB, [
837 STEPMAKE_PROGS(AR, ar, $1)
839 STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
843 AC_DEFUN(STEPMAKE_LIBTOOL, [
845 # **Never** try to set library version numbers so that they correspond
846 # to the release number of your package. This is an abuse that only
847 # fosters misunderstanding of the purpose of library versions.
849 REVISION=$PATCH_LEVEL
850 # CURRENT=$MINOR_VERSION
851 CURRENT=`expr $MINOR_VERSION + 1`
852 # AGE=`expr $MAJOR_VERSION + 1`
860 AC_DEFUN(STEPMAKE_LOCALE, [
865 AC_ARG_WITH(localedir,
866 [ --with-localedir=LOCALE use LOCALE as locale dir. Default:
867 PREFIX/share/locale ],
868 localedir=$with_localedir,
869 localedir='${prefix}/share/locale')
872 [ --with-lang=LANG use LANG as language to emit messages],
876 AC_MSG_CHECKING(language)
878 En* | en* | Am* | am* | US* | us*)
880 NL | nl | Du* | du* | Ned* | ned*)
889 if test "$lang" = "unknown" ; then
890 STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
896 AC_DEFUN(STEPMAKE_MAKEINFO, [
897 STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
901 AC_DEFUN(STEPMAKE_MAN, [
902 STEPMAKE_PROGS(GROFF, groff ditroff, $1)
904 STEPMAKE_PROGS(TROFF, troff, $1)
906 STEPMAKE_PROGS(TBL, tbl, $1)
911 AC_DEFUN(STEPMAKE_MSGFMT, [
912 STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
916 # Check for program ($2), set full path result to ($1).
917 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
918 AC_DEFUN(STEPMAKE_PATH_PROG, [
919 AC_CHECK_PROGS($1, $2, no)
920 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
921 if test $? -eq 0; then
923 if test -n "$4"; then
924 STEPMAKE_CHECK_VERSION($1, $3, $4)
930 # Check for program in set of names ($2), set result to ($1) .
931 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
932 # If exists, and a minimal version ($4) is required
933 AC_DEFUN(STEPMAKE_PROGS, [
934 AC_CHECK_PROGS($1, $2, no)
935 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
936 if test $? -eq 0 -a -n "$4"; then
937 STEPMAKE_CHECK_VERSION($1, $3, $4)
942 AC_DEFUN(STEPMAKE_PERL, [
943 STEPMAKE_PATH_PROG(PERL, perl, $1)
947 AC_DEFUN(STEPMAKE_PYTHON, [
949 AC_MSG_CHECKING([for python])
950 for python in $PYTHON python python2 python2.3 python2.2 python2.1 python2.0; do
951 AC_MSG_RESULT([$python])
952 if ! $python -V > /dev/null 2>&1 ; then
953 #AC_MSG_WARN([cannot execute $python])
954 PYTHON='echo no python'
957 STEPMAKE_CHECK_VERSION(python, pv, $2)
958 if test -z "$pv"; then
964 if test -n "$pv"; then
965 STEPMAKE_ADD_ENTRY($1, $pv)
967 AC_PATH_PROG(PYTHON, $PYTHON)
971 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
972 unset PYTHON_HEADER PYTHON_INCLUDE
973 if test -n "$PYTHON"; then
974 changequote(<<, >>)dnl
975 # alternatively, for python >= 2.0
976 # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
977 PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
981 ##AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
982 if test -z "$PYTHON_HEADER"; then
983 #URG -- how to extend include path?
984 ac_compile="$ac_compile -I$PYTHON_INCLUDE"
985 ac_cpp="$ac_cpp -I$PYTHON_INCLUDE"
986 CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDE"
987 AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
990 if test -z "$PYTHON_HEADER"; then
991 warn="$PYTHON_INCLUDE/Python.h (python-devel, python-dev or libpython-dev package)"
992 STEPMAKE_ADD_ENTRY($1, $warn)
998 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
1001 STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
1006 AC_DEFUN(STEPMAKE_TEXMF, [
1007 STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
1008 # STEPMAKE_PROGS(INIMETAFONT, inimf inimfont "$METAFONT -ini", $1)
1010 AC_MSG_CHECKING(for working metafont mode)
1011 modelist='ljfour lj4 lj3 lj2 ljet laserjet'
1012 for MFMODE in $modelist; do
1013 $METAFONT -progname=mf "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
1014 if test -f mfput.tfm; then
1018 AC_MSG_RESULT($MFMODE)
1026 AC_DEFUN(STEPMAKE_WARN, [
1032 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1033 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1034 dnl also defines GSTUFF_PKG_ERRORS on error
1035 AC_DEFUN(PKG_CHECK_MODULES, [
1038 if test -z "$PKG_CONFIG"; then
1039 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1042 if test "$PKG_CONFIG" = "no" ; then
1043 echo "*** The pkg-config script could not be found. Make sure it is"
1044 echo "*** in your path, or set the PKG_CONFIG environment variable"
1045 echo "*** to the full path to pkg-config."
1046 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1048 PKG_CONFIG_MIN_VERSION=0.9.0
1049 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1050 AC_MSG_CHECKING(for $2)
1052 if $PKG_CONFIG --exists "$2" ; then
1056 AC_MSG_CHECKING($1_CFLAGS)
1057 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1058 AC_MSG_RESULT($$1_CFLAGS)
1060 AC_MSG_CHECKING($1_LIBS)
1061 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1062 AC_MSG_RESULT($$1_LIBS)
1066 ## If we have a custom action on failure, don't print errors, but
1067 ## do set a variable so people can do so.
1068 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1069 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1077 if test $succeeded = yes; then
1078 ifelse([$3], , :, [$3])
1080 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])
1084 AC_DEFUN(STEPMAKE_FREETYPE2, [
1085 PKG_CHECK_MODULES(FREETYPE2, $1 >= $3, have_freetype2=yes, true)
1086 if test "$have_freetype2" = yes; then
1087 AC_DEFINE(HAVE_FREETYPE2)
1088 AC_SUBST(FREETYPE2_CFLAGS)
1089 AC_SUBST(FREETYPE2_LIBS)
1091 r="lib$1-dev or $1-devel"
1092 ver="$(pkg-config --modversion $1)"
1093 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1097 AC_DEFUN(STEPMAKE_GTK2, [
1098 PKG_CHECK_MODULES(GTK2, $1 >= $3, have_gtk2=yes, true)
1099 if test "$have_gtk2" = yes ; then
1100 AC_DEFINE(HAVE_GTK2)
1101 AC_SUBST(GTK2_CFLAGS)
1104 r="lib$1-dev or $1-devel"
1105 ver="$(pkg-config --modversion $1)"
1106 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1110 AC_DEFUN(STEPMAKE_PANGO, [
1111 PKG_CHECK_MODULES(PANGO, $1 >= $3, have_pango16=yes, true)
1112 if test "$have_pango16" = yes ; then
1113 AC_DEFINE(HAVE_PANGO16)
1114 PANGO_CFLAGS="$PANGO_CFLAGS $GTK2_CFLAGS"
1115 PANGO_LIBS="$PANGO_LIBS $GTK2_LIBS"
1116 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1117 save_CPPFLAGS="$CPPFLAGS"
1119 AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1120 AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1121 AC_SUBST(PANGO_CFLAGS)
1122 AC_SUBST(PANGO_LIBS)
1123 CPPFLAGS="$save_CPPFLAGS"
1126 r="lib$1-dev or $1-devel"
1127 ver="$(pkg-config --modversion $1)"
1128 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1132 AC_DEFUN(STEPMAKE_PANGO_FT2, [
1133 PKG_CHECK_MODULES(PANGO_FT2, $1 >= $3, have_pangoft2=yes, true)
1134 if test "$have_pangoft2" = yes ; then
1135 AC_DEFINE(HAVE_PANGO16)
1136 AC_DEFINE(HAVE_PANGO_FT2)
1137 PANGO_FT2_CFLAGS="$PANGO_FT2_CFLAGS $GTK2_CFLAGS"
1138 PANGO_FT2_LIBS="$PANGO_FT2_LIBS $GTK2_LIBS"
1139 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1140 save_CPPFLAGS="$CPPFLAGS"
1142 CPPFLAGS="$CPPFLAGS $PANGO_FT2_CFLAGS"
1143 LIBS="$PANGO_FT2_LIBS $LIBS"
1144 AC_CHECK_HEADERS([pango/pangoft2.h])
1145 AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
1146 AC_SUBST(PANGO_FT2_CFLAGS)
1147 AC_SUBST(PANGO_FT2_LIBS)
1148 CPPFLAGS="$save_CPPFLAGS"
1151 r="lib$1-dev or $1-devel"
1152 ver="$(pkg-config --modversion $1)"
1153 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1157 AC_DEFUN(STEPMAKE_FONTCONFIG, [
1158 PKG_CHECK_MODULES(FONTCONFIG, $1 >= $3, have_fontconfig=yes, true)
1159 if test "$have_fontconfig" = yes ; then
1160 AC_DEFINE(HAVE_FONTCONFIG)
1161 FONTCONFIG_CFLAGS="$FONTCONFIG_CFLAGS"
1162 FONTCONFIG_LIBS="$FONTCONFIG_LIBS"
1163 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1164 save_CPPFLAGS="$CPPFLAGS"
1166 CPPFLAGS="$CPPFLAGS $FONTCONFIG_CFLAGS"
1167 LIBS="$FONTCONFIG_LIBS $LIBS"
1168 AC_SUBST(FONTCONFIG_CFLAGS)
1169 AC_SUBST(FONTCONFIG_LIBS)
1170 CPPFLAGS="$save_CPPFLAGS"
1173 r="lib$1-dev or $1-devel"
1174 ver="$(pkg-config --modversion $1)"
1175 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])