[patch] ifile compilation with non-GCC compilers

Lubomir Sedlacik <[email protected]> Fri, 25 Jul 2003 17:40:10 +0200
Newsgroups gmane.mail.ifile.devel
Message-ID <[email protected]>
--===============1015601646==
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="zx4FCpZtqtKETZ7O"
Content-Disposition: inline


--zx4FCpZtqtKETZ7O
Content-Type: multipart/mixed; boundary="ew6BAiZeqk4r7MaW"
Content-Disposition: inline


--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

hi,

argp part of ifile uses __attribute__ GCC-ism which is wrapped by
CONSTRUCTOR_FAILS definition but there is no test for it so the
compilation fails.

attached is a patch (against ifile cvs) for configure.ac and
argp/configure.in which adds this test (configure regen needed).
i committed this patch to NetBSD's pkgsrc ifile package (to make it
compile with Sun C on Solaris) but there are alternative ways of fixing
this issue:

- add proposed check to configure.  benefit: no changes to the actual
  code needed.

- add proposed check only to argp/configure and add the following test
  to argp/argp.h:

  #ifndef __GNUC__
  #define __attribute__(x)  /* empty */
  #endif

  this has the benefit of changing only argp part of ifile (since argp.h
  is included from opts.c) but is less clear.

- remove CONSTRUCTOR_FAILS checks from argp code and add the above check
  for __GNUC__ where appropriate.  this seems to be the clearest way for
  me but requires more changes to argp code.

choose whatever you feel is the best for ifile :).


regards,

[ please keep me on CC: in replies, i am not subscribed.  thanks ]

--=20
-- Lubomir Sedlacik <[email protected]>                   --
--                  <[email protected]>                   --
--                  <[email protected]>                    --

--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="attr.diff"
Content-Transfer-Encoding: quoted-printable

Index: configure.ac
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/ifile/ifile/configure.ac,v
retrieving revision 1.2
diff -u -r1.2 configure.ac
--- configure.ac	13 Feb 2003 17:46:14 -0000	1.2
+++ configure.ac	25 Jul 2003 15:13:54 -0000
@@ -16,6 +16,11 @@
 # Find the compiler
 AC_PROG_CC
=20
+# Avoid using GCC __attributes__ for non-GCC compilers
+if test -z "$GCC" ; then
+  CFLAGS=3D"-DCONSTRUCTOR_FAILS=3D1 $CFLAGS"
+fi
+
 # Find some installation programs
 AC_PROG_INSTALL
 AC_PROG_RANLIB
Index: argp/configure.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/ifile/ifile/argp/configure.in,v
retrieving revision 1.3
diff -u -r1.3 configure.in
--- argp/configure.in	13 Feb 2003 17:46:14 -0000	1.3
+++ argp/configure.in	25 Jul 2003 15:13:54 -0000
@@ -18,6 +18,11 @@
 AC_PROG_CC
 AC_PROG_CPP
=20
+# Avoid using GCC __attributes__ for non-GCC compilers
+if test -z "$GCC" ; then
+  CFLAGS=3D"-DCONSTRUCTOR_FAILS=3D1 $CFLAGS"
+fi
+
 # Find some installation programs
 AC_PROG_INSTALL
 AC_PROG_RANLIB

--ew6BAiZeqk4r7MaW--

--zx4FCpZtqtKETZ7O
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (NetBSD)

iD8DBQE/IU9aiwjDDlS8cmMRAnjpAJ4nuK01EsbNzv5MU+UkfK6a3xg/bwCdGa74
o+dAyIuJytEp4cOZ6qnQX58=
=YNOt
-----END PGP SIGNATURE-----

--zx4FCpZtqtKETZ7O--



--===============1015601646==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ifile-dev mailing list
[email protected]
http://mail.nongnu.org/mailman/listinfo/ifile-dev

--===============1015601646==--