$NetBSD: patch-configure,v 1.16 2022/04/27 07:51:20 wiz Exp $

- Builtin krb5-config in platforms such as solaris do not support
  the gssapi option, and need an explicit -lgss
- On Darwin, do not append custom CFLAGS.
- Do not strip debug flags.
- Support Minix.

--- configure.orig	2022-04-25 07:31:45.000000000 +0000
+++ configure
@@ -4246,6 +4246,7 @@ printf "%s\n" "$as_me: $xc_bad_var_msg l
         ;;
     esac
   done
+  xc_bad_var_cflags=no
   if test $xc_bad_var_cflags = yes; then
     { printf "%s\n" "$as_me:${as_lineno-$LINENO}: using CFLAGS: $CFLAGS" >&5
 printf "%s\n" "$as_me: using CFLAGS: $CFLAGS" >&6;}
@@ -8648,7 +8649,7 @@ else $as_nop
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
-  bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*)
+  bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | minix* | netbsd* | openbsd*)
     # 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`
@@ -9236,12 +9237,8 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu 
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-netbsd* | netbsdelf*-gnu)
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
-  fi
+netbsd* | netbsdelf*-gnu | minix*)
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
   ;;
 
 newos6*)
@@ -13520,14 +13517,13 @@ _LT_EOF
       fi
       ;;
 
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
+    netbsd* | netbsdelf*-gnu | minix*)
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      output_verbose_link_cmd=func_echo_all
       ;;
 
     solaris*)
@@ -14218,15 +14214,13 @@ printf "%s\n" "$lt_cv_irix_exported_symb
       esac
       ;;
 
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      hardcode_libdir_flag_spec='-R$libdir'
+    netbsd* | netbsdelf*-gnu | minix*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
       hardcode_direct=yes
       hardcode_shlibpath_var=no
+      output_verbose_link_cmd=func_echo_all
       ;;
 
     newsos6)
@@ -15337,6 +15331,18 @@ fi
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
+minix*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Minix ld.elf_so'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
 netbsdelf*-gnu)
   version_type=linux
   need_lib_prefix=no
@@ -17794,7 +17800,7 @@ squeeze() {
 
 
       #
-  if test "$compiler_id" != "unknown"; then
+  if false; then
     #
     tmp_save_CPPFLAGS="$CPPFLAGS"
     tmp_save_CFLAGS="$CFLAGS"
@@ -18087,13 +18093,6 @@ printf %s "checking if compiler accepts 
       tmp_options="$flags_dbg_yes"
     fi
     #
-    if test "$flags_prefer_cppflags" = "yes"; then
-      CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
-      CFLAGS="$tmp_CFLAGS"
-    else
-      CPPFLAGS="$tmp_CPPFLAGS"
-      CFLAGS="$tmp_CFLAGS $tmp_options"
-    fi
     squeeze CPPFLAGS
     squeeze CFLAGS
   fi
@@ -20853,7 +20852,7 @@ printf "%s\n" "no" >&6; }
   tst_cflags="no"
   case $host_os in
     darwin*)
-      tst_cflags="yes"
+      tst_cflags="no"
       ;;
   esac
 
@@ -25252,7 +25251,7 @@ printf "%s\n" "found" >&6; }
         LIBS="-lgss $LIBS"
         ;;
      *)
-        LIBS="-lgssapi $LIBS"
+        LIBS="-lgssapi -lkrb5 $LIBS"
         ;;
      esac
   fi
