X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=stepmake%2Faclocal.m4;h=6308424a7b17e911e323fc6817b88179dcf9bafb;hb=26633bbfbf821a7cfdfe7a0367d1ea94a440be2e;hp=2e14b05f46f5f1b647d9c372de6844ac7e3c1f42;hpb=ee120ccea09db13fb8a55de37b73446de25c2c42;p=lilypond.git diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4 index 2e14b05f46..6308424a7b 100644 --- a/stepmake/aclocal.m4 +++ b/stepmake/aclocal.m4 @@ -6,23 +6,42 @@ dnl StepMake subroutines for configure.in # Get full path of executable ($1) AC_DEFUN(STEPMAKE_GET_EXECUTABLE, [ - type -p "$1" 2>&1 | awk '{print $NF}' + ## which doesn't work in ash, if /usr/bin/which isn't installed + ## type -p doesn't work in ash + ## command -v doesn't work in zsh + ## command -v "$1" 2>&1 + ## this test should work in ash, bash, pdksh (ksh), zsh + type -p "$1" 2>/dev/null | tail -n 1 | awk '{print $NF}' ]) # Get version string from executable ($1) AC_DEFUN(STEPMAKE_GET_VERSION, [ - "$1" --version 2>&1 | grep -v '^$' | head -1 | awk '{print $NF}' + ## "$1" --version 2>&1 | grep -v '^$' | head -n 1 | awk '{print $NF}' + ## + ## ARG. + ## Workaround for broken Debian gcc version string: + ## gcc (GCC) 3.1.1 20020606 (Debian prerelease) + ## + ## -V: Workaround for python + ## + ## Assume, and hunt for, dotted version multiplet. + + changequote(<<, >>)dnl + ("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' | head -n 1 | \ + sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' + changequote([, ])dnl ]) -# Calculate numeric version from version string ($1) +# Calculate simplistic numeric version from version string ($1) +# As yet, we have no need for something more elaborate. AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [ echo "$1" | awk -F. ' { - if ([$]3) {last = [$]3} - else {last =0} + if ([$]3) {three = [$]3} + else {three = 0} } - {printf "%s%s%s\n",[$]1*100, [$]2*10,last}' + {printf "%d\n", [$]1*1000000 + [$]2*1000 + three}' ]) @@ -32,10 +51,9 @@ AC_DEFUN(STEPMAKE_ADD_ENTRY, [ ]) # Check if tested program ($2) was found ($1). -# If not, add etry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED'). +# If not, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED'). # We could abort here if a 'REQUIRED' program is not found AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [ - #if test "`eval echo '$'"$1"`" = "no"; then STEPMAKE_CHECK_SEARCH_RESULT($1) if test $? -ne 0; then STEPMAKE_ADD_ENTRY($3, $2) @@ -56,15 +74,46 @@ AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [ # Return if tested proram ($1) was found (true) or not (false). AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [ r="`eval echo '$'"$1"`" - if test -n "$r" -a "$r" != "error" -a "$r" != "no" && ! expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then + if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then + true + else ##STEPMAKE_WARN(cannot find $2. $3) false - else - true fi ]) +# Check version of program ($1) +# If version is smaller than requested ($3), +# add entry to missing-list ($2, one of 'OPTIONAL', 'REQUIRED'). +AC_DEFUN(STEPMAKE_CHECK_VERSION, [ + r="`eval echo '$'"$1"`" + AC_MSG_CHECKING([$r version]) + exe=`STEPMAKE_GET_EXECUTABLE($r)` + ver=`STEPMAKE_GET_VERSION($exe)` + num=`STEPMAKE_NUMERIC_VERSION($ver)` + req=`STEPMAKE_NUMERIC_VERSION($3)` + AC_MSG_RESULT([$ver]) + if test "$num" -lt "$req"; then + STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"]) + fi +]) + +# Check version of program ($1) +# If version is greater than or equals unsupported ($3), +# add entry to unsupported list ($2, 'UNSUPPORTED') +AC_DEFUN(STEPMAKE_CHECK_VERSION_UNSUPPORTED, [ + r="`eval echo '$'"$1"`" + AC_MSG_CHECKING([$r version]) + exe=`STEPMAKE_GET_EXECUTABLE($r)` + ver=`STEPMAKE_GET_VERSION($exe)` + num=`STEPMAKE_NUMERIC_VERSION($ver)` + sup=`STEPMAKE_NUMERIC_VERSION($3)` + AC_MSG_RESULT([$ver]) + if test "$num" -ge "$sup"; then + STEPMAKE_ADD_ENTRY($2, ["$r < $3 (installed: $ver)"]) + fi +]) ### Macros to build configure.in @@ -89,19 +138,9 @@ AC_DEFUN(STEPMAKE_BISON, [ # urg. should test functionality rather than version. if test "$BISON" = "bison" -a -n "$2"; then -# if test $? -eq 0 -a -n "$2"; then - AC_MSG_CHECKING("bison version") - exe=`STEPMAKE_GET_EXECUTABLE(bison)` - ver=`STEPMAKE_GET_VERSION($exe)` - num=`STEPMAKE_NUMERIC_VERSION($ver)` - req=`STEPMAKE_NUMERIC_VERSION($2)` - AC_MSG_RESULT("$ver") - if test "$num" -lt "$req"; then - STEPMAKE_ADD_ENTRY($1, "bison $2 (installed: $ver)") - fi + STEPMAKE_CHECK_VERSION(BISON, $1, $2) fi ]) - AC_DEFUN(STEPMAKE_COMPILE, [ @@ -123,7 +162,7 @@ AC_DEFUN(STEPMAKE_COMPILE, [ [debug_b=$enableval]) AC_ARG_ENABLE(optimising, - [ --enable-optimising compile with optimising. Default: on], + [ --enable-optimising compile with optimising. Default: on], [optimise_b=$enableval]) AC_ARG_ENABLE(profiling, @@ -183,13 +222,10 @@ AC_DEFUN(STEPMAKE_COMPILE, [ ]) AC_DEFUN(STEPMAKE_CXX, [ - AC_LANG_CPLUSPLUS + AC_LANG([C++]) AC_PROG_CXX STEPMAKE_OPTIONAL_REQUIRED(CXX, c++, $1) - AC_CHECK_HEADER(FlexLexer.h, true, - STEPMAKE_WARN(cannot find flex header. Please install Flex headers correctly)) - CPPFLAGS="$CPPFLAGS $DEFINES" CXXFLAGS="$CXXFLAGS $OPTIMIZE" LDFLAGS="$LDFLAGS $EXTRA_LIBES" @@ -204,12 +240,10 @@ AC_DEFUN(STEPMAKE_CXX, [ AC_DEFUN(STEPMAKE_CXXTEMPLATE, [ AC_CACHE_CHECK([whether explicit instantiation is needed], lily_cv_need_explicit_instantiation, - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ template struct foo { static int baz; }; template int foo::baz = 1; - ], [ return foo::baz; ], - lily_cv_need_explicit_instantiation=no, - lily_cv_need_explicit_instantiation=yes)) + ]], [[ return foo::baz; ]])],[lily_cv_need_explicit_instantiation=no],[lily_cv_need_explicit_instantiation=yes])) if test x"$lily_cv_need_explicit_instantiation"x = x"yes"x; then AC_DEFINE(NEED_EXPLICIT_INSTANTIATION) fi @@ -218,25 +252,40 @@ AC_DEFUN(STEPMAKE_CXXTEMPLATE, [ AC_DEFUN(STEPMAKE_DATADIR, [ if test "$datadir" = "\${prefix}/share"; then - datadir='${prefix}/share/'$package + datadir='${prefix}/share' fi - DIR_DATADIR=${datadir} presome=${prefix} if test "$prefix" = "NONE"; then - presome=${ac_default_prefix} + presome=${ac_default_prefix} fi - DIR_DATADIR=`echo ${DIR_DATADIR} | sed "s!\\\${prefix}!$presome!"` - + + build_package_datadir=$ugh_ugh_autoconf250_builddir/share/$package + + DATADIR=`echo ${datadir} | sed "s!\\\${prefix}!$presome!"` + BUILD_PACKAGE_DATADIR=`echo ${build_package_datadir} | sed "s!\\\${prefix}!$presome!"` + AC_SUBST(datadir) - AC_SUBST(DIR_DATADIR) + AC_SUBST(build_package_datadir) + AC_DEFINE_UNQUOTED(DATADIR, ["${DATADIR}"]) + AC_DEFINE_UNQUOTED(BUILD_PACKAGE_DATADIR, ["${BUILD_PACKAGE_DATADIR}"]) +]) + +## ugh: cut & paste programming from datadir. +AC_DEFUN(STEPMAKE_LIBDIR, [ + + if test "$libdir" = "\${exec_prefix}/lib"; then + libdir='${exec_prefix}/lib' + fi + presome=$exec_prefix + build_package_libdir=$ugh_ugh_autoconf250_builddir/lib/$package - dnl yeah, so fuck me gently with a cactus: this doesnt belong here - dnl Please take the person responsible for inventing shell-scripts out - dnl and shoot him. On behalf of the sane world, thank you. - dnl DIR_SHAREDSTATEDIR="foobar" - dnl AC_SUBST(DIR_SHAREDSTATEDIR) + LIBDIR=`echo ${libdir} | sed "s!\\\${exec_prefix}!$presome!"` + BUILD_PACKAGE_LIBDIR=`echo ${build_package_libdir} | sed "s!\\\${exec_prefix}!$presome!"` - AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}") + AC_SUBST(libdir) + AC_SUBST(build_package_libdir) + AC_DEFINE_UNQUOTED(LIBDIR, ["${LIBDIR}"]) + AC_DEFINE_UNQUOTED(BUILD_PACKAGE_LIBDIR, ["${BUILD_PACKAGE_LIBDIR}"]) ]) @@ -244,8 +293,8 @@ AC_DEFUN(STEPMAKE_END, [ AC_SUBST(OPTIONAL) AC_SUBST(REQUIRED) - AC_OUTPUT($CONFIGFILE.make:config.make.in) - + AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in]) + AC_OUTPUT if test -n "$OPTIONAL"; then echo @@ -257,20 +306,27 @@ AC_DEFUN(STEPMAKE_END, [ echo "ERROR: Please install required programs: $REQUIRED" fi - if test -n "$OPTIONAL$REQUIRED"; then + if test -n "$UNSUPPORTED"; then + echo + echo "ERROR: Please use older version of programs: $UNSUPPORTED" + fi + + if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then echo echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME" - echo "Remove config.cache before rerunning ./configure" + if test -f config.cache ; then + echo "Remove config.cache before rerunning ./configure" + fi fi - if test -n "$REQUIRED"; then + if test -n "$REQUIRED$UNSUPPORTED"; then rm -f $srcdir/GNUmakefile exit 1 fi # regular in-place build # test for srcdir_build = yes ? - if test "$builddir" = "."; then + if test "$srcdir_build" = "yes"; then rm -f $srcdir/GNUmakefile cp $srcdir/GNUmakefile.in $srcdir/GNUmakefile chmod 444 $srcdir/GNUmakefile @@ -287,27 +343,81 @@ AC_DEFUN(STEPMAKE_FLEX, [ # AC_PROG_LEX # urg: automake 1.3: hope this doesn't break 1.2 ac_cv_pro_lex_root hack... - # AC_DECL_YYTEXT + # AC_PROG_LEX() # ugh, ugh ac_cv_prog_lex_root=lex.yy STEPMAKE_PROGS(FLEX, flex, $1) ]) +AC_DEFUN(STEPMAKE_FLEXLEXER, [ + AC_CHECK_HEADERS([FlexLexer.h],[true],[false]) + if test $? -ne 0; then + warn='FlexLexer.h (flex package)' + STEPMAKE_ADD_ENTRY($1, $warn) + fi + # check for yyFlexLexer.yy_current_buffer, + # in 2.5.4 <= flex < 2.5.29 + AC_LANG_PUSH(C++) + AC_CACHE_CHECK([for yyFlexLexer.yy_current_buffer], + [stepmake_flexlexer_yy_current_buffer], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +using namespace std; +#include +class yy_flex_lexer: public yyFlexLexer +{ + public: + yy_flex_lexer () + { + yy_current_buffer = 0; + } +}; +]])], + [stepmake_flexlexer_yy_current_buffer=yes], + [stepmake_flexlexer_yy_current_buffer=no])) + if test $stepmake_flexlexer_yy_current_buffer = yes; then + AC_DEFINE(HAVE_FLEXLEXER_YY_CURRENT_BUFFER, 1, [Define to 1 if yyFlexLexer has yy_current_buffer.]) + fi + AC_LANG_POP(C++) +]) + + +AC_DEFUN(STEPMAKE_GCC, [ + if test "$GCC" = "yes"; then + STEPMAKE_CHECK_VERSION(CC, $1, $2) + else + warn="$CC (Please install *GNU* cc)" + STEPMAKE_ADD_ENTRY($1, $warn) + fi +]) AC_DEFUN(STEPMAKE_GETTEXT, [ - DIR_LOCALEDIR=${localedir} presome=${prefix} if test "$prefix" = "NONE"; then presome=${ac_default_prefix} fi - DIR_LOCALEDIR=`echo ${DIR_LOCALEDIR} | sed "s!\\\${prefix}!$presome!"` + LOCALEDIR=`echo ${localedir} | sed "s!\\\${prefix}!$presome!"` + AC_SUBST(localedir) - AC_SUBST(DIR_LOCALEDIR) - AC_DEFINE_UNQUOTED(DIR_LOCALEDIR, "${DIR_LOCALEDIR}") - + AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"]) + # ouch. autoconf <= 2.57's gettext check fails for + # g++ >= 3.3 (with -std=gnu++98, the default). + # While the check is OK for g++ -std=c++98, + # LilyPond needs GNU g++, so who is to blame here? + # Use a workaround until this is resolved: + # for g++ >= 3.3, select C language. + GCC_UNSUPPORTED= + STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3) + if test -n "$GCC_UNSUPPORTED"; then + AC_MSG_WARN([autoconf <= 2.57 with g++ >= 3.3 gettext test broken.]) + AC_MSG_WARN([Trying gcc, cross thumbs.]) + AC_LANG_PUSH(C) + fi AC_CHECK_LIB(intl, gettext) AC_CHECK_FUNCS(gettext) + if test -n "$GCC_UNSUPPORTED"; then + AC_LANG_POP(C) + fi ]) @@ -337,10 +447,10 @@ AC_DEFUN(STEPMAKE_GUILE, [ AC_DEFUN([STEPMAKE_GUILE_FLAGS], [ exe=`STEPMAKE_GET_EXECUTABLE($guile_config)` if test -x $exe; then - AC_MSG_CHECKING("guile compile flags") + AC_MSG_CHECKING([guile compile flags]) GUILE_CFLAGS="`$guile_config compile`" AC_MSG_RESULT($GUILE_CFLAGS) - AC_MSG_CHECKING("guile link flags") + AC_MSG_CHECKING([guile link flags]) GUILE_LDFLAGS="`$guile_config link`" AC_MSG_RESULT($GUILE_LDFLAGS) fi @@ -351,12 +461,12 @@ AC_DEFUN([STEPMAKE_GUILE_FLAGS], [ AC_DEFUN(STEPMAKE_GUILE_DEVEL, [ ## First, let's just see if we can find Guile at all. - AC_MSG_CHECKING("for guile-config") - for guile_config in guile-config $target-guile-config $build-guile-config; do - AC_MSG_RESULT("$guile_config") + AC_MSG_CHECKING([for guile-config]) + for guile_config in $GUILE_CONFIG guile-config $target-guile-config $build-guile-config; do + AC_MSG_RESULT([$guile_config]) if ! $guile_config --version > /dev/null 2>&1 ; then - AC_MSG_WARN("cannot execute $guile_config") - AC_MSG_CHECKING("if we are cross compiling") + AC_MSG_WARN([cannot execute $guile_config]) + AC_MSG_CHECKING([if we are cross compiling]) GUILE_CONFIG='echo no guile-config' else GUILE_CONFIG=$guile_config @@ -364,7 +474,6 @@ AC_DEFUN(STEPMAKE_GUILE_DEVEL, [ fi done STEPMAKE_OPTIONAL_REQUIRED(GUILE_CONFIG, $guile_config, $1) - #if expr "$GUILE_CONFIG" : '.*\(echo\)' >/dev/null; then if test $? -ne 0; then STEPMAKE_ADD_ENTRY($1, 'guile-config (guile-devel, guile-dev or libguile-dev package)') fi @@ -372,16 +481,7 @@ AC_DEFUN(STEPMAKE_GUILE_DEVEL, [ STEPMAKE_CHECK_SEARCH_RESULT(GUILE_CONFIG) # urg. should test functionality rather than version. if test $? -eq 0 -a -n "$2"; then - AC_MSG_CHECKING("guile-config version") - exe=`STEPMAKE_GET_EXECUTABLE($guile_config)` - ver=`STEPMAKE_GET_VERSION($exe)` - set -- - num=`STEPMAKE_NUMERIC_VERSION($ver)` - req=`STEPMAKE_NUMERIC_VERSION($2)` - AC_MSG_RESULT("$ver") - if test "$num" -lt "$req"; then - STEPMAKE_ADD_ENTRY($1, "guile-config $2 (installed: $ver)") - fi + STEPMAKE_CHECK_VERSION(GUILE_CONFIG, $1, $2) fi AC_SUBST(GUILE_CONFIG) @@ -390,35 +490,28 @@ AC_DEFUN(STEPMAKE_GUILE_DEVEL, [ changequote(<<, >>)dnl GUILE_MAJOR_VERSION=`expr $guile_version : '\([0-9]*\)'` GUILE_MINOR_VERSION=`expr $guile_version : '[0-9]*\.\([0-9]*\)'` + GUILE_PATCH_LEVEL=`expr $guile_version : '[0-9]*\.[0-9]*\.\([0-9]*\)'` changequote([, ])dnl STEPMAKE_GUILE_FLAGS AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, $GUILE_MAJOR_VERSION) AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, $GUILE_MINOR_VERSION) + AC_DEFINE_UNQUOTED(GUILE_PATCH_LEVEL, $GUILE_PATCH_LEVEL) ]) AC_DEFUN(STEPMAKE_GXX, [ - AC_MSG_CHECKING("g++ version") - cxx_version=`$CXX --version` - AC_MSG_RESULT("$cxx_version") - changequote(<<, >>)dnl - # urg, egcs: how to check for egcs >= 1.1? - if expr "$cxx_version" : '.*2\.[89]' > /dev/null || - expr "$cxx_version" : '.*egcs' > /dev/null || - expr "$cxx_version" : '3\.[0-9]' > /dev/null - changequote([, ])dnl - then - true + if test "$GXX" = "yes"; then + STEPMAKE_CHECK_VERSION(CXX, $1, $2) else - STEPMAKE_WARN(cannot find g++ 2.8, 2.9, 3.x or egcs 1.1) - STEPMAKE_ADD_ENTRY($1, 'g++ >= 2.95 (gcc package)') + warn="$CXX (Please install *GNU* c++)" + STEPMAKE_ADD_ENTRY($1, $warn) fi ]) - AC_DEFUN(STEPMAKE_INIT, [ + AC_PREREQ(2.50) . $srcdir/VERSION FULL_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL if test x$MY_PATCH_LEVEL != x; then @@ -449,79 +542,69 @@ AC_DEFUN(STEPMAKE_INIT, [ fi AC_MSG_CHECKING(Package) - if test "x$PACKAGE" = "xSTEPMAKE"; then + if test "$PACKAGE" = "STEPMAKE"; then AC_MSG_RESULT(Stepmake package!) AC_MSG_CHECKING(builddir) + + ugh_ugh_autoconf250_builddir="`pwd`" + if test "$srcdir" = "."; then - builddir=. + srcdir_build=yes else - absolute_builddir="`pwd`" - package_absolute_builddir="`dirname $absolute_builddir`" + srcdir_build=no + package_builddir="`dirname $ugh_ugh_autoconf250_builddir`" package_srcdir="`dirname $srcdir`" - builddir="`dirname $package_srcdir`/`basename $package_absolute_builddir`/`basename $absolute_builddir`" fi - AC_MSG_RESULT($builddir) + AC_MSG_RESULT($ugh_ugh_autoconf250_builddir) (cd stepmake 2>/dev/null || mkdir stepmake) (cd stepmake; rm -f bin; ln -s ../$srcdir/bin .) - AC_CONFIG_AUX_DIR(bin) +# only possible with autoconf < 2.50 -- hardcoded in configure.in +# AC_CONFIG_AUX_DIR(bin) stepmake=stepmake else AC_MSG_RESULT($PACKAGE) AC_MSG_CHECKING(builddir) + ugh_ugh_autoconf250_builddir="`pwd`" if test "$srcdir" = "."; then - builddir=. - srcdir_build=no - else - absolute_builddir="`pwd`" -# builddir="`dirname $srcdir`/`basename $absolute_builddir`" - builddir="`bash $srcdir/buildscripts/walk.sh \"$srcdir\"`" srcdir_build=yes + else + srcdir_build=no fi - AC_MSG_RESULT($builddir) - if expr "$srcdir" : '/' > /dev/null 2>&1; then - absolute_srcdir=yes - STEPMAKE_WARN(Absolute --srcdir specified: $srcdir) - fi + AC_MSG_RESULT($ugh_ugh_autoconf250_builddir) AC_MSG_CHECKING(for stepmake) # Check for installed stepmake if test -d $stepmake; then AC_MSG_RESULT($stepmake) else - if test "$absolute_srcdir" != "yes"; then - stepmake='$(depth)'/$srcdir/stepmake - else - stepmake=$srcdir/stepmake - fi - AC_MSG_RESULT($srcdir/stepmake ($datadir/stepmake not found)) + stepmake="`cd $srcdir/stepmake; pwd`" + AC_MSG_RESULT([$srcdir/stepmake ($datadir/stepmake not found)]) fi - AC_CONFIG_AUX_DIR(\ - $HOME/usr/local/share/stepmake/bin\ - $HOME/usr/local/lib/stepmake/bin\ - $HOME/usr/share/stepmake/bin\ - $HOME/usr/lib/stepmake/bin\ - /usr/local/share/stepmake/bin\ - /usr/local/lib/stepmake/bin\ - /usr/share/stepmake/bin\ - /usr/lib/stepmake/bin\ - stepmake/bin\ - $srcdir/stepmake/bin\ - ) - fi - - AC_SUBST(builddir) +# only possible with autoconf < 2.50 -- hardcoded in configure.in +# AC_CONFIG_AUX_DIR(\ +# stepmake/bin\ +# $srcdir/stepmake/bin\ +# ) + fi + + AC_SUBST(ugh_ugh_autoconf250_builddir) AC_SUBST(stepmake) AC_SUBST(package) AC_SUBST(PACKAGE) AC_SUBST(PACKAGE_NAME) - AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE_NAME}") - AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, "${FULL_VERSION}") - - if test "$package_depth" = "" ; then + # We don't need the upper case variant, + # so stick to macros are uppercase convention. + # AC_DEFINE_UNQUOTED(package, ["${package}"]) + # AC_DEFINE_UNQUOTED(PACKAGE, ["${PACKAGE}"]) + AC_DEFINE_UNQUOTED(PACKAGE, ["${package}"]) + AC_DEFINE_UNQUOTED(PACKAGE_NAME, ["${PACKAGE_NAME}"]) + AC_DEFINE_UNQUOTED(TOPLEVEL_VERSION, ["${FULL_VERSION}"]) + + if test -z "$package_depth"; then package_depth="." else package_depth="../$package_depth" @@ -550,23 +633,25 @@ AC_DEFUN(STEPMAKE_INIT, [ STEPMAKE_PROGS(TAR, tar, REQUIRED) - if test "x`uname`" = "xHP-UX"; then - AC_PATH_PROG(BASH, bash, /bin/sh) + if test "$(echo 2)" != "2" || + test "x`uname`" = "xHP-UX"; then + AC_PATH_PROG(KSH, ksh, /bin/ksh) + AC_PATH_PROG(BASH, bash, $KSH) STEPMAKE_WARN(avoiding buggy /bin/sh) - AC_PATH_PROG(SHELL, bash, /bin/ksh) + AC_PATH_PROG(SHELL, bash, $KSH) else - AC_PATH_PROG(BASH, bash, /bin/sh) SHELL=/bin/sh - AC_SUBST(SHELL) + AC_PATH_PROG(BASH, bash, $SHELL) fi + AC_SUBST(SHELL) - STEPMAKE_PATH_PROG(PYTHON, python, REQUIRED) + STEPMAKE_PYTHON(REQUIRED, 1.5) if expr "$MAKE" : '.*\(echo\)' >/dev/null; then $MAKE -v 2> /dev/null | grep GNU > /dev/null if test "$?" = 1; then warn='make (Please install *GNU* make)' - STEPMAKE_WARN($warn) + # STEPMAKE_WARN($warn) STEPMAKE_ADD_ENTRY(REQUIRED, $warn) fi fi @@ -595,17 +680,38 @@ AC_DEFUN(STEPMAKE_INIT, [ AC_SUBST(LN) AC_SUBST(LN_S) AC_SUBST(INSTALL) - AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}') - AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}') - AC_SUBST(PATHSEP) + AC_DEFINE_UNQUOTED(DIRSEP, ['${DIRSEP}']) + AC_DEFINE_UNQUOTED(PATHSEP, ['${PATHSEP}']) AC_SUBST(DIRSEP) + AC_SUBST(PATHSEP) + AC_SUBST(ROOTSEP) STEPMAKE_DATADIR + STEPMAKE_LIBDIR ]) - + AC_DEFUN(STEPMAKE_KPATHSEA, [ - + + AC_ARG_WITH(kpathsea-include, + [ --with-kpathsea-include=DIR + location of the kpathsea include dir],[ + if test "$withval" = "yes" -o "$withval" = "no"; then + AC_MSG_WARN(Usage: --with-kpathsea-include=includedir) + else + CPPFLAGS="$CPPFLAGS -I${withval}" + fi + ]) + + AC_ARG_WITH(kpathsea-lib, + [ --with-kpathsea-lib=DIR location of the kpathsea lib dir],[ + if test "$withval" = "yes" -o "$withval" = "no"; then + AC_MSG_WARN(Usage: --with-kpathsea-lib=libdir) + else + LDFLAGS="$LDFLAGS -L${withval}" + fi + ]) + kpathsea_b=yes #FIXME --with-xxx is meant for specifying a PATH too, # so this should read: --enable-kpathsea, @@ -615,9 +721,19 @@ AC_DEFUN(STEPMAKE_KPATHSEA, [ [kpathsea_b=$with_kpathsea]) if test "$kpathsea_b" != "no"; then - AC_HAVE_HEADERS(kpathsea/kpathsea.h) + AC_CHECK_HEADERS([kpathsea/kpathsea.h]) AC_CHECK_LIB(kpathsea, kpse_find_file) - 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.)) + AC_CHECK_FUNCS(kpse_find_file,,kpathsea_b=no) + if test "$kpathsea_b" = "no"; then + warn='kpathsea (libkpathsea-dev, kpathsea-devel or tetex-devel + package). + Else, please specify the location of your kpathsea using + --with-kpathsea-include and --with-kpathsea-lib options. You should + install kpathsea; see INSTALL.txt. Rerun ./configure + --without-kpathsea only if kpathsea is not available for your + platform.' + STEPMAKE_ADD_ENTRY(REQUIRED, $warn) + fi fi AC_MSG_CHECKING(whether to use kpathsea) if test "$kpathsea_b" != no; then @@ -649,7 +765,7 @@ AC_DEFUN(STEPMAKE_LIBTOOL, [ REVISION=$PATCH_LEVEL # CURRENT=$MINOR_VERSION CURRENT=`expr $MINOR_VERSION + 1` - # AGE=$(expr $MAJOR_VERSION + 1) + # AGE=`expr $MAJOR_VERSION + 1` AGE=$MAJOR_VERSION AC_SUBST(CURRENT) AC_SUBST(REVISION) @@ -740,18 +856,24 @@ AC_DEFUN(STEPMAKE_MSGFMT, [ AC_DEFUN(STEPMAKE_PATH_PROG, [ AC_CHECK_PROGS($1, $2, no) STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3) -# if ! expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then - if test $? -ne 0; then + if test $? -eq 0; then AC_PATH_PROG($1, $2) + if test -n "$4"; then + STEPMAKE_CHECK_VERSION($1, $3, $4) + fi fi ]) # Check for program in set of names ($2), set result to ($1) . # If missing, add entry to missing-list ($3, one of 'OPTIONAL', 'REQUIRED') +# If exists, and a minimal version ($4) is required AC_DEFUN(STEPMAKE_PROGS, [ AC_CHECK_PROGS($1, $2, no) STEPMAKE_OPTIONAL_REQUIRED($1, $2, $3) + if test $? -eq 0 -a -n "$4"; then + STEPMAKE_CHECK_VERSION($1, $3, $4) + fi ]) @@ -760,10 +882,52 @@ AC_DEFUN(STEPMAKE_PERL, [ ]) +AC_DEFUN(STEPMAKE_PYTHON, [ + unset pv + AC_MSG_CHECKING([for python]) + for python in $PYTHON python python2 python2.3 python2.2 python2.1 python2.0; do + AC_MSG_RESULT([$python]) + if ! $python -V > /dev/null 2>&1 ; then + #AC_MSG_WARN([cannot execute $python]) + PYTHON='echo no python' + else + unset pv + STEPMAKE_CHECK_VERSION(python, pv, $2) + if test -z "$pv"; then + PYTHON=$python + break + fi + fi + done + if test -n "$pv"; then + STEPMAKE_ADD_ENTRY($1, $pv) + fi + AC_PATH_PROG(PYTHON, $PYTHON) + AC_SUBST(PYTHON) +]) + AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [ - 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) - if test $? -ne 0; then - STEPMAKE_ADD_ENTRY($1, 'python.h (python-devel, python-dev or libpython-dev package)') + unset PYTHON_HEADER PYTHON_INCLUDE + if test -n "$PYTHON"; then + changequote(<<, >>)dnl + # alternatively, for python >= 2.0 + # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())' + PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'` + changequote([, ])dnl + fi + + ##AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes]) + if test -z "$PYTHON_HEADER"; then + #URG -- how to extend include path? + ac_compile="$ac_compile -I$PYTHON_INCLUDE" + ac_cpp="$ac_cpp -I$PYTHON_INCLUDE" + CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDE" + AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes]) + fi + + if test -z "$PYTHON_HEADER"; then + warn="$PYTHON_INCLUDE/Python.h (python-devel, python-dev or libpython-dev package)" + STEPMAKE_ADD_ENTRY($1, $warn) fi ])