blob: 73886f38fb7e74352266983a77a94fc5ee622731 [file] [log] [blame]
# Copyright (C) Igor Sysoev
# Copyright (C) NGINX, Inc.
$nxt_echo -n "checking for $nxt_feature ..."
cat << END >> $NXT_AUTOCONF_ERR
----------------------------------------
checking for $nxt_feature
END
nxt_found=no
nxt_feature_value=
nxt_feature_inc_path=
if test -n "$nxt_feature_incs"; then
case "$nxt_feature_incs" in
-*)
nxt_feature_inc_path="$nxt_feature_incs"
;;
*)
for nxt_temp in $nxt_feature_incs; do
nxt_feature_inc_path="$nxt_feature_inc_path -I $nxt_temp"
done
;;
esac
fi
cat << END > $NXT_AUTOTEST.c
$nxt_feature_test
END
nxt_test="$CC $CFLAGS $NXT_CFLAGS $NXT_CC_OPT $NXT_TEST_CFLAGS \
$nxt_feature_inc_path -o $NXT_AUTOTEST $NXT_AUTOTEST.c \
$NXT_LD_OPT $NXT_TEST_LIBS $nxt_feature_libs"
# /bin/sh -c "(...)" is to intercept "Killed", "Abort trap",
# "Segmentation fault", or other shell messages.
# "|| true" is to bypass "set -e" setting.
/bin/sh -c "($nxt_test || true)" >> $NXT_AUTOCONF_ERR 2>&1
if [ -x $NXT_AUTOTEST ]; then
case "$nxt_feature_run" in
value)
if /bin/sh -c "($NXT_AUTOTEST)" >> $NXT_AUTOCONF_ERR 2>&1; then
$nxt_echo >> $NXT_AUTOCONF_ERR
nxt_found=yes
nxt_feature_value=`$NXT_AUTOTEST`
$nxt_echo " $nxt_feature_value"
if [ -n "$nxt_feature_name" ]; then
cat << END >> $NXT_AUTO_CONFIG_H
#ifndef $nxt_feature_name
#define $nxt_feature_name $nxt_feature_value
#endif
END
fi
else
$nxt_echo " not found"
fi
;;
yes)
if /bin/sh -c "($NXT_AUTOTEST)" >> $NXT_AUTOCONF_ERR 2>&1; then
$nxt_echo " found"
nxt_found=yes
cat << END >> $NXT_AUTO_CONFIG_H
#ifndef $nxt_feature_name
#define $nxt_feature_name 1
#endif
END
else
$nxt_echo " found but is not working"
fi
;;
*)
$nxt_echo " found"
nxt_found=yes
cat << END >> $NXT_AUTO_CONFIG_H
#ifndef $nxt_feature_name
#define $nxt_feature_name 1
#endif
END
;;
esac
else
$nxt_echo " not found"
$nxt_echo "----------" >> $NXT_AUTOCONF_ERR
cat $NXT_AUTOTEST.c >> $NXT_AUTOCONF_ERR
$nxt_echo "----------" >> $NXT_AUTOCONF_ERR
$nxt_echo $nxt_test >> $NXT_AUTOCONF_ERR
$nxt_echo "----------" >> $NXT_AUTOCONF_ERR
fi
rm -rf $NXT_AUTOTEST*