diff options
author | Sami Kerola <kerolasa@iki.fi> | 2018-10-09 22:07:03 +0100 |
---|---|---|
committer | Sami Kerola <kerolasa@iki.fi> | 2018-10-09 22:07:03 +0100 |
commit | c86f4067c5fcd3ef274212a3631e90b0df2a5344 (patch) | |
tree | b626e4895b3a36387e474a29031ae1601e168449 | |
parent | f4c3dcba26ff01ef825c345ee8d634969eb5fa8f (diff) | |
download | iputils-c86f4067c5fcd3ef274212a3631e90b0df2a5344.tar.gz |
build-sys: fix musl compilation
Tested with archlinux musl 1.1.20-1 that also has kernel-headers-musl
3.12.6_6-1 package. Compilation worked when using following configuration
options.
$ meson builddir -DBUILD_NINFOD=false -DUSE_CAP=false -DUSE_CRYPTO=none -DUSE_IDN=false
Requested-by: David Heidelberg <david@ixit.cz>
Reference: https://github.com/iputils/iputils/pull/120
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
-rw-r--r-- | meson.build | 7 | ||||
-rw-r--r-- | ping.h | 25 |
2 files changed, 28 insertions, 4 deletions
diff --git a/meson.build b/meson.build index c56535f..7dcf65d 100644 --- a/meson.build +++ b/meson.build @@ -53,7 +53,7 @@ if opt == true conf.set('HAVE_LIBCAP', 1, description : 'Defined if libcap exists.') else - cap_dep = [] + cap_dep = dependency('disabler-appears-to-disable-executable-build', required : false) endif opt = get_option('ARPING_DEFAULT_DEVICE') @@ -72,7 +72,7 @@ if opt == true add_project_arguments('-DUSE_IDN', language : 'c') conf.set('USE_IDN', 1, description : 'If set use Internationalized Domain Name library.') else - idn_dep = [] + idn_dep = dependency('disabler-appears-to-disable-executable-build', required : false) endif opt = get_option('USE_CRYPTO') @@ -86,7 +86,7 @@ elif opt == 'openssl' crypto_dep = dependency('openssl') conf.set('USE_OPENSSL', 1, description : 'if set use openssl crypto library.') elif opt == 'none' - crypto_dep = disabler() + crypto_dep = dependency('disabler-appears-to-disable-executable-build', required : false) conf.set('PING6_NONCE_MEMORY', 1, description : 'If set RFC6744 random does not use any CRYPTO lib.') endif @@ -115,6 +115,7 @@ if build_ninfod == true conf.set('STDC_HEADERS', 1, description : 'Defined if we have standard c headers.') endif foreach h : [ + 'error.h', 'gcrypt.h', 'gnutls/openssl.h', 'inttypes.h', @@ -15,7 +15,6 @@ #include <sys/uio.h> #include <ctype.h> #include <errno.h> -#include <error.h> #include <string.h> #include <netdb.h> #include <setjmp.h> @@ -30,6 +29,12 @@ #include <linux/filter.h> #include <resolv.h> +#ifdef HAVE_ERROR_H +#include <error.h> +#else +#include <stdarg.h> +#endif + #ifdef HAVE_LIBCAP #include <sys/prctl.h> #include <sys/capability.h> @@ -150,6 +155,24 @@ static inline bitmap_t rcvd_test(uint16_t seq) return A(bit) & B(bit); } +#ifndef HAVE_ERROR_H +static void error(int status, int errnum, const char *format, ...) +{ + va_list ap; + + fprintf(stderr, "ping: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + if (errnum) + fprintf(stderr, ": %s\n", strerror(errnum)); + else + fprintf(stderr, "\n"); + if (status) + exit(status); +} +#endif + extern int datalen; extern char *hostname; extern int uid; |