aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2017-09-18 17:57:05 +0200
committerTobias Brunner <tobias@strongswan.org>2017-09-19 13:24:43 +0200
commite0e43229736a84db5af6cb7af9cc2ae03da4c906 (patch)
treef496c2132e700b761b49571254292622a80254bd
parentd4593353c97347fc9505a5a4fe3cfb66b246874f (diff)
downloadstrongswan-e0e43229736a.tar.bz2
strongswan-e0e43229736a.tar.xz
configure: Detect type of length parameter for gperf generated function
Since 3.1 gperf uses size_t for the length parameter instead of an unsigned int.
-rw-r--r--configure.ac15
-rw-r--r--src/libstrongswan/crypto/proposal/proposal_keywords_static.h2
-rw-r--r--src/starter/confread.c8
-rw-r--r--src/stroke/stroke_keywords.h2
4 files changed, 21 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 400c33bf0..0cfe52484 100644
--- a/configure.ac
+++ b/configure.ac
@@ -378,6 +378,21 @@ AC_PATH_PROG([GPERF], [gperf], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
AC_MSG_CHECKING([gperf version >= 3.0.0])
if test -x "$GPERF"; then
if test "`$GPERF --version | $AWK -F' ' '/^GNU gperf/ { print $3 }' | $AWK -F. '{ print $1 }'`" -ge "3"; then
+ GPERF_OUTPUT="`echo foo | ${GPERF}`"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <string.h>
+ const char *in_word_set(const char*, size_t); $GPERF_OUTPUT]])],
+ [GPERF_LEN_TYPE=size_t],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <string.h>
+ const char *in_word_set(const char*, unsigned); $GPERF_OUTPUT]])],
+ [GPERF_LEN_TYPE=unsigned],
+ [AC_MSG_ERROR([unable to determine gperf len type])]
+ )]
+ )
+ AC_DEFINE_UNQUOTED([GPERF_LEN_TYPE], [$GPERF_LEN_TYPE], [gperf len type])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
diff --git a/src/libstrongswan/crypto/proposal/proposal_keywords_static.h b/src/libstrongswan/crypto/proposal/proposal_keywords_static.h
index bc421dcc5..c046fab92 100644
--- a/src/libstrongswan/crypto/proposal/proposal_keywords_static.h
+++ b/src/libstrongswan/crypto/proposal/proposal_keywords_static.h
@@ -19,7 +19,7 @@
#include "proposal_keywords.h"
const proposal_token_t* proposal_get_token_static(register const char *str,
- register unsigned int len);
+ register GPERF_LEN_TYPE len);
#endif /* PROPOSAL_KEYWORDS_STATIC_H_ */
diff --git a/src/starter/confread.c b/src/starter/confread.c
index f98fc8936..e78f2a70b 100644
--- a/src/starter/confread.c
+++ b/src/starter/confread.c
@@ -48,7 +48,7 @@ static const char firewall_defaults[] = IPSEC_SCRIPT " _updown iptables";
/**
* Provided by GPERF
*/
-extern kw_entry_t *in_word_set (char *str, unsigned int len);
+extern const kw_entry_t *in_word_set(register const char*, register GPERF_LEN_TYPE);
/**
* Process deprecated keywords
@@ -95,7 +95,7 @@ static void load_setup(starter_config_t *cfg, conf_parser_t *parser)
{
enumerator_t *enumerator;
dictionary_t *dict;
- kw_entry_t *entry;
+ const kw_entry_t *entry;
char *key, *value;
DBG2(DBG_APP, "Loading config setup");
@@ -146,7 +146,7 @@ static void load_ca(starter_ca_t *ca, starter_config_t *cfg,
{
enumerator_t *enumerator;
dictionary_t *dict;
- kw_entry_t *entry;
+ const kw_entry_t *entry;
kw_token_t token;
char *key, *value;
@@ -559,7 +559,7 @@ static void load_conn(starter_conn_t *conn, starter_config_t *cfg,
{
enumerator_t *enumerator;
dictionary_t *dict;
- kw_entry_t *entry;
+ const kw_entry_t *entry;
kw_token_t token;
char *key, *value;
diff --git a/src/stroke/stroke_keywords.h b/src/stroke/stroke_keywords.h
index 4a1016277..51caba68b 100644
--- a/src/stroke/stroke_keywords.h
+++ b/src/stroke/stroke_keywords.h
@@ -73,6 +73,6 @@ typedef enum {
typedef struct stroke_token stroke_token_t;
-extern const stroke_token_t* in_word_set(register const char *str, register unsigned int len);
+extern const stroke_token_t* in_word_set(register const char *str, register GPERF_LEN_TYPE len);
#endif /* _STROKE_KEYWORDS_H_ */