From c5639964bede9fd525da34db0f7d216ccbcfa22f Mon Sep 17 00:00:00 2001 From: Emanuel Rietveld Date: Apr 17 2019 15:34:48 +0000 Subject: Fix build on alpine linux * include nss as instead of - pkgconfig will pick up the proper include path * change #ifdef LINUX into #ifdef __GLIBC__ for malloc options so that we can build on musl --- diff --git a/include/ldaputil/certmap.h b/include/ldaputil/certmap.h index 50fd4d1..26d1733 100644 --- a/include/ldaputil/certmap.h +++ b/include/ldaputil/certmap.h @@ -16,7 +16,7 @@ /* What was extcmap.h begins ... */ #include -#include +#include #ifndef NSAPI_PUBLIC #define NSAPI_PUBLIC diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c index 4789ec5..a7fc23a 100644 --- a/ldap/servers/slapd/libglobs.c +++ b/ldap/servers/slapd/libglobs.c @@ -128,7 +128,7 @@ #endif /* USE_SYSCONF */ #include "slap.h" #include "plhash.h" -#if defined(LINUX) +#if defined(__GLIBC__) #include #endif #include @@ -242,7 +242,7 @@ slapi_onoff_t init_dynamic_plugins; slapi_onoff_t init_cn_uses_dn_syntax_in_dns; slapi_onoff_t init_global_backend_local; slapi_onoff_t init_enable_nunc_stans; -#if defined(LINUX) +#if defined(__GLIBC__) slapi_int_t init_malloc_mxfast; slapi_int_t init_malloc_trim_threshold; slapi_int_t init_malloc_mmap_threshold; @@ -1115,7 +1115,7 @@ static struct config_get_and_set NULL, 0, (void **)&global_slapdFrontendConfig.cn_uses_dn_syntax_in_dns, CONFIG_ON_OFF, (ConfigGetFunc)config_get_cn_uses_dn_syntax_in_dns, &init_cn_uses_dn_syntax_in_dns}, -#if defined(LINUX) +#if defined(__GLIBC__) {CONFIG_MALLOC_MXFAST, config_set_malloc_mxfast, NULL, 0, (void **)&global_slapdFrontendConfig.malloc_mxfast, @@ -1744,7 +1744,7 @@ FrontendConfig_init(void) cfg->logging_backend = slapi_ch_strdup(SLAPD_INIT_LOGGING_BACKEND_INTERNAL); cfg->rootdn = slapi_ch_strdup(SLAPD_DEFAULT_DIRECTORY_MANAGER); init_enable_nunc_stans = cfg->enable_nunc_stans = LDAP_OFF; -#if defined(LINUX) +#if defined(__GLIBC__) init_malloc_mxfast = cfg->malloc_mxfast = DEFAULT_MALLOC_UNSET; init_malloc_trim_threshold = cfg->malloc_trim_threshold = DEFAULT_MALLOC_UNSET; init_malloc_mmap_threshold = cfg->malloc_mmap_threshold = DEFAULT_MALLOC_UNSET; @@ -8088,7 +8088,7 @@ config_get_extract_pem() return retVal; } -#if defined(LINUX) +#if defined(__GLIBC__) int config_set_malloc_mxfast(const char *attrname, char *value, char *errorbuf, int apply __attribute__((unused))) { diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c index 33ca9ce..131c98f 100644 --- a/ldap/servers/slapd/main.c +++ b/ldap/servers/slapd/main.c @@ -60,7 +60,7 @@ union semun #include "fe.h" #include -#ifdef LINUX +#ifdef __GLIBC__ /* For mallopt. Should be removed soon. */ #include #endif @@ -668,7 +668,7 @@ main(int argc, char **argv) daemon_ports_t ports_info = {0}; ns_thrpool_t *tp = NULL; -#ifdef LINUX +#ifdef __GLIBC__ char *m = getenv("SLAPD_MXFAST"); if (m) { int val = atoi(m);