lzo: update to 2.09
[tomato.git] / release / src / router / lzo / B / generic / build.sh
blobe71a98d2c248732f695ef1d26f0fb7c1ccb91b34
1 #! /bin/sh
2 ## vim:set ts=4 sw=4 et:
3 set -e
4 echo "// Copyright (C) 1996-2015 Markus F.X.J. Oberhumer"
5 echo "//"
6 echo "// Generic Posix/Unix system"
7 echo "// Generic C compiler"
9 test "X${top_srcdir}" = X && top_srcdir=`echo "$0" | sed 's,[^/]*$,,'`../..
11 test "X${AR}" = X && AR="ar"
12 test "X${CC}" = X && CC="cc"
13 test "X${CFLAGS+set}" = Xset || CFLAGS="-O"
14 # CPPFLAGS, LDFLAGS, LIBS
15 # LZO_EXTRA_CPPFLAGS, LZO_EXTRA_CFLAGS, LZO_EXTRA_LDFLAGS
16 # LZO_EXTRA_SOURCES, LZO_EXTRA_OBJECTS, LZO_EXTRA_LIBS
18 CFI="-I${top_srcdir}/include -I${top_srcdir} -I${top_srcdir}/src"
19 BNAME=lzo2
20 BLIB=lib${BNAME}.a
22 CF="$CPPFLAGS $CFI $CFLAGS"
23 # info: we restrict ourselves to pure ANSI C library functions for the examples
24 CF="-DLZO_LIBC_ISOC90=1 $CF"
25 # info: we do not use _any_ external functions in freestanding mode
26 test -z "$LZO_CFG_FREESTANDING" || CF="-DLZO_CFG_FREESTANDING=1 $CF"
27 LF="$LDFLAGS $LZO_EXTRA_LDFLAGS"
28 LL="$BLIB $LIBS $LZO_EXTRA_LIBS"
30 . $top_srcdir/B/generic/clean.sh
32 for f in $top_srcdir/src/*.c $LZO_EXTRA_SOURCES; do
33 echo $CC $CF $LZO_EXTRA_CPPFLAGS $LZO_EXTRA_CFLAGS -c $f
34 $CC $CF $LZO_EXTRA_CPPFLAGS $LZO_EXTRA_CFLAGS -c $f
35 done
37 echo $AR rcs $BLIB *.o $LZO_EXTRA_OBJECTS
38 $AR rcs $BLIB *.o $LZO_EXTRA_OBJECTS
41 if test -n "$LZO_CFG_FREESTANDING"; then
43 echo "//"
44 echo "// Building $BLIB in freestanding mode was successful. All done."
45 echo "// Now try 'nm --extern-only $BLIB'"
47 else
49 for f in dict lzopack precomp precomp2 simple; do
50 echo $CC $CF $LF -o $f.out $top_srcdir/examples/$f.c $LL
51 $CC $CF $LF -o $f.out $top_srcdir/examples/$f.c $LL
52 done
53 echo $CC $CF $LF -o lzotest.out $top_srcdir/lzotest/lzotest.c $LL
54 $CC $CF $LF -o lzotest.out $top_srcdir/lzotest/lzotest.c $LL
56 for f in minilzo.c testmini.c; do
57 XF="-I$top_srcdir/include/lzo $CF $LZO_EXTRA_CPPFLAGS $LZO_EXTRA_CFLAGS"
58 echo $CC $XF -c $top_srcdir/minilzo/$f
59 $CC $XF -c $top_srcdir/minilzo/$f
60 done
61 echo $CC $CF $LF -o testmini.out testmini.o minilzo.o $LIBS $LZO_EXTRA_LIBS
62 $CC $CF $LF -o testmini.out testmini.o minilzo.o $LIBS $LZO_EXTRA_LIBS
65 echo "//"
66 echo "// Building LZO was successful. All done."
69 true