portability

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

 



Hi

I have not built master for a while, and now find GNU specific extensions
that are not portable. Since it is not the first time I address them, 
I would like to send a reminder about it:

1) bash-specific syntax
Do not write:
	test $foo == "bar" 
But instead write:
	test $foo = "bar" 

The = operator is POSIX compliant. The == operator works in bash end ksh.

2) GNU sed specific flag
Do not write:
	sed -i 's/foo/bar/' buz
But instead write:
	sed  's/foo/bar/' buz > buz.new && mv buz.new buz

The -i  flags is a GNU extension that is not implemented in BSD sed.

3) GNU make specific syntax
Do not write:
foo.c:	foo.x foo.h
	${RPCGEN} $<
But instead write:
foo.c:	foo.x foo.h
	${RPCGEN} foo.x
Or even:
foo.c:	foo.x foo.h
	${RPCGEN} ${@:.c=.c}

$< does not work everywhere in non GNU make. If I understand 
autoconf doc correctly, it does not work outside of generic rules (.c.o:)


-- 
Emmanuel Dreyfus
manu@xxxxxxxxxx
_______________________________________________
Gluster-devel mailing list
Gluster-devel@xxxxxxxxxxx
http://supercolony.gluster.org/mailman/listinfo/gluster-devel




[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux