#!/bin/sh -e

export CFLAGS="$CFLAGS -static"

./configure \
    --prefix=/usr \
    ac_cv_func_malloc_0_nonnull=yes \
    ac_cv_func_realloc_0_nonnull=yes \
    AR_FLAGS='-r -o'

# We need to work around flex's makefile not working with static directives.

#obj=flex-"buf.o flex-ccl.o flex-dfa.o flex-ecs.o flex-filter.o flex-gen.o flex-main.o flex-misc.o flex-nfa.o flex-options.o flex-parse.o flex-regex.o flex-scanflags.o flex-scanopt.o flex-skel.o flex-sym.o flex-tables.o flex-tables_shared.o flex-tblcmp.o flex-yylex.o flex-stage1scan.o"
#cd src/
#$CC $CFLAGS $LDFLAGS -o flex $obj -lintl -lm
#cd ..

make DESTDIR="$1" install

ln -s flex "$1/usr/bin/lex"
