[PATCH] m4/ptyfuncs.m4 tools/configure: add linux headers for pty functions

Florian Schmaus posted 1 patch 11 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230516091355.721398-1-flo@geekplace.eu
m4/ptyfuncs.m4  | 3 +++
tools/configure | 3 +++
2 files changed, 6 insertions(+)
[PATCH] m4/ptyfuncs.m4 tools/configure: add linux headers for pty functions
Posted by Florian Schmaus 11 months, 3 weeks ago
To avoid implicit function declarations, which will cause an error on
modern compilers. See https://wiki.gentoo.org/wiki/Modern_C_porting

Downstream Gentoo bug: https://bugs.gentoo.org/904449

Signed-off-by: Florian Schmaus <flo@geekplace.eu>
---
 m4/ptyfuncs.m4  | 3 +++
 tools/configure | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/m4/ptyfuncs.m4 b/m4/ptyfuncs.m4
index 3e37b5a23c8b..d1a2208398e3 100644
--- a/m4/ptyfuncs.m4
+++ b/m4/ptyfuncs.m4
@@ -19,6 +19,9 @@ AC_DEFUN([AX_CHECK_PTYFUNCS], [
             AC_LINK_IFELSE([AC_LANG_SOURCE([
 #ifdef INCLUDE_LIBUTIL_H
 #include INCLUDE_LIBUTIL_H
+#else
+#include <pty.h>
+#include <utmp.h>
 #endif
 int main(void) {
   openpty(0,0,0,0,0);
diff --git a/tools/configure b/tools/configure
index 5df30df9b35c..01f57b20c318 100755
--- a/tools/configure
+++ b/tools/configure
@@ -9002,6 +9002,9 @@ See \`config.log' for more details" "$LINENO" 5; }
 
 #ifdef INCLUDE_LIBUTIL_H
 #include INCLUDE_LIBUTIL_H
+#else
+#include <pty.h>
+#include <utmp.h>
 #endif
 int main(void) {
   openpty(0,0,0,0,0);
-- 
2.39.3
Re: [PATCH] m4/ptyfuncs.m4 tools/configure: add linux headers for pty functions
Posted by Andrew Cooper 11 months, 3 weeks ago
On 16/05/2023 10:13 am, Florian Schmaus wrote:
> To avoid implicit function declarations, which will cause an error on
> modern compilers. See https://wiki.gentoo.org/wiki/Modern_C_porting
>
> Downstream Gentoo bug: https://bugs.gentoo.org/904449
>
> Signed-off-by: Florian Schmaus <flo@geekplace.eu>

Thanks for the patch, but there's already a different fix in flight.

Does
https://lore.kernel.org/xen-devel/20230512122614.3724-1-olaf@aepfle.de/
work for you?  If so, we'd definitely prefer to take the deletion of
obsolete functionality.

~Andrew

Re: [PATCH] m4/ptyfuncs.m4 tools/configure: add linux headers for pty functions
Posted by Florian Schmaus 11 months, 3 weeks ago
On 16/05/2023 12.34, Andrew Cooper wrote:
> On 16/05/2023 10:13 am, Florian Schmaus wrote:
>> To avoid implicit function declarations, which will cause an error on
>> modern compilers. See https://wiki.gentoo.org/wiki/Modern_C_porting
>>
>> Downstream Gentoo bug: https://bugs.gentoo.org/904449
>>
>> Signed-off-by: Florian Schmaus <flo@geekplace.eu>
> 
> Thanks for the patch, but there's already a different fix in flight.

Thanks for the fast response pointing out the other patch.

> Does
> https://lore.kernel.org/xen-devel/20230512122614.3724-1-olaf@aepfle.de/
> work for you?  If so, we'd definitely prefer to take the deletion of
> obsolete functionality.

After a quick glance at the patch I believe that it would also achieve 
the same goal, while it is better than my approach.

- Florian