New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
[pspp] / modules / getopt-posix
index b36ed1e33bdfbde20f1d272ee247aababac6c025..63bc6c4e253c79124c9047c6cbd47ddbd192e432 100644 (file)
@@ -12,6 +12,8 @@ Depends-on:
 gettext-h
 unistd
 extensions
+include_next
+arg-nonnull
 
 configure.ac:
 gl_FUNC_GETOPT_POSIX
@@ -21,10 +23,17 @@ BUILT_SOURCES += $(GETOPT_H)
 
 # We need the following in order to create <getopt.h> when the system
 # doesn't have one that works with the given compiler.
-getopt.h: getopt.in.h
+getopt.h: getopt.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         cat $(srcdir)/getopt.in.h; \
-       } > $@-t
+         sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
+             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             < $(srcdir)/getopt.in.h; \
+       } > $@-t && \
        mv -f $@-t $@
 MOSTLYCLEANFILES += getopt.h getopt.h-t