#!/bin/sh # Just a simple handwritten configure rm -f config.mk host='' while [ "$#" -gt 0 ]; do case "$1" in --host=*) host="`echo "$1" | sed -e 's/--host=//'`";; esac shift done printf 'Checking for a C compiler... ' if [ "x$CC" = "x" -a "x$host" != "x" ]; then if which "${host}-cc" > /dev/null 2> /dev/null; then CC="${host}-cc" elif which "${host}-gcc" > /dev/null 2> /dev/null; then CC="${host}-gcc" elif which "${host}-clang" > /dev/null 2> /dev/null; then CC="${host}-clang" fi fi if [ "x$CC" = "x" ]; then if which cc > /dev/null 2> /dev/null; then CC=cc elif which gcc > /dev/null 2> /dev/null; then CC=gcc elif which clang > /dev/null 2> /dev/null; then CC=clang fi fi if [ "x$CC" = "x" ]; then echo "None found"; exit 1; fi echo "$CC" echo "CC=$CC" >> config.mk printf 'Checking if we need -liconv for iconv... ' echo '#include ' > iconvtest.c echo 'int main(){iconv_t x=iconv_open("a","b");return 0;}' >> iconvtest.c if ! "$CC" iconvtest.c -o iconvtest > /dev/null 2> /dev/null; then echo 'LIBS+=-liconv' >> config.mk echo yes else echo no fi rm -f iconvtest iconvtest.c echo Done