#!/bin/sh

if [ -z "$1" ]; then
    echo ""
    echo "Wrapper script for gcc to build LSB compliant apps. Use by:"
    echo "'export CC=lsbcc' and then running 'make' or 'configure' normally," 
    echo "or call explicitly as you would gcc. ie: 'lsbcc foo.c -o foo'"
    echo ""
    exit 1
fi

if [ -z "$(echo $* | grep '\-c')" ]; then 
    gcc -L/usr/lib/lsb -Xlinker --dynamic-linker -Xlinker /lib/ld-lsb.so.1 -I/usr/include/lsb $*
else
    gcc -L/usr/lib/lsb -I/usr/include/lsb $*
fi
