libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

do not use unchecked printf (was: [ISC-Bugs #16157])


From: Ralf Wildenhues
Subject: do not use unchecked printf (was: [ISC-Bugs #16157])
Date: Sat, 24 Jun 2006 07:01:18 +0200
User-agent: Mutt/1.5.11+cvs20060403

> * address@hidden wrote on Wed, Jun 14, 2006 at 05:44:31PM CEST:
> > Forwarded message:
> > | From: "Mark Andrews via RT" <address@hidden>

> >     This is to report the fact that "printf" command is
> >     neither a shell builtin nor a user command in SunOS 4.1.x
> >     (& I suspect other similar OS's as well)
> > 
> >     config.guess: "sparc-sun-sunos4.1.4"
> >     config.guess: "m68k-sun-sunos4.1.1"

I have applied the following patches to HEAD and branch-1-5,
respectively.  There are a couple more printf's in libtool.m4,
but they are in system-specific branches only; and for cross-
compilation, Libtool assumes a better $build than $host system.

Cheers,
Ralf

        * libtool.m4 (_LT_COMPILER_BOILERPLATE, _LT_LINKER_BOILERPLATE):
        Rewrite to not use unchecked `printf', for old systems like
        SunOS 4.1.
        (AC_LIBTOOL_COMPILER_OPTION, AC_LIBTOOL_LINKER_OPTION)
        (AC_LIBTOOL_PROG_CC_C_O, AC_LIBTOOL_PROG_LD_SHLIBS): Likewise.
        (AC_LIBTOOL_LANG_C_CONFIG): Adjust: use literal newlines in
        `lt_simple_compile_test_code' and `lt_simple_link_test_code'.
        (AC_LIBTOOL_LANG_CXX_CONFIG, AC_LIBTOOL_LANG_F77_CONFIG)
        (AC_LIBTOOL_LANG_GCJ_CONFIG, AC_LIBTOOL_LANG_RC_CONFIG):
        Likewise.
        Bug report by Bruce Becker and Mark Andrews.

Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/libtool.m4,v
retrieving revision 1.314.2.158
diff -u -r1.314.2.158 libtool.m4
--- libtool.m4  12 Jun 2006 05:25:26 -0000      1.314.2.158
+++ libtool.m4  14 Jun 2006 17:10:26 -0000
@@ -258,7 +258,7 @@
 # the simple compiler test code.
 AC_DEFUN([_LT_COMPILER_BOILERPLATE],
 [ac_outfile=conftest.$ac_objext
-printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
 eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_compiler_boilerplate=`cat conftest.err`
 $rm conftest*
@@ -271,7 +271,7 @@
 # the simple link test code.
 AC_DEFUN([_LT_LINKER_BOILERPLATE],
 [ac_outfile=conftest.$ac_objext
-printf "$lt_simple_link_test_code" >conftest.$ac_ext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_linker_boilerplate=`cat conftest.err`
 $rm conftest*
@@ -624,7 +624,7 @@
 AC_CACHE_CHECK([$1], [$2],
   [$2=no
   ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
    lt_compiler_flag="$3"
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
@@ -669,7 +669,7 @@
   [$2=no
    save_LDFLAGS="$LDFLAGS"
    LDFLAGS="$LDFLAGS $3"
-   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
      # The linker can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -1035,7 +1035,7 @@
    mkdir conftest
    cd conftest
    mkdir out
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
    lt_compiler_flag="-o out/conftest2.$ac_objext"
    # Insert the option either (1) after the last *FLAGS variable, or
@@ -2675,10 +2675,10 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;\n"
+lt_simple_compile_test_code="int some_variable = 0;"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}\n'
+lt_simple_link_test_code='int main(){return(0);}'
 
 _LT_AC_SYS_COMPILER
 
@@ -2784,10 +2784,10 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;\n"
+lt_simple_compile_test_code="int some_variable = 0;"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n'
+lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_AC_SYS_COMPILER
@@ -3973,10 +3973,17 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code="      program t\n      end\n"
+lt_simple_link_test_code="\
+      program t
+      end
+"
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_AC_SYS_COMPILER
@@ -4055,10 +4062,10 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}\n"
+lt_simple_compile_test_code="class foo {}"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void 
main(String[[]] argv) {}; }\n'
+lt_simple_link_test_code='public class conftest { public static void 
main(String[[]] argv) {}; }'
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_AC_SYS_COMPILER
@@ -4115,7 +4122,7 @@
 _LT_AC_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
 
 # Code to be used in simple link tests
 lt_simple_link_test_code="$lt_simple_compile_test_code"
@@ -6316,7 +6323,7 @@
       # to ld, don't add -lc before -lgcc.
       AC_MSG_CHECKING([whether -lc should be explicitly linked in])
       $rm conftest*
-      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
       if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
         soname=conftest



        * libltdl/m4/libtool.m4 (_LT_COMPILER_BOILERPLATE)
        ( _LT_LINKER_BOILERPLATE): Rewrite to not use unchecked
        `printf', for old systems like SunOS 4.1.
        (_LT_COMPILER_OPTION, _LT_LINKER_OPTION)
        (_LT_COMPILER_C_O, _LT_LINKER_SHLIBS): Likewise.
        (_LT_LANG_C_CONFIG): Adjust: use literal newlines in
        `lt_simple_compile_test_code' and `lt_simple_link_test_code'.
        (_LT_LANG_CXX_CONFIG, _LT_LANG_F77_CONFIG, _LT_LANG_FC_CONFIG)
        (_LT_LANG_GCJ_CONFIG, _LT_LANG_RC_CONFIG): Likewise.
        Bug report by Bruce Becker and Mark Andrews.

Index: libltdl/m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/m4/libtool.m4,v
retrieving revision 1.74
diff -u -r1.74 libtool.m4
--- libltdl/m4/libtool.m4       1 Jun 2006 18:39:24 -0000       1.74
+++ libltdl/m4/libtool.m4       23 Jun 2006 17:07:43 -0000
@@ -852,7 +852,7 @@
 # the simple compiler test code.
 m4_defun([_LT_COMPILER_BOILERPLATE],
 [ac_outfile=conftest.$ac_objext
-printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
 eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_compiler_boilerplate=`cat conftest.err`
 $RM conftest*
@@ -865,7 +865,7 @@
 # the simple link test code.
 m4_defun([_LT_LINKER_BOILERPLATE],
 [ac_outfile=conftest.$ac_objext
-printf "$lt_simple_link_test_code" >conftest.$ac_ext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_linker_boilerplate=`cat conftest.err`
 $RM conftest*
@@ -1256,7 +1256,7 @@
 AC_CACHE_CHECK([$1], [$2],
   [$2=no
    m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
    lt_compiler_flag="$3"
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
@@ -1308,7 +1308,7 @@
   [$2=no
    save_LDFLAGS="$LDFLAGS"
    LDFLAGS="$LDFLAGS $3"
-   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
      # The linker can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -1707,7 +1707,7 @@
    mkdir conftest
    cd conftest
    mkdir out
-   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
    lt_compiler_flag="-o out/conftest2.$ac_objext"
    # Insert the option either (1) after the last *FLAGS variable, or
@@ -4911,7 +4911,7 @@
       # to ld, don't add -lc before -lgcc.
       AC_MSG_CHECKING([whether -lc should be explicitly linked in])
       $RM conftest*
-      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
       if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
         soname=conftest
@@ -5039,10 +5039,10 @@
 _LT_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;\n"
+lt_simple_compile_test_code="int some_variable = 0;"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}\n'
+lt_simple_link_test_code='int main(){return(0);}'
 
 _LT_TAG_COMPILER
 # Save the default compiler, since it gets overwritten when the other
@@ -5174,10 +5174,10 @@
 # and will be corrupted by setting them based on a non-working compiler.
 if test "$_lt_caught_CXX_error" != yes; then
   # Code to be used in simple compile tests
-  lt_simple_compile_test_code="int some_variable = 0;\n"
+  lt_simple_compile_test_code="int some_variable = 0;"
 
   # Code to be used in simple link tests
-  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n'
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
 
   # ltmain only uses $CC for tagged configurations so make sure $CC is set.
   _LT_TAG_COMPILER
@@ -6432,10 +6432,17 @@
 # and will be corrupted by setting them based on a non-working compiler.
 if test "$_lt_disable_F77" != yes; then
   # Code to be used in simple compile tests
-  lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
 
   # Code to be used in simple link tests
-  lt_simple_link_test_code="      program t\n      end\n"
+  lt_simple_link_test_code="\
+      program t
+      end
+"
 
   # ltmain only uses $CC for tagged configurations so make sure $CC is set.
   _LT_TAG_COMPILER
@@ -6566,10 +6573,17 @@
 # and will be corrupted by setting them based on a non-working compiler.
 if test "$_lt_disable_FC" != yes; then
   # Code to be used in simple compile tests
-  lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
 
   # Code to be used in simple link tests
-  lt_simple_link_test_code="      program t\n      end\n"
+  lt_simple_link_test_code="\
+      program t
+      end
+"
 
   # ltmain only uses $CC for tagged configurations so make sure $CC is set.
   _LT_TAG_COMPILER
@@ -6657,10 +6671,10 @@
 _LT_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}\n"
+lt_simple_compile_test_code="class foo {}"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void 
main(String[[]] argv) {}; }\n'
+lt_simple_link_test_code='public class conftest { public static void 
main(String[[]] argv) {}; }'
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_TAG_COMPILER
@@ -6719,7 +6733,7 @@
 _LT_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
 
 # Code to be used in simple link tests
 lt_simple_link_test_code="$lt_simple_compile_test_code"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]