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.
34 ## grab the first version number in --version output.
35 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '\(^\| \)[0-9][0-9]*\.[0-9]' \
37 | tr ' ' '\n' | sed 's/\([0-9][0-9]*\.[0-9][0-9.]*\).*/\1/g' | grep '\(^\| \)[0-9][0-9]*\.[0-9]' | head -n 1\`\"
39 if test -z "$_ver"; then
40 ## If empty, try date [fontforge]
41 eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \
43 | 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)
252 AC_DEFUN(STEPMAKE_CXX, [
255 STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1)
257 CXXFLAGS="$CXXFLAGS $OPTIMIZE"
266 AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
267 AC_CACHE_CHECK([whether explicit instantiation is needed],
268 lily_cv_need_explicit_instantiation,
269 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
270 template <class T> struct foo { static int baz; };
271 template <class T> int foo<T>::baz = 1;
272 ]], [[ return foo<int>::baz; ]])],[lily_cv_need_explicit_instantiation=no],[lily_cv_need_explicit_instantiation=yes]))
273 if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then
274 AC_DEFINE(NEED_EXPLICIT_INSTANTIATION)
279 AC_DEFUN(STEPMAKE_DATADIR, [
280 if test "$datadir" = "\${prefix}/share"; then
281 datadir='${prefix}/share'
284 if test "$prefix" = "NONE"; then
285 presome=${ac_default_prefix}
288 build_package_datadir=$ugh_ugh_autoconf250_builddir/out$CONFIGSUFFIX/share/$package
290 DATADIR=`echo ${datadir} | sed "s!\\\${datarootdir}!${prefix}/share!"`
291 DATADIR=`echo ${DATADIR} | sed "s!\\\${prefix}!$presome!"`
292 BUILD_PACKAGE_DATADIR=`echo ${build_package_datadir} | sed "s!\\\${prefix}!$presome!"`
295 AC_SUBST(datarootdir)
296 AC_SUBST(build_package_datadir)
297 AC_DEFINE_UNQUOTED(DATADIR, ["${DATADIR}"])
298 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_DATADIR, ["${BUILD_PACKAGE_DATADIR}"])
301 ## ugh: cut & paste programming from datadir.
302 AC_DEFUN(STEPMAKE_LIBDIR, [
304 if test "$libdir" = "\${exec_prefix}/lib"; then
305 libdir='${exec_prefix}/lib'
308 build_package_libdir=$ugh_ugh_autoconf250_builddir/out$CONFIGSUFFIX/lib/$package
310 LIBDIR=`echo ${libdir} | sed "s!\\\${exec_prefix}!$presome!"`
311 BUILD_PACKAGE_LIBDIR=`echo ${build_package_libdir} | sed "s!\\\${exec_prefix}!$presome!"`
314 AC_SUBST(build_package_libdir)
315 AC_DEFINE_UNQUOTED(LIBDIR, ["${LIBDIR}"])
316 AC_DEFINE_UNQUOTED(BUILD_PACKAGE_LIBDIR, ["${BUILD_PACKAGE_LIBDIR}"])
320 AC_DEFUN(STEPMAKE_END, [
324 AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in])
327 if test -n "$OPTIONAL"; then
329 echo "WARNING: Please consider installing optional programs: $OPTIONAL"
332 if test -n "$REQUIRED"; then
334 echo "ERROR: Please install required programs: $REQUIRED"
337 if test -n "$UNSUPPORTED"; then
339 echo "ERROR: Please use older version of programs: $UNSUPPORTED"
342 if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
344 echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
345 if test -f config.cache ; then
346 echo "Remove config.cache before rerunning ./configure"
350 if test -n "$REQUIRED$UNSUPPORTED"; then
351 rm -f $srcdir/GNUmakefile
355 # regular in-place build
356 # test for srcdir_build = yes ?
357 if test "$srcdir_build" = "yes"; then
358 rm -f $srcdir/GNUmakefile
359 cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile
360 chmod 444 $srcdir/GNUmakefile
362 if test -f $srcdir/GNUmakefile; then
364 Source directory already configured. Please clean the source directory
366 make -C $srcdir distclean
374 for mf in `cd $srcdir ; find -maxdepth $d -mindepth $d -name GNUmakefile`; do
375 mkdir -p $(dirname $mf)
376 cat <<EOF | $PYTHON - > $mf
377 print 'depth=' + ('../' * ( $d-1 ) )
378 print 'include \$(depth)/config\$(if \$(conf),-\$(conf),).make'
379 print 'include \$(configure-srcdir)/$mf'
382 for mf in `cd $srcdir ; find -maxdepth $d -mindepth $d -name '*.make' | grep -v config.make `; do
383 mkdir -p $(dirname $mf)
384 cat <<EOF | $PYTHON - > $mf
385 print 'include \$(depth)/config\$(if \$(conf),-\$(conf),).make'
386 print 'include \$(configure-srcdir)/$mf'
392 cat <<EOF > GNUmakefile
394 include config\$(if \$(conf),-\$(conf),).make
395 include \$(configure-srcdir)/GNUmakefile.in
402 AC_DEFUN(STEPMAKE_FLEX, [
403 # ugh, automake: we want (and check for) flex
405 # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack...
409 ac_cv_prog_lex_root=lex.yy
410 STEPMAKE_PROGS(FLEX, flex, $1)
414 AC_DEFUN(STEPMAKE_FLEXLEXER, [
415 AC_CHECK_HEADERS([FlexLexer.h],[true],[false])
416 if test $? -ne 0; then
417 warn='FlexLexer.h (flex package)'
418 STEPMAKE_ADD_ENTRY($1, $warn)
420 # check for yyFlexLexer.yy_current_buffer,
421 # in 2.5.4 <= flex < 2.5.29
423 AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer],
424 [stepmake_flexlexer_yy_current_buffer],
425 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
427 #include <FlexLexer.h>
428 class yy_flex_lexer: public yyFlexLexer
433 yy_current_buffer = 0;
437 [stepmake_flexlexer_yy_current_buffer=yes],
438 [stepmake_flexlexer_yy_current_buffer=no]))
439 if test $stepmake_flexlexer_yy_current_buffer = yes; then
440 AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.])
447 AC_DEFUN(STEPMAKE_FLEXLEXER_LOCATION, [
448 AC_MSG_CHECKING([FlexLexer.h location])
451 cat <<EOF > conftest.cc
453 #include <FlexLexer.h>
455 FLEXLEXER_FILE=`eval $ac_cpp conftest.cc | \
456 sed 's!# 1 "\(.*FlexLexer.h\)"!@FLEXLEXER@\1@@!g' | grep '@@' | \
457 sed 's!.*@FLEXLEXER@\(.*\)@@.*$!\1!g' ` 1> /dev/null 2> /dev/null
459 AC_SUBST(FLEXLEXER_FILE)
460 AC_MSG_RESULT($FLEXLEXER_FILE)
463 AC_DEFUN(STEPMAKE_GCC, [
464 if test "$GCC" = "yes"; then
465 STEPMAKE_CHECK_VERSION(CC, $1, $2)
467 warn="$CC (Please install *GNU* cc)"
468 STEPMAKE_ADD_ENTRY($1, $warn)
472 AC_DEFUN(STEPMAKE_GETTEXT, [
474 if test "$prefix" = "NONE"; then
475 presome=${ac_default_prefix}
477 LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"`
480 AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
481 # ouch. autoconf <= 2.57's gettext check fails for
482 # g++ >= 3.3 (with -std=gnu++98, the default).
483 # While the check is OK for g++ -std=c++98,
484 # LilyPond needs GNU g++, so who is to blame here?
485 # Use a workaround until this is resolved:
486 # for g++ >= 3.3, select C language.
488 STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
489 if test -n "$GCC_UNSUPPORTED"; then
490 AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
491 AC_MSG_WARN([Trying gcc, cross fingers.])
494 AC_CHECK_LIB(intl, gettext)
495 AC_CHECK_FUNCS(gettext)
496 if test -n "$GCC_UNSUPPORTED"; then
502 AC_DEFUN(STEPMAKE_GUILE, [
503 STEPMAKE_PATH_PROG(GUILE, guile, $1)
507 # STEPMAKE_GUILE_FLAGS --- set flags for compiling and linking with Guile
509 # This macro runs the guile-config script, installed with Guile,
510 # to find out where Guile's header files and libraries are
511 # installed. It sets two variables, marked for substitution, as
514 # GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
515 # code that uses Guile header files. This is almost
516 # always just a -I flag.
518 # GUILE_LDFLAGS --- flags to pass to the linker to link a
519 # program against Guile. This includes -lguile for
520 # the Guile library itself, any libraries that Guile
521 # itself requires (like -lqthreads), and so on. It may
522 # also include a -L flag to tell the compiler where to
523 # find the libraries.
525 AC_DEFUN([STEPMAKE_GUILE_FLAGS], [
526 exe=`STEPMAKE_GET_EXECUTABLE($guile_config)`
527 if test -x $exe; then
528 AC_MSG_CHECKING([guile compile flags])
529 GUILE_CFLAGS="`$guile_config compile`"
530 AC_MSG_RESULT($GUILE_CFLAGS)
531 AC_MSG_CHECKING([guile link flags])
532 GUILE_LDFLAGS="`$guile_config link`"
533 AC_MSG_RESULT($GUILE_LDFLAGS)
535 AC_SUBST(GUILE_CFLAGS)
536 AC_SUBST(GUILE_LDFLAGS)
540 AC_DEFUN(STEPMAKE_GUILE_DEVEL, [
541 ## First, let's just see if we can find Guile at all.
542 test -n "$target_alias" && target_guile_config=$target_alias-guile-config
543 test -n "$host_alias" && host_guile_config=$host_alias-guile-config
544 AC_MSG_CHECKING([for guile-config])
545 for guile_config in $GUILE_CONFIG $target_guile_config $host_guile_config $build_guile_config guile-config; do
546 AC_MSG_RESULT([$guile_config])
547 if ! $guile_config --version > /dev/null 2>&1 ; then
548 AC_MSG_WARN([cannot execute $guile_config])
549 AC_MSG_CHECKING([if we are cross compiling])
550 GUILE_CONFIG='echo no guile-config'
552 GUILE_CONFIG=$guile_config
556 STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1)
557 if test $? -ne 0; then
558 STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)')
561 STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG)
562 # urg. should test functionality rather than version.
563 if test $? -eq 0 -a -n "$2"; then
564 STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2)
567 AC_SUBST(GUILE_CONFIG)
570 changequote(<<, >>)#dnl
571 GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'`
572 GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'`
573 GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
574 changequote([, ])#dnl
576 save_CPPFLAGS="$CPPFLAGS"
578 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
579 LIBS="$GUILE_LDFLAGS $LIBS"
580 AC_CHECK_HEADERS([libguile.h])
581 AC_CHECK_LIB(guile, scm_boot_guile)
582 AC_CHECK_FUNCS(scm_boot_guile,,libguile_b=no)
583 if test "$libguile_b" = "no"; then
584 warn='libguile (libguile-dev, guile-devel or guile-dev
586 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
588 CPPFLAGS="$save_CPPFLAGS"
590 AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION)
591 AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION)
592 AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL)
596 AC_DEFUN(STEPMAKE_DLOPEN, [
597 AC_CHECK_LIB(dl, dlopen)
598 AC_CHECK_FUNCS(dlopen)
601 AC_DEFUN(STEPMAKE_GXX, [
602 if test "$GXX" = "yes"; then
603 STEPMAKE_CHECK_VERSION(CXX, $1, $2)
605 warn="$CXX (Please install *GNU* c++)"
606 STEPMAKE_ADD_ENTRY($1, $warn)
611 AC_DEFUN(STEPMAKE_INIT, [
615 FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL
616 MICRO_VERSION=$PATCH_LEVEL
617 TOPLEVEL_VERSION=$FULL_VERSION
618 if test x$MY_PATCH_LEVEL != x; then
619 FULL_VERSION=$FULL_VERSION.$MY_PATCH_LEVEL
621 VERSION=$FULL_VERSION
622 export MAJOR_VERSION MINOR_VERSION PATCH_LEVEL
623 # urg: don't "fix" this: irix doesn't know about [:lower:] and [:upper:]
624 changequote(<<, >>)#dnl
625 PACKAGE=`echo $PACKAGE_NAME | tr '[a-z]' '[A-Z]'`
626 package=`echo $PACKAGE_NAME | tr '[A-Z]' '[a-z]'`
627 changequote([, ])#dnl
629 # No versioning on directory names of sub-packages
631 stepmake=${datadir}/stepmake
633 if test "$prefix" = "NONE"; then
634 presome=${ac_default_prefix}
636 stepmake=`echo ${stepmake} | sed "s!\\\${prefix}!$presome!"`
638 # urg, how is this supposed to work?
639 if test "$program_prefix" = "NONE"; then
642 if test "$program_suffix" = "NONE"; then
646 AC_MSG_CHECKING(Package)
647 if test "$PACKAGE" = "STEPMAKE"; then
648 AC_MSG_RESULT(Stepmake package!)
650 AC_MSG_CHECKING(builddir)
652 ugh_ugh_autoconf250_builddir="`pwd`"
654 if test "$srcdir" = "."; then
658 package_builddir="`dirname $ugh_ugh_autoconf250_builddir`"
659 package_srcdir="`dirname $srcdir`"
661 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
663 (cd stepmake 2>/dev/null || mkdir stepmake)
664 (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .)
667 AC_MSG_RESULT($PACKAGE)
669 AC_MSG_CHECKING(builddir)
670 ugh_ugh_autoconf250_builddir="`pwd`"
672 here_dir=$(cd . && pwd)
673 full_src_dir=$(cd $srcdir && pwd)
675 if test "$full_src_dir" = "$here_dir"; then
680 AC_MSG_RESULT($ugh_ugh_autoconf250_builddir)
682 AC_MSG_CHECKING(for stepmake)
683 # Check for installed stepmake
684 if test -d $stepmake; then
685 AC_MSG_RESULT($stepmake)
687 stepmake="`cd $srcdir/stepmake; pwd`"
688 AC_MSG_RESULT([$srcdir/stepmake ($datadir/stepmake not found)])
692 AC_SUBST(ugh_ugh_autoconf250_builddir)
694 # Use absolute directory for non-srcdir builds, so that build
696 if test "$srcdir_build" = "no" ; then
697 srcdir="`cd $srcdir; pwd`"
704 AC_SUBST(PACKAGE_NAME)
706 AC_SUBST(MAJOR_VERSION)
707 AC_SUBST(MINOR_VERSION)
708 AC_SUBST(MICRO_VERSION)
710 # stepmake nonstandard names
711 AC_SUBST(PATCH_LEVEL)
712 AC_SUBST(TOPLEVEL_VERSION)
714 # We don't need the upper case variant,
715 # so stick to macros are uppercase convention.
716 # AC_DEFINE_UNQUOTED(package, ["${package}"])
717 # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"])
718 AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"])
719 AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"])
720 AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"])
722 if test -z "$package_depth"; then
725 package_depth="../$package_depth"
728 AC_SUBST(package_depth)
730 AUTOGENERATE="This file was automatically generated by configure"
731 AC_SUBST(AUTOGENERATE)
734 AC_ARG_ENABLE(config,
735 [ --enable-config=CONF put settings in config-CONF.make and config-CONF.h;
736 do `make conf=CONF' to get output in ./out-CONF],
737 [CONFIGURATION=$enableval])
741 test -n "$CONFIGURATION" && CONFIGSUFFIX="-$CONFIGURATION"
742 CONFIGFILE=config$CONFIGSUFFIX
743 AC_SUBST(CONFIGSUFFIX)
746 STEPMAKE_PROGS(MAKE, gmake make, REQUIRED)
747 STEPMAKE_PROGS(FIND, find, REQUIRED)
749 STEPMAKE_PROGS(TAR, tar, REQUIRED)
751 if test "$(echo 2)" != "2" ||
752 test "x`uname`" = "xHP-UX"; then
753 AC_PATH_PROG(KSH, ksh, /bin/ksh)
754 AC_PATH_PROG(BASH, bash, $KSH)
755 STEPMAKE_WARN(avoiding buggy /bin/sh)
756 AC_PATH_PROG(SHELL, bash, $KSH)
759 AC_PATH_PROG(BASH, bash, $SHELL)
763 STEPMAKE_PYTHON(REQUIRED, 1.5)
765 if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
766 $MAKE -v 2> /dev/null | grep GNU > /dev/null
767 if test "$?" = 1; then
768 warn='make (Please install *GNU* make)'
769 # STEPMAKE_WARN($warn)
770 STEPMAKE_ADD_ENTRY(REQUIRED, $warn)
781 AC_SUBST(program_prefix)
782 AC_SUBST(program_suffix)
786 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
787 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
797 AC_DEFUN(STEPMAKE_KPATHSEA, [
799 AC_ARG_WITH(kpathsea-include,
800 [ --with-kpathsea-include=DIR
801 location of the kpathsea include dir],[
802 if test "$withval" = "yes" -o "$withval" = "no"; then
803 AC_MSG_WARN(Usage: --with-kpathsea-include=includedir)
805 CPPFLAGS="$CPPFLAGS -I${withval}"
809 AC_ARG_WITH(kpathsea-lib,
810 [ --with-kpathsea-lib=DIR location of the kpathsea lib dir],[
811 if test "$withval" = "yes" -o "$withval" = "no"; then
812 AC_MSG_WARN(Usage: --with-kpathsea-lib=libdir)
814 LDFLAGS="$LDFLAGS -L${withval}"
819 AC_ARG_ENABLE(kpathsea,
820 [ --enable-kpathsea use kpathsea lib. Default: on],
821 [kpathsea_b=$enableval])
824 if test "$kpathsea_b" != "no"; then
825 AC_CHECK_HEADERS([kpathsea/kpathsea.h],,kpathsea_b=no)
826 AC_CHECK_LIB(kpathsea, kpse_find_file)
827 AC_CHECK_FUNCS(kpse_find_file,,kpathsea_b=no)
828 if test "$kpathsea_b" = "no"; then
829 STEPMAKE_ADD_ENTRY(OPTIONAL, $warn)
833 save_CFLAGS="$CFLAGS"
834 CFLAGS=`echo "-shared $CFLAGS" | sed -e 's/ -g//'`
835 AC_MSG_CHECKING([for shared libkpathsea])
836 AC_TRY_LINK([#include <kpathsea/kpathsea.h>],
837 [kpse_var_expand ("\$TEXMF");],
838 [have_libkpathsea_so=maybe;
839 shared_size=`wc -c conftest$ac_exeext`;
840 shared_size=`echo $shared_size | sed -e 's/ .*//g'`],
841 [have_libkpathsea_so=no])
843 if test "$have_libkpathsea_so" = "maybe"; then
844 if test "$shared_size" -lt 40000 ; then
845 have_libkpathsea_so=yes
847 have_libkpathsea_so=no
851 AC_MSG_RESULT($have_libkpathsea_so)
852 if test "$have_libkpathsea_so" = "yes"; then
853 AC_DEFINE(HAVE_LIBKPATHSEA_SO)
855 CFLAGS="$save_CFLAGS"
857 KPATHSEA_LIBS="$LIBS"
859 AC_MSG_CHECKING(whether to use kpathsea)
860 if test "$kpathsea_b" != no; then
869 AC_SUBST(KPATHSEA_LIBS)
870 AC_SUBST(HAVE_LIBKPATHSEA_SO, $have_libkpathsea_so)
871 AC_DEFINE_UNQUOTED(KPATHSEA, $KPATHSEA)
875 AC_DEFUN(STEPMAKE_LIB, [
876 STEPMAKE_PROGS(AR, ar, $1)
878 STEPMAKE_OPTIONAL_REQUIRED(RANLIB, ranlib, $1)
882 AC_DEFUN(STEPMAKE_LIBTOOL, [
884 # **Never** try to set library version numbers so that they correspond
885 # to the release number of your package. This is an abuse that only
886 # fosters misunderstanding of the purpose of library versions.
888 REVISION=$PATCH_LEVEL
889 # CURRENT=$MINOR_VERSION
890 CURRENT=`expr $MINOR_VERSION + 1`
891 # AGE=`expr $MAJOR_VERSION + 1`
899 AC_DEFUN(STEPMAKE_LOCALE, [
904 AC_ARG_WITH(localedir,
905 [ --with-localedir=DIR location of locales. Default: PREFIX/share/locale ],
906 localedir=$with_localedir,
907 localedir='${prefix}/share/locale')
910 [ --with-lang=LANG use LANG as language to emit messages],
914 AC_MSG_CHECKING(language)
916 En* | en* | Am* | am* | US* | us*)
918 NL | nl | Du* | du* | Ned* | ned*)
927 if test "$lang" = "unknown" ; then
928 STEPMAKE_WARN($language not supported; available are: $ALL_LINGUAS)
934 AC_DEFUN(STEPMAKE_MAKEINFO, [
935 STEPMAKE_PROGS(MAKEINFO, makeinfo, $1)
939 AC_DEFUN(STEPMAKE_MAN, [
940 STEPMAKE_PROGS(GROFF, groff ditroff, $1)
942 STEPMAKE_PROGS(TROFF, troff, $1)
944 STEPMAKE_PROGS(TBL, tbl, $1)
949 AC_DEFUN(STEPMAKE_MSGFMT, [
950 STEPMAKE_PROGS(MSGFMT, msgfmt, $1)
954 # Check for program ($2), set full path result to ($1).
955 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
956 AC_DEFUN(STEPMAKE_PATH_PROG, [
957 AC_CHECK_PROGS($1, $2, no)
958 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
959 if test $? -eq 0; then
961 if test -n "$4"; then
962 STEPMAKE_CHECK_VERSION($1, $3, $4)
968 # Check for program in set of names ($2), set result to ($1) .
969 # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED')
970 # If exists, and a minimal version ($4) is required
971 AC_DEFUN(STEPMAKE_PROGS, [
972 AC_CHECK_PROGS($1, $2, no)
973 STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3)
974 if test $? -eq 0 -a -n "$4"; then
975 STEPMAKE_CHECK_VERSION($1, $3, $4)
980 AC_DEFUN(STEPMAKE_PERL, [
981 STEPMAKE_PATH_PROG(PERL, perl, $1)
985 AC_DEFUN(STEPMAKE_PYTHON, [
987 AC_MSG_CHECKING([for python])
988 for python in $PYTHON python python2 python2.4 python2.3 python2.2 python2.1 python2.0; do
989 AC_MSG_RESULT([$python])
990 if ! $python -V > /dev/null 2>&1 ; then
991 #AC_MSG_WARN([cannot execute $python])
992 PYTHON='echo no python'
995 STEPMAKE_CHECK_VERSION(python, pv, $2)
996 if test -z "$pv"; then
1002 if test -n "$pv"; then
1003 STEPMAKE_ADD_ENTRY($1, $pv)
1005 # clear cached value since arg 2 might point us to a new binary
1006 unset ac_cv_path_PYTHON
1008 AC_PATH_PROG(PYTHON, $PYTHON)
1012 AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
1013 AC_ARG_WITH(python-include,
1014 [ --with-python-include=DIR
1015 location of the python include dir],[
1016 if test "$withval" = "yes" -o "$withval" = "no"; then
1017 AC_MSG_WARN(Usage: --with-python-include=includedir)
1019 PYTHON_CFLAGS="-I${withval}"
1023 AC_ARG_WITH(python-lib,
1024 [ --with-python-lib=NAME name of the python lib],[
1025 if test "$withval" = "yes" -o "$withval" = "no"; then
1026 AC_MSG_WARN(Usage: --with-python-lib=name)
1028 LDFLAGS="$LDFLAGS -l${withval}"
1032 AC_CHECK_PROGS(PYTHON_CONFIG, python-config, no)
1034 if test -z "$PYTHON_CFLAGS" -a "$PYTHON_CONFIG" != "no"; then
1035 # Clean out junk: http://bugs.python.org/issue3290
1036 # Python headers may need some -f* flags, leave them in.
1037 PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags | sed -e 's/ -\(W\|D\|O\|m\)\(\w\|-\|=\)\+//g'`
1038 PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
1041 if test -z "$PYTHON_CFLAGS" -a "$cross_compiling" = "no"; then
1042 changequote(<<, >>)#dnl
1043 # alternatively, for python >= 2.0
1044 # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
1045 PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
1046 PYTHON_CFLAGS="-I$PYTHON_INCLUDE"
1047 changequote([, ])#dnl
1050 if test -z "$PYTHON_HEADER"; then
1051 CPPFLAGS="$PYTHON_CFLAGS $CPPFLAGS"
1052 AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
1055 if test -z "$PYTHON_HEADER"; then
1056 warn="Python.h (python-devel, python-dev or libpython-dev package)"
1057 STEPMAKE_ADD_ENTRY($1, $warn)
1063 AC_DEFUN(STEPMAKE_STL_DATA_METHOD, [
1065 AC_CACHE_CHECK([for stl.data () method],
1066 [stepmake_stl_data_method],
1067 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1069 using namespace std;
1071 void *p = v.data ();
1073 [stepmake_stl_data_method=yes],
1074 [stepmake_stl_data_method=no]))
1075 if test $stepmake_stl_data_method = yes; then
1076 AC_DEFINE(HAVE_STL_DATA_METHOD, 1, [define if stl classes have data () method])
1082 AC_DEFUN(STEPMAKE_TEXMF_DIRS, [
1084 STEPMAKE_PROGS(KPSEWHICH, kpsewhich, OPTIONAL)
1087 AC_DEFUN(STEPMAKE_TEXMF, [
1088 STEPMAKE_PROGS(METAFONT, mf-nowin mf mfw mfont, $1)
1089 STEPMAKE_PROGS(METAPOST, mpost, $1)
1090 # STEPMAKE_PROGS(INIMETAFONT, inimf inimfont "$METAFONT -ini", $1)
1092 AC_MSG_CHECKING(for working metafont mode)
1093 modelist='ljfour lj4 lj3 lj2 ljet laserjet'
1094 for MFMODE in $modelist; do
1095 $METAFONT -progname=mf "\mode:=$MFMODE; mode_setup; end." > /dev/null 2>&1
1096 if test -f mfput.tfm; then
1100 AC_MSG_RESULT($MFMODE)
1108 AC_DEFUN(STEPMAKE_WARN, [
1114 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1115 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1116 dnl also defines GSTUFF_PKG_ERRORS on error
1117 AC_DEFUN(PKG_CHECK_MODULES, [
1120 if test -z "$PKG_CONFIG"; then
1121 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1124 if test "$PKG_CONFIG" = "no" ; then
1125 echo "*** The pkg-config script could not be found. Make sure it is"
1126 echo "*** in your path, or set the PKG_CONFIG environment variable"
1127 echo "*** to the full path to pkg-config."
1128 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
1130 PKG_CONFIG_MIN_VERSION=0.9.0
1131 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1132 AC_MSG_CHECKING(for $2)
1134 if $PKG_CONFIG --exists "$2" ; then
1138 AC_MSG_CHECKING($1_CFLAGS)
1139 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
1140 AC_MSG_RESULT($$1_CFLAGS)
1142 AC_MSG_CHECKING($1_LIBS)
1143 $1_LIBS=`$PKG_CONFIG --libs "$2"`
1144 AC_MSG_RESULT($$1_LIBS)
1148 ## If we have a custom action on failure, don't print errors, but
1149 ## do set a variable so people can do so.
1150 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1151 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1159 if test $succeeded = yes; then
1160 ifelse([$3], , :, [$3])
1162 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])
1166 AC_DEFUN(STEPMAKE_FREETYPE2, [
1167 PKG_CHECK_MODULES(FREETYPE2, $1 >= $3, have_freetype2=yes, true)
1168 if test "$have_freetype2" = yes; then
1169 AC_DEFINE(HAVE_FREETYPE2)
1170 save_CPPFLAGS="$CPPFLAGS"
1172 CPPFLAGS="$FREETYPE2_CFLAGS $CPPFLAGS"
1173 LIBS="$FREETYPE2_LIBS $LIBS"
1174 AC_SUBST(FREETYPE2_CFLAGS)
1175 AC_SUBST(FREETYPE2_LIBS)
1176 CPPFLAGS="$save_CPPFLAGS"
1180 #r="lib$1-dev or $1-devel"
1181 r="libfreetype6-dev or freetype?-devel"
1182 ver="`pkg-config --modversion $1`"
1183 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1187 AC_DEFUN(STEPMAKE_GTK2, [
1188 PKG_CHECK_MODULES(GTK2, $1 >= $3, have_gtk2=yes, true)
1189 if test "$have_gtk2" = yes ; then
1190 AC_DEFINE(HAVE_GTK2)
1191 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1192 save_CPPFLAGS="$CPPFLAGS"
1194 CPPFLAGS="$GTK2_CFLAGS $CPPFLAGS"
1195 LIBS="$GTK2_LIBS $LIBS"
1196 AC_SUBST(GTK2_CFLAGS)
1198 CPPFLAGS="$save_CPPFLAGS"
1202 # r="lib$1-dev or $1-devel"
1203 r="libgtk2.0-dev or gtk2-devel"
1204 ver="`pkg-config --modversion $1`"
1205 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1209 AC_DEFUN(STEPMAKE_PANGO, [
1210 PKG_CHECK_MODULES(PANGO, $1 >= $3, have_pango16=yes, true)
1211 if test "$have_pango16" = yes ; then
1212 AC_DEFINE(HAVE_PANGO16)
1213 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1214 save_CPPFLAGS="$CPPFLAGS"
1216 CPPFLAGS="$PANGO_CFLAGS $CPPFLAGS"
1217 LIBS="$PANGO_LIBS $LIBS"
1218 AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
1219 AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
1220 AC_SUBST(PANGO_CFLAGS)
1221 AC_SUBST(PANGO_LIBS)
1222 CPPFLAGS="$save_CPPFLAGS"
1226 #r="lib$1-dev or $1-devel"
1227 r="libpango1.0-dev or pango1.0-devel"
1228 ver="`pkg-config --modversion $1`"
1229 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1233 AC_DEFUN(STEPMAKE_PANGO_FT2, [
1234 PKG_CHECK_MODULES(PANGO_FT2, $1 >= $3, have_pangoft2=yes, true)
1235 if test "$have_pangoft2" = yes ; then
1236 AC_DEFINE(HAVE_PANGO16)
1237 AC_DEFINE(HAVE_PANGO_FT2)
1238 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1239 save_CPPFLAGS="$CPPFLAGS"
1241 CPPFLAGS="$CPPFLAGS $PANGO_FT2_CFLAGS"
1242 LIBS="$PANGO_FT2_LIBS $LIBS"
1243 AC_CHECK_HEADERS([pango/pangoft2.h])
1244 AC_CHECK_FUNCS([pango_ft2_font_map_create_context])
1245 AC_SUBST(PANGO_FT2_CFLAGS)
1246 AC_SUBST(PANGO_FT2_LIBS)
1247 CPPFLAGS="$save_CPPFLAGS"
1251 #r="lib$1-dev or $1-devel"e
1252 r="libpango1.0-dev or pango?-devel"
1253 ver="`pkg-config --modversion $1`"
1254 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1258 AC_DEFUN(STEPMAKE_FONTCONFIG, [
1259 PKG_CHECK_MODULES(FONTCONFIG, $1 >= $3, have_fontconfig=yes, true)
1260 if test "$have_fontconfig" = yes ; then
1261 AC_DEFINE(HAVE_FONTCONFIG)
1262 # Do not pollute user-CPPFLAGS with configure-CPPFLAGS
1263 save_CPPFLAGS="$CPPFLAGS"
1265 CPPFLAGS="$FONTCONFIG_CFLAGS $CPPFLAGS"
1266 LIBS="$FONTCONFIG_LIBS $LIBS"
1267 AC_SUBST(FONTCONFIG_CFLAGS)
1268 AC_SUBST(FONTCONFIG_LIBS)
1269 CPPFLAGS="$save_CPPFLAGS"
1272 r="lib$1-dev or $1-devel"
1273 ver="`pkg-config --modversion $1`"
1274 STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
1278 AC_DEFUN(STEPMAKE_WINDOWS, [
1282 if test "$CYGWIN" = "yes"; then
1283 LN_S='cp -r' # Cygwin symbolic links do not work for native apps.
1285 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1286 elif test "$MINGW32" = "yes"; then
1290 INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
1296 AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}'])
1297 AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}'])
1300 AC_SUBST(program_suffix)
1302 AC_MSG_CHECKING([for some flavor of Windows])
1303 if test "$CYGWIN$MINGW32" = "nono"; then
1306 PLATFORM_WINDOWS=yes
1308 AC_MSG_RESULT([$PLATFORM_WINDOWS])
1309 AC_SUBST(PLATFORM_WINDOWS)
1310 STEPMAKE_PROGS(WINDRES, $target-windres windres, x)