1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
# Copyright (C) Igor Sysoev
# Copyright (C) NGINX, Inc.
printf "checking for $njs_feature ..."
cat << END >> $NJS_AUTOCONF_ERR
----------------------------------------
checking for $njs_feature
END
njs_found=no
njs_feature_value=
njs_feature_inc_path=
if test -n "$njs_feature_incs"; then
case "$njs_feature_incs" in
-*)
njs_feature_inc_path="$njs_feature_incs"
;;
*)
for njs_temp in $njs_feature_incs; do
njs_feature_inc_path="$njs_feature_inc_path -I $njs_temp"
done
;;
esac
fi
cat << END > $NJS_AUTOTEST.c
$njs_feature_test
END
njs_test="$CC $CFLAGS $NJS_CFLAGS $NJS_CC_OPT $NJS_TEST_CFLAGS \
$njs_feature_inc_path -o $NJS_AUTOTEST $NJS_AUTOTEST.c \
$NJS_LD_OPT $NJS_TEST_LIBS $njs_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 "($njs_test || true)" >> $NJS_AUTOCONF_ERR 2>&1
if [ -x $NJS_AUTOTEST ]; then
case "$njs_feature_run" in
value)
if /bin/sh -c "($NJS_AUTOTEST)" >> $NJS_AUTOCONF_ERR 2>&1; then
echo >> $NJS_AUTOCONF_ERR
njs_found=yes
njs_feature_value=`$NJS_AUTOTEST`
echo " $njs_feature_value"
if [ -n "$njs_feature_name" ]; then
cat << END >> $NJS_AUTO_CONFIG_H
#ifndef $njs_feature_name
#define $njs_feature_name $njs_feature_value
#endif
END
fi
else
echo " not found"
fi
;;
yes)
if /bin/sh -c "($NJS_AUTOTEST)" >> $NJS_AUTOCONF_ERR 2>&1; then
echo " found"
njs_found=yes
cat << END >> $NJS_AUTO_CONFIG_H
#ifndef $njs_feature_name
#define $njs_feature_name 1
#endif
END
else
echo " found but is not working"
fi
;;
*)
echo " found"
njs_found=yes
cat << END >> $NJS_AUTO_CONFIG_H
#ifndef $njs_feature_name
#define $njs_feature_name 1
#endif
END
;;
esac
else
echo " not found"
echo "----------" >> $NJS_AUTOCONF_ERR
cat $NJS_AUTOTEST.c >> $NJS_AUTOCONF_ERR
echo "----------" >> $NJS_AUTOCONF_ERR
echo $njs_test >> $NJS_AUTOCONF_ERR
echo "----------" >> $NJS_AUTOCONF_ERR
fi
rm -rf $NJS_AUTOTEST*
|