--- autogen.sh.orig	2019-11-01 13:31:59.000000000 -0500
+++ autogen.sh	2019-11-08 16:28:59.000000000 -0600
@@ -7,7 +7,7 @@
 set -e
 
 # Refresh GNU autotools toolchain.
-for i in config.guess config.sub missing install-sh mkinstalldirs ; do
+for i in config.guess config.sub missing install-sh %PREFIX%/share/automake-*/mkinstalldirs ; do
 	test -r /usr/share/automake/${i} && {
 		rm -f ${i}
 		cp /usr/share/automake/${i} .
@@ -15,7 +15,12 @@
 	chmod 755 ${i}
 done
 
-libtoolize --force --copy
+if [ "$(uname -s)" == "Darwin" ]; then
+  LIBTOOLIZE=glibtoolize
+else 
+  LIBTOOLIZE=libtoolize
+fi
+$LIBTOOLIZE --force --copy
 aclocal
 autoheader
 automake --verbose --force --copy --add-missing
