]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
configure: Fix gperf length parameter determination
authorTobias Brunner <tobias@strongswan.org>
Tue, 26 Sep 2017 10:23:36 +0000 (12:23 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 2 Oct 2017 15:21:42 +0000 (17:21 +0200)
gperf is not actually a build dependency as the generated files are
shipped in the tarball.  So the type depends on the gperf version on
the host that ran gperf and created the tarball, which might not be
the same as that on the actual build host, and gperf might not even
be installed there, leaving the type undetermined.

Fixes: e0e43229736a ("configure: Detect type of length parameter for gperf generated function")
12 files changed:
configure.ac
src/libstrongswan/.gitignore
src/libstrongswan/Makefile.am
src/libstrongswan/crypto/proposal/proposal_keywords_static.h.in [moved from src/libstrongswan/crypto/proposal/proposal_keywords_static.h with 94% similarity]
src/starter/.gitignore
src/starter/Makefile.am
src/starter/confread.c
src/starter/keywords.h.in [moved from src/starter/keywords.h with 96% similarity]
src/starter/keywords.txt
src/stroke/.gitignore
src/stroke/Makefile.am
src/stroke/stroke_keywords.h.in [moved from src/stroke/stroke_keywords.h with 97% similarity]

index a03370ef72fec80396a4209c93eecd736c02db29..9b4109f847efce4f96c42e18415f113c73843b24 100644 (file)
@@ -392,7 +392,7 @@ if test -x "$GPERF"; then
                                [AC_MSG_ERROR([unable to determine gperf len type])]
                        )]
                )
-               AC_DEFINE_UNQUOTED([GPERF_LEN_TYPE], [$GPERF_LEN_TYPE], [gperf len type])
+               AC_SUBST(GPERF_LEN_TYPE)
                AC_MSG_RESULT([yes])
        else
                AC_MSG_RESULT([no])
index 46b69ab15cbd1baa229eae3bf98d9ee6d45d8143..1f2695f77dff6b75c22d1cc3507b87058aa47139 100644 (file)
@@ -1,2 +1,2 @@
 oid.[ch]
-proposal_keywords_static.c
+proposal_keywords_static.[ch]
index b4d8452f1c0bda043d46b75564299a405ab82eef..75b1d14acd3b5635a358f32f2a2312e226998b23 100644 (file)
@@ -195,16 +195,19 @@ endif
 EXTRA_DIST = \
 asn1/oid.txt asn1/oid.pl \
 crypto/proposal/proposal_keywords_static.txt \
+crypto/proposal/proposal_keywords_static.h.in \
 plugins/plugin_constructors.py \
 Android.mk
 
 BUILT_SOURCES = \
 $(srcdir)/asn1/oid.c $(srcdir)/asn1/oid.h \
+$(srcdir)/crypto/proposal/proposal_keywords_static.h \
 $(srcdir)/crypto/proposal/proposal_keywords_static.c \
 settings/settings_parser.h
 
 MAINTAINERCLEANFILES = \
 $(srcdir)/asn1/oid.c $(srcdir)/asn1/oid.h \
+$(srcdir)/crypto/proposal/proposal_keywords_static.h \
 $(srcdir)/crypto/proposal/proposal_keywords_static.c
 
 $(srcdir)/asn1/oid.c : $(srcdir)/asn1/oid.pl $(srcdir)/asn1/oid.txt
@@ -215,6 +218,12 @@ $(srcdir)/asn1/oid.h :     $(srcdir)/asn1/oid.pl $(srcdir)/asn1/oid.txt
                $(AM_V_GEN) \
                (cd $(srcdir)/asn1/ && $(PERL) oid.pl)
 
+$(srcdir)/crypto/proposal/proposal_keywords_static.h: $(srcdir)/crypto/proposal/proposal_keywords_static.h.in
+               $(AM_V_GEN) \
+               sed \
+               -e "s:\@GPERF_LEN_TYPE\@:$(GPERF_LEN_TYPE):" \
+               $< > $@
+
 $(srcdir)/crypto/proposal/proposal_keywords_static.c:  $(srcdir)/crypto/proposal/proposal_keywords_static.txt \
                                                                                                                $(srcdir)/crypto/proposal/proposal_keywords_static.h
                $(AM_V_GEN) \
similarity index 94%
rename from src/libstrongswan/crypto/proposal/proposal_keywords_static.h
rename to src/libstrongswan/crypto/proposal/proposal_keywords_static.h.in
index c046fab92e4a68caa5a8c49d0be99ed0657b0071..ee9f7b9da437556752f4c014c04ecc8f3eb6da48 100644 (file)
@@ -19,7 +19,7 @@
 #include "proposal_keywords.h"
 
 const proposal_token_t* proposal_get_token_static(register const char *str,
-                                                                                                 register GPERF_LEN_TYPE len);
+                                                                                                 register @GPERF_LEN_TYPE@ len);
 
 #endif /* PROPOSAL_KEYWORDS_STATIC_H_ */
 
index a370ee5547bc8282a3c8b0d3f1547bce0f712939..23142d9e8e21554b911d1289f58a554d5619a542 100644 (file)
@@ -1,4 +1,5 @@
 starter
+keywords.[ch]
 parser/lexer.c
 parser/parser.[ch]
 parser/parser.output
\ No newline at end of file
index a3c58126e32c3d78952bf30da746d2842e8aa62c..c806e37e10dc07c4181b68d3169631e575fc52b0 100644 (file)
@@ -39,14 +39,20 @@ starter_LDADD = \
        libstarter.la \
        $(SOCKLIB) $(PTHREADLIB) $(ATOMICLIB)
 
-EXTRA_DIST = keywords.txt ipsec.conf ipsec.secrets Android.mk
-MAINTAINERCLEANFILES = keywords.c
-BUILT_SOURCES = keywords.c parser/parser.h
+EXTRA_DIST = keywords.h keywords.txt ipsec.conf ipsec.secrets Android.mk
+MAINTAINERCLEANFILES = keywords.h keywords.c
+BUILT_SOURCES = keywords.h keywords.c parser/parser.h
 
 if USE_LOAD_WARNING
   AM_CPPFLAGS += -DLOAD_WARNING
 endif
 
+keywords.h: $(srcdir)/keywords.h.in
+               $(AM_V_GEN) \
+               sed \
+               -e "s:\@GPERF_LEN_TYPE\@:$(GPERF_LEN_TYPE):" \
+               $< > $@
+
 keywords.c:    $(srcdir)/keywords.txt $(srcdir)/keywords.h
                $(AM_V_GEN) \
                $(GPERF) -m 10 -C -G -D -t < $(srcdir)/keywords.txt > $@
index e78f2a70b288c1e19be12ef51fcba4756f3912ed..b3e942facce9e98606671551912cf8fac5ffeab2 100644 (file)
@@ -45,11 +45,6 @@ static const char esp_defaults[] = "aes128-sha256";
 
 static const char firewall_defaults[] = IPSEC_SCRIPT " _updown iptables";
 
-/**
- * Provided by GPERF
- */
-extern const kw_entry_t *in_word_set(register const char*, register GPERF_LEN_TYPE);
-
 /**
  * Process deprecated keywords
  */
similarity index 96%
rename from src/starter/keywords.h
rename to src/starter/keywords.h.in
index 0cb46a7401c9e5d0179a236f58466e2fe501c0b0..d2b08f2cf7b75f42080b6cee5397a660fca2fb71 100644 (file)
@@ -196,4 +196,8 @@ struct kw_entry_t {
        kw_token_t token;
 };
 
+#ifndef IN_GPERF_GENERATED_FILE
+const kw_entry_t *in_word_set(register const char*, register @GPERF_LEN_TYPE@);
+#endif
+
 #endif /* _KEYWORDS_H_ */
index 3f92dc83f50fc5e264116b612804a567d834817e..dd673bc7a747895e8377f4d813ac9be8c80f2471 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <string.h>
 
+#define IN_GPERF_GENERATED_FILE
 #include "keywords.h"
 
 %}
index 26c37a4a8382cb238709cca9130980cd95a3c475..b6bf920c3ea5c72cae797c89f678149c85ddf1dc 100644 (file)
@@ -1 +1,2 @@
 stroke
+stroke_keywords.[ch]
index ed170bd08060ae82a4bab264f518692651d3d031..e55e2030fddb4ac33f0b2311a99796002b00bd90 100644 (file)
@@ -4,13 +4,19 @@ stroke_SOURCES = \
 stroke.c stroke_msg.h stroke_keywords.c stroke_keywords.h
 
 stroke_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la $(SOCKLIB)
-EXTRA_DIST = stroke_keywords.txt Android.mk
-BUILT_SOURCES = stroke_keywords.c
-MAINTAINERCLEANFILES = stroke_keywords.c
+EXTRA_DIST = stroke_keywords.h.in stroke_keywords.txt Android.mk
+BUILT_SOURCES = stroke_keywords.h stroke_keywords.c
+MAINTAINERCLEANFILES = stroke_keywords.h stroke_keywords.c
 AM_CPPFLAGS = \
        -I$(top_srcdir)/src/libstrongswan \
        -DIPSEC_PIDDIR=\"${piddir}\"
 
+stroke_keywords.h: $(srcdir)/stroke_keywords.h.in
+               $(AM_V_GEN) \
+               sed \
+               -e "s:\@GPERF_LEN_TYPE\@:$(GPERF_LEN_TYPE):" \
+               $< > $@
+
 stroke_keywords.c:     $(srcdir)/stroke_keywords.txt $(srcdir)/stroke_keywords.h
                $(AM_V_GEN) \
                $(GPERF) -m 10 -D -C -G -t < $(srcdir)/stroke_keywords.txt > $@
similarity index 97%
rename from src/stroke/stroke_keywords.h
rename to src/stroke/stroke_keywords.h.in
index 51caba68b82767b0ba542dc9f75de672a4155bdf..2b5780adc6bd861a32c9e2f9c87b59551afd79b6 100644 (file)
@@ -73,6 +73,7 @@ typedef enum {
 
 typedef struct stroke_token stroke_token_t;
 
-extern const stroke_token_t* in_word_set(register const char *str, register GPERF_LEN_TYPE len);
+extern const stroke_token_t* in_word_set(register const char *str,
+                                                                                register @GPERF_LEN_TYPE@ len);
 
 #endif /* _STROKE_KEYWORDS_H_ */