ACLOCAL_AMFLAGS = -I m4
-AM_CPPFLAGS = -I$(top_srcdir)/src
+AM_CPPFLAGS = -I$(top_srcdir)/src $(STUB_INCLUDES)
check_LIBRARIES = t/libdummy.a t/libempty.a
t_packtestu64_SOURCES = t/packtestu64.c src/pack.c src/tap.c
t_packtests64_SOURCES = t/packtests64.c src/pack.c src/tap.c
-if HAVE_STRUCT_OPTION
check_PROGRAMS += t/helpdesc t/helpopt t/helpopt2
-
if HAVE_WCWIDTH
check_PROGRAMS += t/helpopt3
endif
-endif
EXTRA_LIBRARIES = libglohelp.a
libglohelp_a_SOURCES = src/help.c
-libglohelp_a_CPPFLAGS = -DHELP_GETOPT_LONG_ONLY
+libglohelp_a_CPPFLAGS = $(AM_CPPFLAGS) -DHELP_GETOPT_LONG_ONLY
libglohelp_a_SHORTNAME = glo
EXTRA_LIBRARIES += libnlshelp.a
libnlshelp_a_SOURCES = src/help.c t/nls/mbswidth.c
-libnlshelp_a_CPPFLAGS = -DENABLE_NLS -I$(top_srcdir)/t/nls
+libnlshelp_a_CPPFLAGS = $(AM_CPPFLAGS) -DENABLE_NLS -I$(top_srcdir)/t/nls
libnlshelp_a_SHORTNAME = nls
t_helpdesc_SOURCES = t/helpdesc.c src/help.c src/tap.c
EXTRA_LIBRARIES += libnlscopysym.a
libnlscopysym_a_SOURCES = src/copysym.c
-libnlscopysym_a_CPPFLAGS = -DENABLE_NLS
+libnlscopysym_a_CPPFLAGS = $(AM_CPPFLAGS) -DENABLE_NLS
libnlscopysym_a_SHORTNAME = nls
DISTCLEANFILES =
DX_INIT([.])
AC_USE_SYSTEM_EXTENSIONS
+AC_C_INLINE
+
+AC_SUBST([STUB_INCLUDES], [@&t@])
+
AC_CHECK_FUNCS_ONCE([wcwidth])
AM_CONDITIONAL([HAVE_WCWIDTH], [test x"$ac_cv_func_wcwidth" = x"yes"])
[[struct option opt = { "aaaa", 2, (void *)0, 'a' };
return opt.name[opt.flag ? opt.val : opt.has_arg];]])],
[dx_cv_have_struct_option=yes], [dx_cv_have_struct_option=no])])
+AS_IF([test x"$dx_cv_have_struct_option" != x"yes"],
+ [AS_VAR_APPEND([STUB_INCLUDES], ['-I${top_srcdir}/t/getopt'])])
+
AM_CONDITIONAL([HAVE_STRUCT_OPTION],
[test x"$dx_cv_have_struct_option" = x"yes"])
--- /dev/null
+/*
+ * Copyright © 2023 Nick Bowler
+ *
+ * Stub getopt.h for test purposes.
+ *
+ * License WTFPL2: Do What The Fuck You Want To Public License, version 2.
+ * This is free software: you are free to do what the fuck you want to.
+ * There is NO WARRANTY, to the extent permitted by law.
+ */
+
+#ifndef TEST_GETOPT_H_
+#define TEST_GETOPT_H_
+
+struct option {
+ const char *name;
+ int has_arg;
+ int *flag;
+ int val;
+};
+
+#endif