From 9db2f8cdbbc0dfb359d3b4e5dfe48c18652ce531 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 8 May 2024 19:02:46 -0700
Subject: [PATCH] configure: Include dirent.h for closedir/opendir APIs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

GCC-14 is strict about function prototypes and since the
testcase tries to compile/link opendir/closedir functions
without including signatures, it fails to build the test
due to missing signatures which come from dirent.h

Therefore include the needed system header and make it more
robust.

Fixes
a.c:2:21: error: implicit declaration of function ‘closedir’ [-Wimplicit-function-declaration]
    2 | int main() { return closedir(opendir(".")); }
      |                     ^~~~~~~~
a.c:2:30: error: implicit declaration of function ‘opendir’ [-Wimplicit-function-declaration]
    2 | int main() { return closedir(opendir(".")); }
      |                              ^~~~~~~

Upstream-Status: Inactive-Upstream
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 unix/configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/unix/configure b/unix/configure
index f917086..1dd98c6 100644
--- a/unix/configure
+++ b/unix/configure
@@ -591,6 +591,7 @@ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
 
 echo Check for directory libraries
 cat > conftest.c << _EOF_
+#include <dirent.h>
 int main() { return closedir(opendir(".")); }
 _EOF_
 
-- 
2.45.0

