From 745a04c20ce4bf84c91364ac576d9f181558b883 Mon Sep 17 00:00:00 2001
From: Stan Seibert <volsung@xiph.org>
Date: Fri, 29 Aug 2003 18:18:32 +0000
Subject: [PATCH] Move dlopen flag settings from header file to configure
 script and add Solaris 2.7 as a targe which requires RTLD_LAZY to work. 
 Closes bug 240.

git-svn-id: http://svn.xiph.org/trunk/ao@5255 0101bb08-14d6-0310-b084-bc0e0c8e3800
---
 configure.in     | 14 ++++++++++++++
 src/ao_private.h |  8 ++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/configure.in b/configure.in
index 21bb42d..28aee1a 100644
--- a/configure.in
+++ b/configure.in
@@ -102,6 +102,20 @@ dnl ==============================
 dnl Checks for header files
 dnl ==============================
 
+dnl ==============================
+dnl Select proper dlopen flags
+dnl ==============================
+case $host in
+    
+    *openbsd* | *netbsd* | *hpux* | *solaris2.7)
+	DLOPEN_FLAG='(RTLD_LAZY)'
+	;;
+    *)
+	DLOPEN_FLAG='(RTLD_NOW | RTLD_GLOBAL)'
+	;;
+esac
+AC_DEFINE_UNQUOTED(DLOPEN_FLAG, $DLOPEN_FLAG)
+
 dnl --------------------------------------------------
 dnl Work around FHS stupidity
 dnl --------------------------------------------------
diff --git a/src/ao_private.h b/src/ao_private.h
index 89f3336..9fe382f 100644
--- a/src/ao_private.h
+++ b/src/ao_private.h
@@ -38,13 +38,13 @@
 #endif
 
 /* RTLD_NOW is the preferred symbol resolution behavior, but
- * some platforms do not support it. 
+ * some platforms do not support it.  The autoconf script will have
+ * already defined DLOPEN_FLAG if the default is unacceptable on the
+ * current platform.
  *
  * ALSA requires RTLD_GLOBAL.
  */
-#if defined(__OpenBSD__) || defined(hpux)
-#define DLOPEN_FLAG (RTLD_LAZY)
-#else
+#if !defined(DLOPEN_FLAG)
 #define DLOPEN_FLAG (RTLD_NOW | RTLD_GLOBAL)
 #endif
 
-- 
GitLab