## 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 -1 | awk '{print $NF}'
+ 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:
## Assume, and hunt for, dotted version multiplet.
changequote(<<, >>)dnl
- ("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' | head -1 | \
+ ("$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
])
if test "$num" -lt "$req"; then
STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
fi
+ vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION"
+ eval `echo $vervar=$num`
+## AC_SUBST(`eval echo $vervar`)
])
# Check version of program ($1)
optimise_b=yes
profile_b=no
debug_b=yes
+ pipe_b=yes
AC_ARG_ENABLE(checking,
[ --enable-checking set runtime checks (assert calls). Default: on],
[ --enable-profiling compile with gprof support. Default: off],
[profile_b=$enableval])
+ AC_ARG_ENABLE(pipe,
+ [ --enable-pipe compile with -pipe. Default: on],
+ [pipe_b=$enableval])
if test "$checking_b" = no; then
# ugh
OPTIMIZE="-O2 -finline-functions"
fi
-
if test $profile_b = yes; then
EXTRA_LIBES="-pg"
OPTIMIZE="$OPTIMIZE -pg"
fi
- if test $debug_b = yes; then
+ if test $debug_b = yes; then
OPTIMIZE="$OPTIMIZE -g"
fi
-
-
+
AC_PROG_CC
STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
LD='$(CC)'
AC_SUBST(LD)
+ # If -pipe requested, test if it works and add to CFLAGS.
+ if test "$pipe_b" = yes; then
+ save_cflags="$CFLAGS"
+ CFLAGS="-pipe $CFLAGS";
+ AC_CACHE_CHECK([whether compiler understands -pipe],
+ [stepmake_cflags_pipe],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])],
+ [stepmake_cflags_pipe=yes],
+ [stepmake_cflags_pipe=no]))
+ CFLAGS=$save_cflags
+ if test $stepmake_cflags_pipe = yes; then
+ OPTIMIZE="$OPTIMIZE -pipe"
+ fi
+ fi
+
CFLAGS="$CFLAGS $OPTIMIZE"
CPPFLAGS=${CPPFLAGS-""}
AC_MSG_RESULT([none])
;;
esac
+
AC_SUBST(cross_compiling)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
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$UNSUPPORTED"; then
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_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
+ AC_MSG_WARN([Trying gcc, cross fingers.])
AC_LANG_PUSH(C)
fi
AC_CHECK_LIB(intl, gettext)
if test -n "$pv"; then
STEPMAKE_ADD_ENTRY($1, $pv)
fi
+ AC_PATH_PROG(PYTHON, $PYTHON)
AC_SUBST(PYTHON)
])