X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fforeign.test.sh;h=60f815aafde9eb29b8827ed40943b0a4b934a4e2;hb=079ef9dad558ca07cb8178ef428bf738112174fa;hp=7d207b432e32102d51a14629e02f1ce6825c810c;hpb=5e1fcdac979db9a6aebe69531229355def8c0f90;p=sbcl.git diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index 7d207b4..60f815a 100644 --- a/tests/foreign.test.sh +++ b/tests/foreign.test.sh @@ -26,14 +26,25 @@ testfilestem=${TMPDIR:-/tmp}/sbcl-foreign-test-$$ ## Make a little shared object files to test with. build_so() { - echo building $1.so - cc -c $1.c -o $1.o - ld -shared -o $1.so $1.o + echo building $1.so + if [ $(uname -p) = x86_64 ]; then + CFLAGS="$CFLAGS -fPIC" + fi + if [ $(uname) = Darwin ]; then + SO_FLAGS="-bundle" + else + SO_FLAGS="-shared" + fi + cc -c $1.c -o $1.o $CFLAGS + ld $SO_FLAGS -o $1.so $1.o } echo 'int summish(int x, int y) { return 1 + x + y; }' > $testfilestem.c echo 'int numberish = 42;' >> $testfilestem.c echo 'int nummish(int x) { return numberish + x; }' >> $testfilestem.c +echo 'short negative_short() { return -1; }' >> $testfilestem.c +echo 'int negative_int() { return -2; }' >> $testfilestem.c +echo 'long negative_long() { return -3; }' >> $testfilestem.c build_so $testfilestem echo 'int foo = 13;' > $testfilestem-b.c @@ -69,6 +80,10 @@ cat > $testfilestem.def.lisp < $testfilestem.def.lisp < $testfilestem.test.lisp <