diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-07-06 14:02:39 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-07-06 21:03:09 +0000 |
commit | 5bfc21cf9e42af13a8d1ad6eb545ab82cb7dbe9d (patch) | |
tree | 89a9afacd2d37d3eadc22165a0256a14b089da1e /configure.ac | |
parent | e64942068632fc01b6a1211bfb90df8265e41fe7 (diff) |
Clean up handling of missing functions.
With autotools, CMake, and nmake, if we have a function, #define
HAVE_{function_name_in_all_caps}, otherwise don't #define it.
If we provide our own version of a function in libwsutil, make sure we
have a header that declares it, and *ONLY* include that header if
HAVE_{function_name_in_all_caps} is *NOT* defined, so that we don't have
the system declaration and our declaration colliding.
Check for inet_aton, strncasecmp, and strptime with CMake, just as we do
with autotools.
Simplify the addition of {function_name_in_all_caps}_LO to libwsutil in
autotools.
Change-Id: Id5be5c73f79f81919a3a865324e400eca7b88889
Reviewed-on: https://code.wireshark.org/review/2903
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/configure.ac b/configure.ac index 13347884f6..13c1de5f94 100644 --- a/configure.ac +++ b/configure.ac @@ -2530,38 +2530,30 @@ AC_C_BIGENDIAN # XXX - do we need this? AC_PROG_GCC_TRADITIONAL -GETOPT_LO="" AC_CHECK_FUNC(getopt, - [GETOPT_LO="" - AC_DEFINE(HAVE_GETOPT, 1, [Define to 1 if you have the getopt function.]) + [ + GETOPT_LO="" + AC_DEFINE(HAVE_GETOPT, 1, [Define to 1 if you have the getopt function.]) ], - GETOPT_LO="wsgetopt.lo" -) -if test "$ac_cv_func_getopt" = no ; then - GETOPT_LO="wsgetopt.lo" -fi -AM_CONDITIONAL(NEED_GETOPT_LO, test "x$ac_cv_func_getopt" = "xno") + GETOPT_LO="wsgetopt.lo") AC_SUBST(GETOPT_LO) -AC_CHECK_FUNC(strncasecmp, STRNCASECMP_LO="", +AC_CHECK_FUNC(strncasecmp, + [ + STRNCASECMP_LO="" + AC_DEFINE(HAVE_STRNCASECMP, 1, [Define to 1 if you have the strncasecmp function.]) + ], STRNCASECMP_LO="strncasecmp.lo") -if test "$ac_cv_func_strncasecmp" = no ; then - STRNCASECMP_LO="strncasecmp.lo" -fi -AM_CONDITIONAL(NEED_STRNCASECMP_LO, test "x$ac_cv_func_strncasecmp" = "xno") AC_SUBST(STRNCASECMP_LO) AC_CHECK_FUNCS(mkstemp mkdtemp) -AC_SEARCH_LIBS(inet_aton, [socket nsl], have_inet_aton=yes, - have_inet_aton=no) -if test "$have_inet_aton" = no; then - INET_ATON_LO="inet_aton.lo" - AC_DEFINE(HAVE_INET_ATON_H, 0, [Define unless inet/aton.h needs to be included]) -else - INET_ATON_LO="" -fi -AM_CONDITIONAL(NEED_INET_ATON_LO, test "x$have_inet_aton" = "xno") +AC_SEARCH_LIBS(inet_aton, [socket nsl], + [ + INET_ATON_LO="" + AC_DEFINE(HAVE_INET_ATON, 0, [Define to 1 if you have the inet_aton function.]) + ], + INET_ATON_LO="inet_aton.lo") AC_SUBST(INET_ATON_LO) AC_SEARCH_LIBS(inet_pton, [socket nsl], [ @@ -2623,15 +2615,12 @@ extern const char *inet_ntop(int, const void *, char *, socklen_t);],, [ AM_CONDITIONAL(NEED_INET_NTOP_LO, test "x$INET_NTOP_LO" != "x") AC_SUBST(INET_NTOP_LO) -AC_CHECK_FUNC(strptime, STRPTIME_LO="", - [STRPTIME_LO="strptime.lo" - AC_DEFINE(NEED_STRPTIME_H, 1, [Define if strptime.h needs to be included]) -]) -if test "$ac_cv_func_strptime" = no ; then - STRPTIME_LO="strptime.lo" -fi -AC_SUBST(STRPTIME_C) -AM_CONDITIONAL(NEED_STRPTIME_LO, test "x$ac_cv_func_strptime" = "no") +AC_CHECK_FUNC(strptime, + [ + STRPTIME_LO="" + AC_DEFINE(HAVE_STRPTIME, 1, [Define if you have the strptime function.]) + ], + STRPTIME_LO="strptime.lo") AC_SUBST(STRPTIME_LO) AC_CHECK_FUNCS(getprotobynumber gethostbyname2) |