diff --git a/configure b/configure
index 42990d27858e23117b38e81c85c49e14da2f94b6..e7c2d10e6730721173ca3c00b89498c69c7b7a2a 100755
--- a/configure
+++ b/configure
@@ -1851,6 +1851,7 @@ CMDLINE_SET="
     cxx
     dep_cc
     extra_version
+    gas
     host_cc
     host_cflags
     host_ld
@@ -3853,7 +3854,7 @@ case $target_os in
         strip="strip -d"
         ;;
     darwin)
-        gas="gas-preprocessor.pl $cc"
+        test "${as#*gas-preprocessor.pl}" != "$as" || gas="${gas:=gas-preprocessor.pl} ${as:=$cc}"
         enabled ppc && add_asflags -force_cpusubtype_ALL
         SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
         enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress