diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
commit | 16cbf3c076a0aca6d47adaf3f719493674cf2363 (patch) | |
tree | e6530480020f62a2bdbf249988ec3e2a751d3927 /auto/feature | |
download | unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.gz unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.bz2 |
Initial version.
Diffstat (limited to 'auto/feature')
-rw-r--r-- | auto/feature | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/auto/feature b/auto/feature new file mode 100644 index 00000000..f7e7f25d --- /dev/null +++ b/auto/feature @@ -0,0 +1,112 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) NGINX, Inc. + + +$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 + $echo >> $NXT_AUTOCONF_ERR + nxt_found=yes + nxt_feature_value=`$NXT_AUTOTEST` + $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 + $echo " not found" + fi + ;; + + yes) + if /bin/sh -c "($NXT_AUTOTEST)" >> $NXT_AUTOCONF_ERR 2>&1; then + $echo " found" + nxt_found=yes + cat << END >> $NXT_AUTO_CONFIG_H + +#ifndef $nxt_feature_name +#define $nxt_feature_name 1 +#endif + +END + else + $echo " found but is not working" + fi + ;; + + *) + $echo " found" + nxt_found=yes + cat << END >> $NXT_AUTO_CONFIG_H + +#ifndef $nxt_feature_name +#define $nxt_feature_name 1 +#endif + +END + ;; + esac + +else + $echo " not found" + + $echo "----------" >> $NXT_AUTOCONF_ERR + cat $NXT_AUTOTEST.c >> $NXT_AUTOCONF_ERR + $echo "----------" >> $NXT_AUTOCONF_ERR + $echo $nxt_test >> $NXT_AUTOCONF_ERR + $echo "----------" >> $NXT_AUTOCONF_ERR +fi + +rm -rf $NXT_AUTOTEST* |