#!/bin/sh
#set -e

. $KUMATUXBIN/kumatux.org-vars

KUMATUX_LDFLAGS_ESCAPED=`$KUMATUXBIN/kumatux.org-sed-escape $KUMATUX_LDFLAGS`
if [ "$KUMATUX_LDFLAGS_ESCAPED" ]
then
    SYSTEM_LDFLAGS=`echo $LDFLAGS | sed "s/$KUMATUX_LDFLAGS_ESCAPED//"`
else
    SYSTEM_LDFLAGS=$LDFLAGS
fi

FLAGS=""
for FILE in $KUMATUXETC/$KUMATUXETCLDFLAGS/*.conf
do
    if [ "`cat $FILE 2>/dev/null`" ]
    then
        FLAGSNEW="-L`cat $FILE 2>/dev/null` $FLAGS"
	FLAGS="$FLAGSNEW"
    fi
done
export KUMATUX_LDFLAGS="$FLAGS -L/usr/lib"
export LDFLAGS="$KUMATUX_LDFLAGS $SYSTEM_LDFLAGS"
