From 9f09213157acd7ecce4490d687f42d5ca95cf57d Mon Sep 17 00:00:00 2001
From: Alex Webb <alexwebb2@gmail.com>
Date: Tue, 19 May 2020 16:56:53 -0500
Subject: [PATCH] Add RTLD_DEEPBIND existence check

Checks for `RTLD_DEEPBIND` directly, rather than checking for `__APPLE__` and `__FreeBSD__`

This was causing build failures in Alpine Linux, which uses `musl` instead of `glibc` and does not include `RTLD_DEEPBIND`:

https://git.musl-libc.org/cgit/musl/tree/include/dlfcn.h

Patch-Source: https://github.com/EnterpriseDB/mysql_fdw/pull/196

diff --git a/mysql_fdw.c b/mysql_fdw.c
--- a/mysql_fdw.c
+++ b/mysql_fdw.c
@@ -255,10 +255,10 @@
 bool
 mysql_load_library(void)
 {
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if !defined(RTLD_DEEPBIND)
 	/*
-	 * Mac OS/BSD does not support RTLD_DEEPBIND, but it still works without
-	 * the RTLD_DEEPBIND
+	 * Some implementations do not support RTLD_DEEPBIND, but it still
+	 * works without the RTLD_DEEPBIND
 	 */
 	mysql_dll_handle = dlopen(_MYSQL_LIBNAME, RTLD_LAZY);
 #else
