Re: portability of 'printf' command

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

 



On 01/-10/-28163 12:59 PM, Bruno Haible wrote:
> Is the 'printf' command portable enough to be used in configure files
> and autoconf macros?
> 
> The GNU Coding Standards [1] don't mention it as a portable utility. Indeed,
> when you use bash version 1 (which does not have 'printf' built-in) on a
> platform that does not have a /usr/bin/printf program, you would be hosed.
> But which platforms are this? The Autoconf manual [2] does not mention a lack
> of 'printf' anywhere.
> 
> Is someone aware of a platform that does not have a /usr/bin/printf or
> /bin/printf program?

Given that Solaris 8 is about as far back as gnulib currently supports,
I think we are at the point where the known lack of printf(1) in older
Solaris is no longer worth worrying about.  And, given that we document
that awk is safe to use in Makefiles, in spite of its portability
problems, I don't think it is too much of a stretch to support careful
use of printf in portable scripting (the Autoconf manual already does a
good job at documenting considerations to be careful of before using
printf).  So, does this patch seem reasonable?

Index: ChangeLog
===================================================================
RCS file: /sources/gnustandards/gnustandards/ChangeLog,v
retrieving revision 1.108
diff -u -p -r1.108 ChangeLog
--- ChangeLog	28 Mar 2010 00:07:38 -0000	1.108
+++ ChangeLog	5 Apr 2010 19:49:01 -0000
@@ -1,3 +1,7 @@
+2010-04-05  Eric Blake  <eblake@xxxxxxxxxx>
+
+	* make-stds.texi (Utilities in Makefiles): Allow printf.
+
 2010-03-27  Karl Berry  <karl@xxxxxxx>

 	* standards.texi (Graphical Interfaces): Recommend D-Bus
@@ -671,7 +675,8 @@
 	(Copyright Papers): typo - missing verb.


-Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+Foundation, Inc.

 Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
Index: make-stds.texi
===================================================================
RCS file: /sources/gnustandards/gnustandards/make-stds.texi,v
retrieving revision 1.57
diff -u -p -r1.57 make-stds.texi
--- make-stds.texi	23 Feb 2010 14:13:13 -0000	1.57
+++ make-stds.texi	5 Apr 2010 19:49:01 -0000
@@ -160,7 +160,7 @@ installation should not use any utilitie

 @example
 awk cat cmp cp diff echo egrep expr false grep install-info
-ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch tr true
+ln ls mkdir mv printf pwd rm rmdir sed sleep sort tar test touch tr true
 @end example

 Compression programs such as @code{gzip} can be used in the


-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux