Archive-Unzip-Burst
view release on metacpan or search on metacpan
unzip-6.0/unix/configure view on Meta::CPAN
}
_EOF_
# compile it
$CC -o conftest conftest.c >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
echo "-- no Unicode (wchar_t) support"
else
# have wide char support
# run it
./conftest
r=$?
if [ $r -eq 0 ]; then
echo -- no Unicode wchar_t support - wchar_t allocation error
elif [ $r -eq 1 ]; then
echo -- no Unicode support - wchar_t encoding unspecified
elif [ $r -eq 2 ]; then
echo -- have wchar_t with known UCS encoding - enabling Unicode support!
CFLAGSR="${CFLAGSR} -DUNICODE_SUPPORT -DUNICODE_WCHAR"
else
echo "-- no Unicode (wchar_t) support - conftest returned $r"
fi
fi
echo "Check for setlocale support (needed for UNICODE Native check)"
cat > conftest.c << _EOF_
#include <locale.h>
int main()
{
char *loc = setlocale(LC_CTYPE, "");
return 0;
}
_EOF_
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
if [ $? -eq 0 ]; then
echo "-- have setlocale, can check for charset type"
echo "-- - enabling UTF8-native support!"
CFLAGSR="${CFLAGSR} -DUNICODE_SUPPORT -DUTF8_MAYBE_NATIVE"
else
echo "-- no Unicode (UTF-8 native) support!"
CFLAGSR="${CFLAGSR} -DNO_SETLOCALE"
fi
# from configure 2.4i (Onno) 12/5/04
echo Check for gcc no-builtin flag
# -fno-builtin since version 2
cat > conftest.c << _EOF_
int main()
{
#if __GNUC__ >= 2
return 0;
#else
forget it
#endif
}
_EOF_
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
[ $? -eq 0 ] && BFLAG="-fno-builtin"
# Check for missing functions
# add NO_'function_name' to flags if missing
for func in fchmod fchown lchown nl_langinfo
do
echo Check for $func
echo "int main(){ $func(); return 0; }" > conftest.c
$CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
done
# Check (seriously) for a working lchmod.
echo 'Check for lchmod'
temp_file="/tmp/unzip_test_$$"
temp_link="link_$$"
( echo '#include <unistd.h>' ; \
echo "int main() { lchmod(\"${temp_file}\", 0666); }" \
) > conftest.c
ln -s "${temp_link}" "${temp_file}" && \
$CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null && \
./conftest
[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_LCHMOD"
rm -f "${temp_file}"
echo Check for memset
echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
$CC -o conftest conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DZMEM"
echo Check for errno declaration
cat > conftest.c << _EOF_
#include <errno.h>
main()
{
errno = 0;
return 0;
}
_EOF_
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_ERRNO"
echo Check for directory libraries
cat > conftest.c << _EOF_
int main() { return closedir(opendir(".")); }
_EOF_
$CC -o conftest conftest.c >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
OPT=""
for lib in ndir dir ucb bsd BSD PW x dirent
do
$CC -o conftest conftest.c -l$lib >/dev/null 2>/dev/null
[ $? -eq 0 ] && OPT=-l$lib && break
done
if [ ${OPT} ]; then
LFLAGS2="${LFLAGS2} ${OPT}"
else
CFLAGSR="${CFLAGSR} -DNO_DIR"
fi
fi
# Dynix/ptx 1.3 needed this
echo Check for readlink
echo "int main(){ return readlink(); }" > conftest.c
( run in 2.153 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )