--- vsf_findlibs.sh.orig	2012-03-27 21:17:41.000000000 -0500
+++ vsf_findlibs.sh	2021-01-12 16:26:00.000000000 -0600
@@ -21,6 +21,10 @@
   locate_library /usr/lib/libpam.sl && echo "-lpam";
   # AIX ends shared libraries with .a
   locate_library /usr/lib/libpam.a && echo "-lpam";
+  # macOS ends shared libraries with .dylib, but on macOS 11 and later
+  # the file itself doesn't exist in the filesystem, but can be linked
+  # against and opened via dlopen().
+  perl -mDynaLoader -e 'exit 1 unless DynaLoader::dl_load_file(shift)' /usr/lib/libpam.dylib && echo "-lpam";
 else
   locate_library /lib/libcrypt.so && echo "-lcrypt";
   locate_library /usr/lib/libcrypt.so && echo "-lcrypt";
