--- a/gphoto-m4/gp-check-popt.m4.orig	2021-05-02 08:23:25.783794195 +0200
+++ b/gphoto-m4/gp-check-popt.m4	2021-05-02 08:28:34.109849996 +0200
@@ -62,57 +62,10 @@
 if test "x$POPT_CFLAGS" = "x" && test "x$POPT_LIBS" = "x"; then
 
 	# try to find options to compile popt.h
-	CPPFLAGS_save="$CPPFLAGS"
 	popth_found=no
-        case "$MSYSTEM" in
-         MINGW32)
-		if test -n "/mingw32"; then
-			:
-		elif test -d "/mingw32/include"; then
-			CPPFLAGS="-I/mingw32/include ${CPPFLAGS}"
-		else
-			continue
-		fi
-		ac_cv_header_popt_h=""
-		unset ac_cv_header_popt_h
-		AC_CHECK_HEADER([popt.h], [popth_found=yes])
-         ;;
-         MINGW64)
-		if test -n "${popt_prefix}"; then
-			:
-		elif test -d "/mingw64/include"; then
-			CPPFLAGS="-I/mingw64/include ${CPPFLAGS}"
-		else
-			continue
-		fi
-		ac_cv_header_popt_h=""
-		unset ac_cv_header_popt_h
-		AC_CHECK_HEADER([popt.h], [popth_found=yes])
-         ;;
-         *)
-           for popt_prefix in "" /usr /usr/local
-           do
-		if test -n "${popt_prefix}"; then
-			:
-		elif test -d "${popt_prefix}/include"; then
-			CPPFLAGS="-I${popt_prefix}/include ${CPPFLAGS}"
-		else
-			continue
-		fi
-		ac_cv_header_popt_h=""
-		unset ac_cv_header_popt_h
-		AC_CHECK_HEADER([popt.h], [popth_found=yes])
-		if test "$popth_found" = yes; then break; fi
-	   done
-         ;;
-        esac
-	CPPFLAGS="$CPPFLAGS_save"
+        AC_CHECK_HEADER([popt.h], [popth_found=yes])
 	if test "$popth_found" = "yes"; then
-		if test "$popt_prefix" = ""; then
-			POPT_CFLAGS=""
-		else
-			POPT_CFLAGS="-I${popt_prefix}/include"
-		fi
+                POPT_CFLAGS=""
 	elif test "$require_popt" = "yes"; then
 		AC_MSG_ERROR([
 * Cannot autodetect popt.h
@@ -122,77 +75,12 @@
 	fi
 
 	# try to find options to link against popt
-	LDFLAGS_save="$LDFLAGS"
 	popt_links=no
-        case "$MSYSTEM" in
-         MINGW32)
-#		for ldir in "" lib; do
-			popt_libdir="/mingw32/lib"
-			if test "${popt_libdir}" = "/"; then
-				popt_libdir=""
-			elif test -d "${popt_libdir}"; then
-				LDFLAGS="-L${popt_libdir} ${LDFLAGS}"
-			else
-				continue
-			fi
-			# Avoid caching of results
-			ac_cv_lib_popt_poptStuffArgs=""
-			unset ac_cv_lib_popt_poptStuffArgs
-			AC_CHECK_LIB([popt], [poptStuffArgs], [popt_links=yes])
-         ;;
-         MINGW64)
-			popt_libdir="/mingw64/lib"
-			if test "${popt_libdir}" = "/"; then
-				popt_libdir=""
-			elif test -d "${popt_libdir}"; then
-				LDFLAGS="-L${popt_libdir} ${LDFLAGS}"
-			else
-				continue
-			fi
-			# Avoid caching of results
-			ac_cv_lib_popt_poptStuffArgs=""
-			unset ac_cv_lib_popt_poptStuffArgs
-			AC_CHECK_LIB([popt], [poptStuffArgs], [popt_links=yes])
-          ;;
-         *)
-	    for popt_prefix in /usr "" /usr/local; do
-		# We could have "/usr" and "lib64" at the beginning of the
-		# lists. Then the first tested location would
-		# incidentally be the right one on 64bit systems, and
-		# thus work around a bug in libtool on 32bit systems:
-		#
-		# 32bit libtool doesn't know about 64bit systems, and so the
-		# compilation will fail when linking a 32bit library from
-		# /usr/lib to a 64bit binary.
-		#
-		# This hack has been confirmed to workwith a
-		# 32bit Debian Sarge and 64bit Fedora Core 3 system.
-		for ldir in lib64 "" lib; do
-			popt_libdir="${popt_prefix}/${ldir}"
-			if test "${popt_libdir}" = "/"; then
-				popt_libdir=""
-			elif test -d "${popt_libdir}"; then
-				LDFLAGS="-L${popt_libdir} ${LDFLAGS}"
-			else
-				continue
-			fi
-			# Avoid caching of results
-			ac_cv_lib_popt_poptStuffArgs=""
-			unset ac_cv_lib_popt_poptStuffArgs
-			AC_CHECK_LIB([popt], [poptStuffArgs], [popt_links=yes])
-			if test "$popt_links" = yes; then break; fi
-		done
-		if test "$popt_links" = yes; then break; fi
-	  done
-         ;;
-        esac
-	LDFLAGS="$LDFLAGS_save"
+        ac_cv_lib_popt_poptStuffArgs=""
+        unset ac_cv_lib_popt_poptStuffArgs
+        AC_CHECK_LIB([popt], [poptStuffArgs], [popt_links=yes])
 	if test "$popt_links" = "yes"; then
-		if test "$popt_libdir" = ""; then
-			POPT_LIBS="-lpopt"
-		else
-			POPT_LIBS="-L${popt_libdir} -lpopt"
-		fi
+                POPT_LIBS="-lpopt"
 		have_popt=yes
 	elif test "$require_popt" = "yes"; then
 		AC_MSG_ERROR([
