From d54637373ab890b9e8b239290a241ca821058077 Mon Sep 17 00:00:00 2001
From: Alexander Traud <pabstraud@compuserve.com>
Date: Fri, 20 Apr 2018 12:40:21 +0200
Subject: [PATCH] menuselect: Add DragonFly BSD.

In DragonFly BSD, added libraries from ports are placed into /usr/local.
Therefore, this directory must be added for the preprocessor, compiler, and
linker.

Beside that, the script ./configure was updated:
* OSARCH list was outdated and not used, removed.
* AC_CANONICAL_BUILD was not used.
* _REENTRANT, this feature test macro is obsolete.

ASTERISK-27820

Change-Id: I186d88d99cfa4de6569888e12ac97bd2f441c422
---
 menuselect/Makefile        |  8 ++++++++
 menuselect/autoconfig.h.in |  4 ----
 menuselect/configure       | 33 +++++++++----------------------
 menuselect/configure.ac    | 40 +++++++++-----------------------------
 4 files changed, 26 insertions(+), 59 deletions(-)

diff --git a/menuselect/Makefile b/menuselect/Makefile
index c2c9373f4f..d949efd559 100644
--- a/menuselect/Makefile
+++ b/menuselect/Makefile
@@ -24,6 +24,14 @@ endif
 OBJS:=menuselect.o strcompat.o
 CFLAGS+=-g -D_GNU_SOURCE -Wall
 
+ifneq ($(findstring dragonfly,$(OSARCH)),)
+  CFLAGS += -isystem /usr/local/include
+else ifneq ($(findstring netbsd,$(OSARCH)),)
+  CFLAGS += -isystem /usr/pkg/include
+else ifneq ($(findstring bsd,$(OSARCH)),)
+  CFLAGS += -isystem /usr/local/include
+endif
+
 ifeq ($(MENUSELECT_DEBUG),yes)
   CFLAGS += -DMENUSELECT_DEBUG
 endif
diff --git a/menuselect/autoconfig.h.in b/menuselect/autoconfig.h.in
index 3e1e189902..f1745516b7 100644
--- a/menuselect/autoconfig.h.in
+++ b/menuselect/autoconfig.h.in
@@ -3,10 +3,6 @@
 #ifndef MENUSELECT_AUTOCONFIG_H
 #define MENUSELECT_AUTOCONFIG_H
 
-#ifndef _REENTRANT
-#define _REENTRANT
-#endif
-
 
 /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
    systems. This function is required for `alloca.c' support on those systems.
diff --git a/menuselect/configure b/menuselect/configure
index a0aa10928e..7cbe477569 100755
--- a/menuselect/configure
+++ b/menuselect/configure
@@ -2320,33 +2320,18 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 HOST_OS=${host_os}
 
 
-PBX_WINARCH=0
 case "${host_os}" in
-     freebsd*)
-     OSARCH=FreeBSD
+     *dragonfly*)
+     CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
+     LDFLAGS="${LDFLAGS} -L/usr/local/lib"
      ;;
-     netbsd*)
-     OSARCH=NetBSD
+     *netbsd*)
+     CPPFLAGS="${CPPFLAGS} -I/usr/pkg/include"
+     LDFLAGS="${LDFLAGS} -L/usr/pkg/lib"
      ;;
-     openbsd*)
-     OSARCH=OpenBSD
-     ;;
-     solaris*)
-     OSARCH=SunOS
-     ;;
-     mingw32)
-     OSARCH=mingw32
-     PBX_WINARCH=1
-     ;;
-     cygwin)
-     OSARCH=cygwin
-     PBX_WINARCH=1
-     ;;
-     linux-gnueabi)
-     OSARCH=linux-gnu
-     ;;
-     *)
-     OSARCH=${host_os}
+     *bsd*)
+     CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
+     LDFLAGS="${LDFLAGS} -L/usr/local/lib"
      ;;
 esac
 
diff --git a/menuselect/configure.ac b/menuselect/configure.ac
index 2dd4ed6521..4a2d0acc29 100644
--- a/menuselect/configure.ac
+++ b/menuselect/configure.ac
@@ -1,5 +1,3 @@
-# Process this file with autoconf to produce a configure script.
-
 AC_PREREQ(2.59)
 
 m4_define([MENUSELECT_VERSION],
@@ -16,49 +14,29 @@ AC_CONFIG_HEADER(autoconfig.h)
 
 AC_COPYRIGHT("Menuselect")
 
-AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 
 HOST_OS=${host_os}
 AC_SUBST(HOST_OS)
 
-PBX_WINARCH=0
 case "${host_os}" in
-     freebsd*)
-     OSARCH=FreeBSD
-     ;;
-     netbsd*)
-     OSARCH=NetBSD
-     ;;
-     openbsd*)
-     OSARCH=OpenBSD
-     ;;
-     solaris*)
-     OSARCH=SunOS
+     *dragonfly*)
+     CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
+     LDFLAGS="${LDFLAGS} -L/usr/local/lib"
      ;;
-     mingw32)
-     OSARCH=mingw32
-     PBX_WINARCH=1
+     *netbsd*)
+     CPPFLAGS="${CPPFLAGS} -I/usr/pkg/include"
+     LDFLAGS="${LDFLAGS} -L/usr/pkg/lib"
      ;;
-     cygwin)
-     OSARCH=cygwin
-     PBX_WINARCH=1
-     ;;
-     linux-gnueabi)
-     OSARCH=linux-gnu
-     ;;
-     *)
-     OSARCH=${host_os}
+     *bsd*)
+     CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
+     LDFLAGS="${LDFLAGS} -L/usr/local/lib"
      ;;
 esac
 
 AH_TOP(
 #ifndef MENUSELECT_AUTOCONFIG_H
 #define MENUSELECT_AUTOCONFIG_H
-
-#ifndef _REENTRANT
-#define _REENTRANT
-#endif
 )
 
 AH_BOTTOM([#endif])
-- 
GitLab