diff configure @ 253:5cfe4322c500

- improved support for older OS versions for dynloads dlGetLibraryPath
author Tassilo Philipp
date Mon, 15 May 2017 02:50:03 +0200
parents 700c67984c08
children 7520e2260097
line wrap: on
line diff
--- a/configure	Sun May 14 02:29:55 2017 +0200
+++ b/configure	Mon May 15 02:50:03 2017 +0200
@@ -63,16 +63,24 @@
 done
 printf "PREFIX=${PREFIX:=/usr/local}\n" >>$C
 case ${TARGET:=`uname`} in
-  Linux)
+  Linux|GNU/kFreeBSD)
     if [ -z "${CFLAGS}" ]; then
       printf "CFLAGS=-fPIC\n" >>$C
     fi
     printf "LDLIBS=-lm -ldl\n" >>$C
     ;;
   OpenBSD)
+    if [ -z "${CFLAGS}" ]; then
+      # dl_iterate_phdr() got introduced in 3.7, so for older versions force DL_DLADDR_TO_LIBPATH
+      if (uname -r | grep '^\([0-2]\.\|3\.[0-6]\)' > /dev/null); then
+        printf "CFLAGS=-fPIC -DDL_DLADDR_TO_LIBPATH\n" >>$C
+      else
+        printf "CFLAGS=-fPIC\n" >>$C
+      fi
+    fi
     printf "LDLIBS=-lm\n" >>$C
     ;;
-  DragonFly|NetBSD)
+  NetBSD|DragonFly)
     if [ -z "${CFLAGS}" ]; then
       printf "CFLAGS=-fPIC\n" >>$C
     fi
@@ -85,12 +93,6 @@
     printf "LDLIBS=-lm\n" >>$C
     printf "RM=rm -f\n" >>$C
     ;;
-  GNU/kFreeBSD)
-    if [ -z "${CFLAGS}" ]; then
-      printf "CFLAGS=-fPIC\n" >>$C
-    fi
-    printf "LDLIBS=-lm -ldl\n" >>$C
-    ;;
   MacOSX|Darwin)
     # if Apple's libtool (not to be confused with GNU's) is available, which is according to libtool(1) "with -static [...] intended
     # to replace ar(5) and ranlib", use it - if it is shadowed by some install of GNU's libtool assume that a foreign environment is
@@ -168,7 +170,7 @@
     printf "CC=` (which cc gcc clang  ) | grep -v '^no ' | head -1`\n" >>$C
     printf "CXX=`(which CC g++ clang++) | grep -v '^no ' | head -1`\n" >>$C # C++ compiler traditionally named CC
     printf "CCC=\${CXX}\n" >>$C # Sun make's rules use CCC for c++ compiler
-    printf "LDLIBS=-lm\n" >>$C
+    printf "LDLIBS=-lm -ldl\n" >>$C
     ;;
   Minix)
     printf "CC=gcc\n" >>$C