From e76a062338063615c069fedc5a143cc38c34d9b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
Date: Tue, 28 Feb 2017 01:00:21 +0100
Subject: [PATCH] Fl_Preferences.cxx: do not use dlopen in case glibc's headers
 are missing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

| /home/work/x86_64-linux/fltk-native/1.3.4-1-r0/fltk-1.3.4-1/src/Fl_Preferences.cxx: In static member function ‘static int Fl_Plugin_Manager::load(const char*)’:
| /home/work/x86_64-linux/fltk-native/1.3.4-1-r0/fltk-1.3.4-1/src/Fl_Preferences.cxx:1741:27: error: ‘RTLD_LAZY’ was not declared in this scope
|      dl = dlopen(filename, RTLD_LAZY);
|                            ^~~~~~~~~
| /home/work/x86_64-linux/fltk-native/1.3.4-1-r0/fltk-1.3.4-1/src/Fl_Preferences.cxx:1741:36: error: ‘dlopen’ was not declared in this scope
|      dl = dlopen(filename, RTLD_LAZY);
|                                     ^
| src/CMakeFiles/fltk.dir/build.make:1217: recipe for target 'src/CMakeFiles/fltk.dir/Fl_Preferences.cxx.o' failed

Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
 src/Fl_Preferences.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx
index 1233bb1..7857b9b 100644
--- a/src/Fl_Preferences.cxx
+++ b/src/Fl_Preferences.cxx
@@ -1737,7 +1737,7 @@ int Fl_Plugin_Manager::load(const char *filename) {
   HMODULE dl = LoadLibrary(filename);
 #else
   void * dl = NULL;
-# if HAVE_DLSYM
+# if HAVE_DLSYM && HAVE_DLFCN_H
     dl = dlopen(filename, RTLD_LAZY);
 # endif
 #endif
-- 
2.9.3

