configure: pass suffix to 'sed -i' command
PATCH 1/1 configure: pass suffix to 'sed -i' command
BSD sed always requires a suffix to be passed when '-i' switch is used. In GNU sed this suffix is optional. Due to this, configure prints the following error when runs on Mac OS X:
sed: 1: "/var/folders/r_/1g8ws8s ...": invalid command code f
--- configure | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
@@ -1968,7 +1968,7 @@ EOF if compile_prog "" "" ; then attr=yes # Older distros have <attr/xattr.h>, and need -lattr: - elif sed -i s,sys/xattr,attr/xattr, $TMPC && compile_prog "" "-lattr" ; then + elif sed -i.bak s,sys/xattr,attr/xattr, $TMPC && compile_prog "" "-lattr" ; then attr=yes LIBS="-lattr $LIBS" libattr=yes
Signature · 1 line
1.7.5.4
Quoted 5 lines · Pavel Borzenkov
configure +0
-0@@ -1968,7 +1968,7 @@ EOF
Quoted 8 lines
if
compile_prog"" "" ; then
attr=yes
# Older distros have <attr/xattr.h>, and need -lattr:
- elif sed -i s,sys/xattr,attr/xattr, $TMPC &&compile_prog"" "-lattr" ; then
+ elif sed -i.bak s,sys/xattr,attr/xattr, $TMPC &&compile_prog"" "-lattr" ; then attr=yes
LIBS="-lattr $LIBS"
libattr=yes
sed -i isn't POSIX; it would be nicer not to use it at all really.
Random idea: how about having the test prog read
#include <stdio.h>
#include <sys/types.h>
#ifdef CONFIG_LIBATTR
#include <attr/xattr.h>
#else
#include <sys/xattr.h>
#endif
int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
and doing
if compile_prog "" "" ; then
attr=yes
# Older distros have <attr/xattr.h>, and need -lattr:
elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
attr=yes
LIBS="-lattr $LIBS"
libattr=yes[etc]
?
(sadly you can't just include qemu-xattr.h in the test program because the include path isn't set for test programs...)
-- PMM
Quoted 16 lines · Peter Maydell
configure EOF · line 1974
Quoted 13 lines · Pavel Borzenkov
configure +1
-1@@ -1968,7 +1968,7 @@ EOF if compile_prog "" "" ; then attr=yes # Older distros have <attr/xattr.h>, and need -lattr: - elif sed -i s,sys/xattr,attr/xattr, $TMPC && compile_prog "" "-lattr" ; then + elif sed -i.bak s,sys/xattr,attr/xattr, $TMPC && compile_prog "" "-lattr" ; then attr=yes LIBS="-lattr $LIBS" libattr=yessed -i isn't POSIX; it would be nicer not to use it at all really.
I was trying to do minimal changes to the code. Do you know sed implementations that do not support '-i'?
Signature · 1 line
Pavel
Quoted 29 lines
Random idea: how about having the test prog read
#include <
stdio.h>
#include <sys/types.h>
#ifdefCONFIG_LIBATTR
#include <attr/xattr.h>
#else
#include <sys/xattr.h>
#endif
int main(void) {getxattr(NULL, NULL, NULL, 0);setxattr(NULL, NULL, NULL, 0, 0); return 0; }and doing
ifcompile_prog"" "" ; then
attr=yes
# Older distros have <attr/xattr.h>, and need -lattr:
elifcompile_prog"-DCONFIG_LIBATTR" "-lattr" ; then
attr=yes
LIBS="-lattr $LIBS"
libattr=yes
[etc]?
(sadly you can't just include
qemu-xattr.hin the test program because the include path isn't set for test programs...)-- PMM
Quoted 5 lines · Pavel Borzenkov
Quoted 1 line · Peter Maydell
sed -i isn't POSIX; it would be nicer not to use it at all really.
I was trying to do minimal changes to the code. Do you know sed implementations that do not support '-i'?
busybox sed supports plain -i but not "-i.bak", for instance.
(admittedly it's not very likely that anybody would be running busybox sed compiling qemu, but if you stick to POSIX you don't have to worry about whether anybody's sed has the extra feature you're trying to use...)
-- PMM