Source

moo-poelzi / mingw-configure

Full commit
#!/bin/sh

PKG_CONFIG_PROGRAM=${PKG_CONFIG_PROGRAM:-/usr/bin/pkg-config}
MINGW_TOOL_PREFIX=${MINGW_TOOL_PREFIX:-/usr/bin/i586-mingw32msvc}

############################################################################
# pkg-config

if [ x`basename $0` = xfake-pkg-config ]; then
    if [ "x$1" = "x--atleast-pkgconfig-version" ]; then
        exec $PKG_CONFIG_PROGRAM --atleast-pkgconfig-version $2
    else
        if [ "x$2" = "xpygtk-2.0" -o "x$2" = "xpygobject-2.0" -o \
             "x$3" = "xpygtk-2.0" -o "x$3" = "xpygobject-2.0" ];
        then
            prefix=$PYTHON_PREFIX
        else
            prefix=$GTK_PREFIX
        fi

        exec $PKG_CONFIG_PROGRAM --define-variable=prefix=$prefix $*
    fi
fi

############################################################################

export GTK_PREFIX=${GTK_PREFIX:-/usr/local/win/gtk}

if [ "x$1" = "x--with-python=2.4" -o "x$2" = "x--with-python=2.4" ]; then
    export PYTHON_PREFIX=${PYTHON_PREFIX:-/usr/local/win/Python24}
else
    export PYTHON_PREFIX=${PYTHON_PREFIX:-/usr/local/win/Python23}
fi

export PKG_CONFIG_LIBDIR=$GTK_PREFIX/lib/pkgconfig:$PYTHON_PREFIX/Lib/pkgconfig

if [ x$CONFIGURE = x ]; then
    CONFIGURE="configure"
    if [ ! -e $CONFIGURE ]; then
        CONFIGURE=`dirname $0`/configure
    fi
    if [ ! -e $CONFIGURE ]; then
        echo "Can't find configure script"
        exit 1
    fi
    configure_dir=`dirname "$CONFIGURE"`
    configure_dir=`cd "$configure_dir" && pwd`
    CONFIGURE="$configure_dir"/configure
fi

export ADDR2LINE="$MINGW_TOOL_PREFIX-addr2line"
export AR="$MINGW_TOOL_PREFIX-ar"
export AS="$MINGW_TOOL_PREFIX-as"
export CC="$MINGW_TOOL_PREFIX-gcc"
export CPP="$MINGW_TOOL_PREFIX-cpp"
export CPPFILT="$MINGW_TOOL_PREFIX-c++filt"
export CXX="$MINGW_TOOL_PREFIX-g++"
export DLLTOOL="$MINGW_TOOL_PREFIX-dlltool"
export DLLWRAP="$MINGW_TOOL_PREFIX-dllwrap"
export GCOV="$MINGW_TOOL_PREFIX-gcov"
export LD="$MINGW_TOOL_PREFIX-ld"
export NM="$MINGW_TOOL_PREFIX-nm"
export OBJCOPY="$MINGW_TOOL_PREFIX-objcopy"
export OBJDUMP="$MINGW_TOOL_PREFIX-objdump"
export RANLIB="$MINGW_TOOL_PREFIX-ranlib"
export READELF="$MINGW_TOOL_PREFIX-readelf"
export SIZE="$MINGW_TOOL_PREFIX-size"
export STRINGS="$MINGW_TOOL_PREFIX-strings"
export STRIP="$MINGW_TOOL_PREFIX-strip"
export WINDRES="$MINGW_TOOL_PREFIX-windres"

export CPATH=$GTK_PREFIX/include
export LDFLAGS="-L$GTK_PREFIX/lib $LDFLAGS"
export CFLAGS="${CFLAGS:-"-O2 -g"} -I$GTK_PREFIX/include -mms-bitfields -march=i686"
export CXXFLAGS="${CFLAGS:-"-O2 -g"} -I$GTK_PREFIX/include -mms-bitfields -march=i686"

export PATH=$MINGW_BIN:/usr/i586-mingw32msvc/bin:/usr/local/mingw32/bin:$PATH

if [ -L fake-pkg-config ]; then
    rm fake-pkg-config
fi
ln -s $0 fake-pkg-config
export PKG_CONFIG="./fake-pkg-config"

TARGET=i586-pc-mingw32msvc

exec sh $CONFIGURE --target=$TARGET --host=$TARGET --enable-all-gcc-warnings $*