Commit f74a4abeef282ee6f910cf7ee63ef1b6b9eb8d30

Thomas de Grivel 2022-05-23T09:05:47

fix compilation on OpenBSD

diff --git a/config.subr b/config.subr
index 5bf0d14..8563ae2 100644
--- a/config.subr
+++ b/config.subr
@@ -53,9 +53,11 @@ fi
 echo "CC = $CC" >> ${CONFIG_MK}
 
 if test -z "$LIBTOOL"; then
-    if test -x "$(which glibtool)"; then
+    if test -x "$(which glibtool 2>/dev/null)"; then
         LIBTOOL="$(which glibtool)"
-    elif test -x "$(which libtool)"; then
+    elif test -x "/usr/local/bin/libtool"; then
+        LIBTOOL="/usr/local/bin/libtool"
+    elif test -x "$(which libtool 2>/dev/null)"; then
         LIBTOOL="$(which libtool)"
     else
         LIBTOOL=libtool
@@ -86,12 +88,12 @@ fi
 echo "PREFIX = $PREFIX" >> ${CONFIG_MK}
 
 if test -z "$OWNER"; then
-    OWNER="$(stat -t $PREFIX | cut -d\  -f 5)"
+    OWNER="$(ls -ld /home/dx/.rtbuf/ | tr -s ' ' | cut -d ' ' -f 3)"
 fi
 echo "OWNER = $OWNER" >> ${CONFIG_MK}
 
 if test -z "$GROUP"; then
-    GROUP="$(stat -t $PREFIX | cut -d\  -f 6)"
+    GROUP="$(ls -ld /home/dx/.rtbuf/ | tr -s ' ' | cut -d ' ' -f 4)"
 fi
 echo "GROUP = $GROUP" >> ${CONFIG_MK}
 
diff --git a/librtbuf/configure b/librtbuf/configure
index 2581a57..d053547 100755
--- a/librtbuf/configure
+++ b/librtbuf/configure
@@ -22,7 +22,9 @@ else
     CFLAGS="-DNDEBUG -O3"
 fi
 CFLAGS="$CFLAGS -W -Wall -Werror -std=c89 -pedantic"
-CFLAGS="$CFLAGS $(pkg-config --cflags libbsd-overlay)"
+if pkg-config libbsd-overlay; then
+    CFLAGS="$CFLAGS $(pkg-config --cflags libbsd-overlay)"
+fi
 echo "CFLAGS = $CFLAGS" >> ${CONFIG_MK}
 
 if test -d /opt/homebrew/lib; then
@@ -31,7 +33,9 @@ fi
 echo "LDFLAGS = $LDFLAGS" >> ${CONFIG_MK}
 
 LIBS=""
-LIBS="$LIBS $(pkg-config --libs libbsd-overlay)"
+if pkg-config libbsd-overlay; then
+    LIBS="$LIBS $(pkg-config --libs libbsd-overlay)"
+fi
 echo "LIBS = $LIBS" >> ${CONFIG_MK}
 
 for SRC in $SOURCES; do