aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-09-12 20:55:10 +0300
committerLasse Collin <lasse.collin@tukaani.org>2023-09-22 20:06:27 +0300
commitaff1b479c7b168652bd20305ceed4317d5db6661 (patch)
tree2a755daa9212001d9d432212eb6683400d3d124d
parentDoxygen: Add more C macro names to PREDEFINED. (diff)
downloadxz-aff1b479c7b168652bd20305ceed4317d5db6661.tar.xz
lib/getopt*.c: Include <config.h> 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.
-rw-r--r--lib/getopt.c4
-rw-r--r--lib/getopt1.c4
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 <config.h>
+# ifdef HAVE_CONFIG_H
+# include <config.h>
+# 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 <getopt.h>
#else
-# include <config.h>
+# ifdef HAVE_CONFIG_H
+# include <config.h>
+# endif
# include "getopt.h"
#endif
#include "getopt_int.h"