[PATCH] autogen: fix definition of MAXPATHLEN

Pino Toscano <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <2975476.4CGKCPoQhm@drak>
Hi,

attached there is a patch for autogen to fix the definition of
MAXPATHLEN when not defined already (either not directly or because
PATH_MAX is not defined either).

This caused a build failure in sharutils (which embeds the libopts part
of autogen) on GNU/Hurd (which provides no PATH_MAX nor MAXPATHLEN) [1].
This happens because in autogen's autoopts.h there is:
#  if defined(PATH_MAX) && (PATH_MAX > MAXPATHLEN)
which triggers a preprocessor parsing error when MAXPATHLEN is defined
as (size_t)4096.

[1] https://buildd.debian.org/status/fetch.php?pkg=sharutils&arch=hurd-i386&ver=1%3A4.13.5-1&stamp=1381663210

Thanks,
-- 
Pino Toscano
0001-Fix-definition-of-MAXPATHLEN.patch (text/x-patch, 856 B)
From 0dbcbbf3bc754c25c614d25917c15ecb27162eed Mon Sep 17 00:00:00 2001
From: Pino Toscano <[email protected]>
Date: Sun, 13 Oct 2013 19:13:31 +0200
Subject: [PATCH] Fix definition of MAXPATHLEN

Define MAXPATHLEN (if not define already) as simple value, without the cast
to size_t; this makes it possible to use this MAXPATHLEN in comparisons
within preprocessors conditions.

* compat/compat.h [!MAXPATHLEN] (MAXPATHLEN): Define as simple value.
---
 compat/compat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/compat.h b/compat/compat.h
index e7b30ea..ebb3157 100644
--- a/compat/compat.h
+++ b/compat/compat.h
@@ -237,7 +237,7 @@
 #endif
 
 #if !defined (MAXPATHLEN)
-#  define MAXPATHLEN ((size_t)4096)
+#  define MAXPATHLEN 4096
 #endif /* MAXPATHLEN */
 
 #define AG_PATH_MAX  ((size_t)MAXPATHLEN)
-- 
1.8.4.rc3
signature.asc (application/pgp-signature, 190 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iD8DBQBSWtmfTNH2piB/L3oRAqgGAJ9wdVcfPrusgmD4i3W6SNV3K9I+KACeMaiA
89BUKigh3mcxSowCvqqhlu0=
=FnnA
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.