--- configure.orig	2023-03-13 19:03:11 UTC
+++ configure
@@ -5906,7 +5906,7 @@ esac
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to force non-PIC code in shared modules" >&5
 $as_echo_n "checking whether to force non-PIC code in shared modules... " >&6; }
 case $host_alias in
-  i?86-*-linux*|i?86-*-freebsd*)
+  i?86-*-linux*|i?86-*-freebsd*|i?86-*-midnightbsd*)
     if test "${with_pic+set}" != "set" || test "$with_pic" = "no"; then
       with_pic=no
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -11220,7 +11220,7 @@ if test "$enable_zts" = "yes"; then
   case $host_alias in
   *solaris*)
     PTHREAD_FLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
-  *freebsd*)
+  *freebsd*|*midnightbsd*)
     PTHREAD_FLAGS="-D_REENTRANT -D_THREAD_SAFE";;
   *linux*)
     PTHREAD_FLAGS=-D_REENTRANT;;
@@ -15887,7 +15887,7 @@ $as_echo "#define HAVE_SOCKADDR_SA_LEN 1
 
 
 case $host_alias in #(
-  *-*-*android*|*-*-*uclibc*|*-*-*musl*|*freebsd*|*openbsd*) :
+  *-*-*android*|*-*-*uclibc*|*-*-*musl*|*midnightbsd*|*freebsd*|*openbsd*) :
     true ;; #(
   *) :
 
@@ -18150,7 +18150,7 @@ _ACEOF
   ac_hdrobj=Zend/zend_dtrace_gen.h
 
   case $host_alias in
-  *freebsd*)
+  *freebsd*|*midnightbsd*)
     PHP_GLOBAL_OBJS="$PHP_GLOBAL_OBJS $ac_bdir$ac_provsrc.lo"
     PHP_LDFLAGS="$PHP_LDFLAGS -lelf"
     ;;
@@ -18197,7 +18197,7 @@ $ac_bdir$ac_hdrobj: $abs_srcdir/$ac_prov
 EOF
 
   case $host_alias in
-  *solaris*|*linux*|*freebsd*)
+  *solaris*|*linux*|*freebsd*|*midnightbsd*)
     dtrace_prov_name="`echo $ac_provsrc | $SED -e 's#\(.*\)\/##'`.o"
     dtrace_lib_dir="`echo $ac_bdir$ac_provsrc | $SED -e 's#\(.*\)/[^/]*#\1#'`/.libs"
     dtrace_d_obj="`echo $ac_bdir$ac_provsrc | $SED -e 's#\(.*\)/\([^/]*\)#\1/.libs/\2#'`.o"
@@ -83629,7 +83629,7 @@ darwin* | rhapsody*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-freebsd* | dragonfly*)
+midnightbsd* | freebsd* | dragonfly*)
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
     case $host_cpu in
     i*86 )
@@ -84160,7 +84160,7 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+  netbsd* | midnightbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
     # This has been around since 386BSD, at least.  Likely further.
     if test -x /sbin/sysctl; then
       lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
@@ -86421,7 +86421,7 @@ if test -z "$aix_libpath"; then aix_libp
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
+    midnightbsd* | freebsd* | dragonfly*)
       archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
@@ -87046,7 +87046,7 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd* | dragonfly*)
+midnightbsd* | freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
   if test -x /usr/bin/objformat; then
@@ -89134,7 +89134,7 @@ if test -z "$aix_libpath"; then aix_libp
   freebsd-elf*)
     archive_cmds_need_lc_CXX=no
     ;;
-  freebsd* | dragonfly*)
+  midnightbsd* | freebsd* | dragonfly*)
     # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
     # conventions
     ld_shlibs_CXX=yes
@@ -90030,7 +90030,7 @@ $as_echo_n "checking for $compiler optio
 	    ;;
 	esac
 	;;
-      freebsd* | dragonfly*)
+      midnightbsd* | freebsd* | dragonfly*)
 	# FreeBSD uses GNU C++
 	;;
       hpux9* | hpux10* | hpux11*)
@@ -90673,7 +90673,7 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd* | dragonfly*)
+midnightbsd * | freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
   if test -x /usr/bin/objformat; then
