bpo-19521: Fix parallel build race condition on AIX (GH-21997)


    Patch by Michael Haubenwallner.
diff --git a/configure b/configure
index 69e975a..4c18ae7 100755
--- a/configure
+++ b/configure
@@ -700,6 +700,8 @@
 ac_ct_AR
 AR
 GNULD
+EXPORTSFROM
+EXPORTSYMS
 LINKCC
 LDVERSION
 RUNSHARED
@@ -5799,8 +5801,6 @@
 # If CXX is set, and if it is needed to link a main function that was
 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
 # python might then depend on the C++ runtime
-# This is altered for AIX in order to build the export list before
-# linking.
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking LINKCC" >&5
 $as_echo_n "checking LINKCC... " >&6; }
@@ -5808,13 +5808,6 @@
 then
 	LINKCC='$(PURIFY) $(MAINCC)'
 	case $ac_sys_system in
-	AIX*)
-	   exp_extra="\"\""
-	   if test $ac_sys_release -ge 5 -o \
-		   $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
-	       exp_extra="."
-	   fi
-	   LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
 	QNX*)
 	   # qcc must be used because the other compilers do not
 	   # support -N.
@@ -5824,6 +5817,26 @@
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINKCC" >&5
 $as_echo "$LINKCC" >&6; }
 
+# EXPORTSYMS holds the list of exported symbols for AIX.
+# EXPORTSFROM holds the module name exporting symbols on AIX.
+EXPORTSYMS=
+EXPORTSFROM=
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking EXPORTSYMS" >&5
+$as_echo_n "checking EXPORTSYMS... " >&6; }
+case $ac_sys_system in
+AIX*)
+	EXPORTSYMS="Modules/python.exp"
+	if test $ac_sys_release -ge 5 -o \
+		$ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
+	    EXPORTSFROM=. # the main executable
+	fi
+	;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXPORTSYMS" >&5
+$as_echo "$EXPORTSYMS" >&6; }
+
 # GNULD is set to "yes" if the GNU linker is used.  If this goes wrong
 # make sure we default having it set to "no": this is used by
 # distutils.unixccompiler to know if it should add --enable-new-dtags