diff --git a/configure b/configure index 9b06d2b..828b156 100755 --- a/configure +++ b/configure @@ -162,6 +162,7 @@ printf "checking for C compiler... " trycc ${CROSS_COMPILE}gcc trycc ${CROSS_COMPILE}c99 trycc ${CROSS_COMPILE}cc +trycc ${CROSS_COMPILE}pcc printf "%s\n" "$CC" test -n "$CC" || { echo "$0: cannot find a C compiler" ; exit 1 ; } @@ -219,6 +220,14 @@ tryflag CFLAGS_C99FSE -fexcess-precision=standard \ tryflag CFLAGS_C99FSE -frounding-math # +# Older PCC versions don't define __PIC__ with -fPIC +# +tryflag CFLAG_TEST "-x c" +printf '#ifndef __PIC__\n__PIC__=0\n#endif\n' | \ +$CC -E $CFLAG_TEST -fPIC - | grep __PIC__ && \ +CFLAGS_SHARED_ALL="$CFLAGS_SHARED_ALL -D__PIC__=1" + +# # Setup basic default CFLAGS: debug, optimization, and -pipe # if fnmatch '-O*|*\ -O*' "$CFLAGS_AUTO $CFLAGS" ; then : @@ -269,8 +278,8 @@ tryflag CFLAGS_AUTO -falign-jumps=1 # work anyway (issues with atomic ops). # if test "$ARCH" = "i386" ; then -fnmatch '-march=*|*\ -march=*' "$CFLAGS" || tryflag CFLAGS_AUTO -march=i486 -fnmatch '-mtune=*|*\ -mtune=*' "$CFLAGS" || tryflag CFLAGS_AUTO -mtune=generic +fnmatch '-march=*|*\ -march=*' "$CFLAGS" || tryldflag CFLAGS_AUTO -march=i486 +fnmatch '-mtune=*|*\ -mtune=*' "$CFLAGS" || tryldflag CFLAGS_AUTO -mtune=generic fi if test "x$warnings" = xyes ; then @@ -299,6 +308,7 @@ shared=no # Find compiler runtime library test -z "$LIBCC" && tryldflag LIBCC -lgcc && tryldflag LIBCC -lgcc_eh test -z "$LIBCC" && tryldflag LIBCC -lcompiler_rt +test -z "$LIBCC" && tryldflag LIBCC `$CC -print-file-name=libpcc.a || true` printf "using compiler runtime libraries: %s\n" "$LIBCC" @@ -325,6 +335,7 @@ LDFLAGS = $LDFLAGS_AUTO $LDFLAGS CROSS_COMPILE = $CROSS_COMPILE LIBCC = $LIBCC EOF +test "x$CFLAGS_ALL_SHARED" != x && echo "CFLAGS_ALL_SHARED += $CFLAGS_ALL_SHARED" test "x$static" = xno && echo "STATIC_LIBS =" test "x$shared" = xno && echo "SHARED_LIBS =" test "x$wrapper" = xno && echo "ALL_TOOLS ="