2008/6/6 Mark Brown <[EMAIL PROTECTED]>:
> On Fri, Jun 06, 2008 at 06:53:31PM +0300, Marko Lindqvist wrote:
>
>> -  SFLAGS="${CFLAGS-"-O3"} -fPIC"
>> +  SFLAGS="${CFLAGS-"-O3"}"
>> +
>> +  if ! $CC -c $CFLAGS -fPIC $test.c 2>&1 |
>> +       grep "all code is position independent" >/dev/null
>> +  then
>> +    SFLAGS="$SFLAGS -fPIC"
>> +  fi
>
> This patch is too specific to current toolchains and a specific locale
> at the minute - it'll be too fragile going forward.  If you can come up
> with a test for this that checks for the feature more directly that
> would be much better.

 This patch goes against more fundamental problem in zlib configure -
determining compile success/failure from compiler output and not from
compiler return value. This fixes above fPIC warning problem, and is
more robust against similar future problems.


 - ML
diff -Nurd zlib/configure zlib/configure
--- zlib/configure	2008-07-13 01:40:19.000000000 +0300
+++ zlib/configure	2008-07-13 01:43:22.000000000 +0300
@@ -190,8 +190,8 @@
 if test $shared -eq 1; then
   echo Checking for shared library support...
   # we must test in two steps (cc then ld), required at least on SunOS 4.x
-  if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
-     test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
+  if $CC -c $SFLAGS $test.c >/dev/null 2>&1 &&
+     $LDSHARED -o $test$shared_ext $test.o >/dev/null 2>&1 ; then
     LIBS="$LIBS $SHAREDLIBV"
     echo Building shared library $SHAREDLIBV with $CC.
   elif test -z "$old_cc" -a -z "$old_cflags"; then
@@ -228,7 +228,7 @@
 #include <sys/types.h>
 off64_t dummy = 0;
 EOF
-if test "`($CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c) 2>&1`" = ""; then
+if $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c >/dev/null 2>&1 ; then
   CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
   SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
   echo "Checking for off64_t... Yes."
@@ -242,7 +242,7 @@
   return 0;
 }
 EOF
-  if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
+  if $CC $CFLAGS -o $test $test.c >/dev/null 2>&1 ; then
     echo "Checking for fseeko... Yes."
   else
     CFLAGS="${CFLAGS} -DNO_FSEEKO"
@@ -255,7 +255,7 @@
 #include <unistd.h>
 int main() { return 0; }
 EOF
-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+if $CC -c $CFLAGS $test.c >/dev/null 2>&1 ; then
   cat >> zlibdefs.h <<EOF
 #include <sys/types.h>	/* for off_t */
 #include <unistd.h>	/* for SEEK_* and off_t */
@@ -292,7 +292,7 @@
 }
 EOF
 
-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+if $CC -c $CFLAGS $test.c >/dev/null 2>&1 ; then
   echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()."
 
   cat > $test.c <<EOF
@@ -316,7 +316,7 @@
 }
 EOF
 
-  if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
+  if $CC $CFLAGS -o $test $test.c >/dev/null 2>&1 ; then
     echo "Checking for vsnprintf() in stdio.h... Yes."
 
     cat >$test.c <<EOF
@@ -341,7 +341,7 @@
 }
 EOF
 
-    if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+    if $CC -c $CFLAGS $test.c >/dev/null 2>&1 ; then
       echo "Checking for return value of vsnprintf()... Yes."
     else
       CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
@@ -379,7 +379,7 @@
 }
 EOF
 
-    if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+    if $CC -c $CFLAGS $test.c >/dev/null 2>&1 ; then
       echo "Checking for return value of vsprintf()... Yes."
     else
       CFLAGS="$CFLAGS -DHAS_vsprintf_void"
@@ -409,7 +409,7 @@
 }
 EOF
 
-  if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
+  if $CC $CFLAGS -o $test $test.c >/dev/null 2>&1 ; then
     echo "Checking for snprintf() in stdio.h... Yes."
 
     cat >$test.c <<EOF
@@ -428,7 +428,7 @@
 }
 EOF
 
-    if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+    if $CC -c $CFLAGS $test.c >/dev/null 2>&1 ; then
       echo "Checking for return value of snprintf()... Yes."
     else
       CFLAGS="$CFLAGS -DHAS_snprintf_void"
@@ -460,7 +460,7 @@
 }
 EOF
 
-    if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+    if $CC -c $CFLAGS $test.c >/dev/null 2>&1 ; then
       echo "Checking for return value of sprintf()... Yes."
     else
       CFLAGS="$CFLAGS -DHAS_sprintf_void"
@@ -476,7 +476,7 @@
 #include <errno.h>
 int main() { return 0; }
 EOF
-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+if $CC -c $CFLAGS $test.c >/dev/null 2>&1 ; then
   echo "Checking for errno.h... Yes."
 else
   echo "Checking for errno.h... No."
@@ -491,7 +491,7 @@
   return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0);
 }
 EOF
-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+if $CC -c $CFLAGS $test.c >/dev/null 2>&1 ; then
   CFLAGS="$CFLAGS -DUSE_MMAP"
   echo Checking for mmap support... Yes.
 else

Reply via email to