From aff1b479c7b168652bd20305ceed4317d5db6661 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Tue, 12 Sep 2023 20:55:10 +0300 Subject: [PATCH] lib/getopt*.c: Include only HAVE_CONFIG_H is defined. The CMake-based build doesn't use config.h. Up-to-date getopt_long in Gnulib is LGPLv2 so at some point it could be included in XZ Utils too but for now this commit is enough to make CMake-based build possible. --- lib/getopt.c | 4 +++- lib/getopt1.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/getopt.c b/lib/getopt.c index f8fc003d..36c28318 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -21,7 +21,9 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LIBC -# include +# ifdef HAVE_CONFIG_H +# include +# endif #endif #include "getopt.h" diff --git a/lib/getopt1.c b/lib/getopt1.c index da5d5330..ebc46404 100644 --- a/lib/getopt1.c +++ b/lib/getopt1.c @@ -20,7 +20,9 @@ #ifdef _LIBC # include #else -# include +# ifdef HAVE_CONFIG_H +# include +# endif # include "getopt.h" #endif #include "getopt_int.h"