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

Re: Need advice if changes to file_5.04-6 enabling build on GNU/Hurd are OK?



On Tue, 2011-02-08 at 23:48 +0000, Emilio Pozuelo Monfort wrote:
> On 08/02/11 23:35, Svante Signell wrote:
> > On Tue, 2011-02-08 at 14:58 -0800, Roland McGrath wrote:
> >> Many other systems have asprintf, and all GNU systems do.
> >> I doubt there is any Debian variant whose libc lacks it.
> >> For the upstream package, the right approach to portability
> >> is to use an autoconf check for the existence of asprintf.
> >> Likewise for getline.
> > 
> > Thanks you your feedback. I have just started trying to contribute to
> > make more Debian packages building under GNU/Hurd, I'm still on the
> > steep learning curve. Any pointers on how to add checks in autoconf for
> > asprintf and getline?
> 
> AC_CHECK_FUNC. See the autoconf info manual for the exact syntax.

I can add a check for getline in configure, and a check for asprintf was
already present. However I could not change configure.ac since it was
generated by automake-1.10 and 1.11.1 is the current version. Likewise
autoconf-2.62 was used and the current version is 2.67.

Trying with the current tools caused errors even after upgrading the
build files. Also installing automake1.10 was problematic. Creating new
versions of Makefile.in created problems, since at least one patch is
against Makefile.in, not Makefile.am.

Looks like creating new build files using updated autotools is a
separate matter, especially with the need for modifying some of the
previous patches.

The pattern I used for the patch was
+#ifdef __GLIBC__
+       char * subfn;
+#else
+      char subfn[MAXPATHLEN];
+#endif
+       char **filearr = NULL, *mfn;

+#ifdef __GLIBC__
+                 (void)asprintf (&subfn, "%s/%s",
+                                 fn, d->d_name);
+#else
+                 (void)snprintf (subfn, sizeof(subfn), "%s/%s",
+                                 fn, d->d_name);
+#endif

Should I use #ifdef HAVE_ASPRINTF and #ifdef HAVE_GETLIE instead?

What about the header file: file.h?
+#ifdef __GNU__
+/* defines __GLIBC__ */
+#include <features.h>
+/* Defines MAXPATHLEN */
+#else
 #include <sys/param.h>
+#endif



Reply to: