diff options
author | Gilles Chehade <gilles@poolp.org> | 2019-11-17 14:19:28 +0100 |
---|---|---|
committer | Gilles Chehade <gilles@poolp.org> | 2019-11-17 14:19:28 +0100 |
commit | ffd528e51a8276f9beeffffc41f85e29d1138a47 (patch) | |
tree | 8aabbcac4eee99c66b7c134ba83b846e3bbce294 | |
parent | conditionally build event_asr_run() (diff) | |
download | OpenSMTPD-ffd528e51a8276f9beeffffc41f85e29d1138a47.tar.xz OpenSMTPD-ffd528e51a8276f9beeffffc41f85e29d1138a47.zip |
conditionally build base64.c
-rw-r--r-- | configure.ac | 33 | ||||
-rw-r--r-- | openbsd-compat/Makefile.am | 5 | ||||
-rw-r--r-- | openbsd-compat/base64.c | 7 |
3 files changed, 33 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index fd6b7a8a..2efaa62d 100644 --- a/configure.ac +++ b/configure.ac @@ -473,6 +473,34 @@ AC_SEARCH_LIBS([res_9_b64_ntop], [Define if you have the res_9_b64_ntop() function.]) ]) +AC_SEARCH_LIBS([__b64_pton], + [resolv], + [ + AC_DEFINE([HAVE___B64_PTON], [1], + [Define if you have the __b64_pton() function.]) + ]) + +AC_SEARCH_LIBS([b64_pton], + [resolv], + [ + AC_DEFINE([HAVE_B64_PTON], [1], + [Define if you have the b64_pton() function.]) + ]) + +AC_SEARCH_LIBS([__b64_ntop], + [resolv], + [ + AC_DEFINE([HAVE___B64_NTOP], [1], + [Define if you have the b64_ntop() function.]) + ]) + +AC_SEARCH_LIBS([b64_ntop], + [resolv], + [ + AC_DEFINE([HAVE_B64_NTOP], [1], + [Define if you have the b64_ntop() function.]) + ]) + AC_SEARCH_LIBS([setsockopt], [socket], [ @@ -503,10 +531,6 @@ AC_SEARCH_LIBS([event_asr_run], AC_CHECK_FUNCS([ \ asprintf \ - b64_ntop \ - __b64_ntop \ - b64_pton \ - __b64_pton \ bcopy \ calloc_conceal \ chflags \ @@ -1985,6 +2009,7 @@ LIBS="$LIBS ${SMTPDLIBS}" ## #AM_CONDITIONAL([NEED_BASENAME], [test "x$ac_cv_have_basename" != "xyes"]) +AM_CONDITIONAL([NEED_BASE64], [test "x$ac_cv_search_b64_ntop" = "xno" -a "x$ac_cv_search___b64_ntop" = "xno" ]) AM_CONDITIONAL([NEED_BASENAME], [test "x$ac_cv_search_basename" = "xno"]) AM_CONDITIONAL([NEED_CLOCK_GETTIME], [test "x$ac_cv_search_clock_gettime" = "xno"]) AM_CONDITIONAL([NEED_CLOSEFROM], [test "x$ac_cv_search_closefrom" = "xno"]) diff --git a/openbsd-compat/Makefile.am b/openbsd-compat/Makefile.am index 8d20a509..824b64c1 100644 --- a/openbsd-compat/Makefile.am +++ b/openbsd-compat/Makefile.am @@ -3,10 +3,13 @@ noinst_LIBRARIES = libopenbsd-compat.a libopenbsd_compat_a_SOURCES = empty.c libopenbsd_compat_a_SOURCES += arc4random.c -libopenbsd_compat_a_SOURCES += base64.c libopenbsd_compat_a_SOURCES += bsd-misc.c +if NEED_BASE64 +libopenbsd_compat_a_SOURCES += base64.c +endif + if NEED_BASENAME libopenbsd_compat_a_SOURCES += basename.c endif diff --git a/openbsd-compat/base64.c b/openbsd-compat/base64.c index 9e746671..187390ff 100644 --- a/openbsd-compat/base64.c +++ b/openbsd-compat/base64.c @@ -46,8 +46,6 @@ #include "includes.h" -#if (!defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP)) || (!defined(HAVE_B64_PTON) && !defined(HAVE___B64_PTON)) - #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> @@ -129,7 +127,6 @@ static const char Pad64 = '='; characters followed by one "=" padding character. */ -#if !defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP) int b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) { @@ -183,7 +180,6 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) target[datalength] = '\0'; /* Returned value doesn't count \0. */ return (datalength); } -#endif /* !defined(HAVE_B64_NTOP) && !defined(HAVE___B64_NTOP) */ #if !defined(HAVE_B64_PTON) && !defined(HAVE___B64_PTON) @@ -310,6 +306,3 @@ b64_pton(char const *src, u_char *target, size_t targsize) return (tarindex); } - -#endif /* !defined(HAVE_B64_PTON) && !defined(HAVE___B64_PTON) */ -#endif |