diff --git a/libatomic/config/t-aix b/libatomic/config/t-aix
index 53c2d83242f4390543ec7f40809dcfbb8eab7f4b..0f37aaa15f3b85a3b3197e04af29149b0066e2b2 100644
--- a/libatomic/config/t-aix
+++ b/libatomic/config/t-aix
@@ -1,5 +1,5 @@
 ifeq ($(MULTIBUILDTOP),)
-BITS=$(shell if test -z "`ar -X64 t .libs/$(PACKAGE).a`" ; then \
+BITS=$(shell if test -z "`$(CC) -x c -E /dev/null -g3 -o - | grep 64BIT`" ; then \
     echo '64'; else echo '32'; fi)
 #MAJOR=$(firstword $(subst :, ,$(libtool_VERSION)))
 MAJOR=1
diff --git a/libgcc/config/rs6000/t-slibgcc-aix b/libgcc/config/rs6000/t-slibgcc-aix
index e5f8a029ff87c1a70a502dd9a010aa502ae99136..b3bdda6f9a80e6c338320aa43bdc7a6bb12fbfbd 100644
--- a/libgcc/config/rs6000/t-slibgcc-aix
+++ b/libgcc/config/rs6000/t-slibgcc-aix
@@ -90,7 +90,7 @@ AR_FLAGS_FOR_TARGET = -X32_64
 
 # Build and install AIX-style FAT libraries
 ifeq ($(MULTIBUILDTOP),)
-BITS=$(shell if test -z "`ar -X64 t libgcc_s.a`" ; then \
+BITS=$(shell if test -z "`$(CC) -x c -E /dev/null -g3 -o - | grep 64BIT`" ; then \
     echo '64'; else echo '32'; fi)
 all: all-multi
 ifeq ($(enable_shared),yes)
diff --git a/libgfortran/config/t-aix b/libgfortran/config/t-aix
index 7046aeeacc3803af307c99c434b27382370bc24d..e661286da123a1f3ed848504a48b3f25432f82f6 100644
--- a/libgfortran/config/t-aix
+++ b/libgfortran/config/t-aix
@@ -1,5 +1,5 @@
 ifeq ($(MULTIBUILDTOP),)
-BITS=$(shell if test -z "`ar -X64 t .libs/$(PACKAGE).a`" ; then \
+BITS=$(shell if test -z "`$(CC) -x c -E /dev/null -g3 -o - | grep 64BIT`" ; then \
     echo '64'; else echo '32'; fi)
 #MAJOR=$(firstword $(subst :, ,$(libtool_VERSION)))
 MAJOR=5
diff --git a/libgomp/config/t-aix b/libgomp/config/t-aix
index 5d0b7e0f9ae5710ee749fdbc336e47bcb2a2faf1..c3bb6c0bce0abced9742a6b3d0ffa9764f47602f 100644
--- a/libgomp/config/t-aix
+++ b/libgomp/config/t-aix
@@ -1,5 +1,5 @@
 ifeq ($(MULTIBUILDTOP),)
-BITS=$(shell if test -z "`ar -X64 t .libs/$(PACKAGE).a`" ; then \
+BITS=$(shell if test -z "`$(CC) -x c -E /dev/null -g3 -o - | grep 64BIT`" ; then \
     echo '64'; else echo '32'; fi)
 MAJOR=$(firstword $(subst :, ,$(libtool_VERSION)))
 all-local:
diff --git a/libstdc++-v3/config/os/aix/t-aix b/libstdc++-v3/config/os/aix/t-aix
index a588746dd99795314685f05631ae4c99487c0564..a5d58fab47497fa867affe6bc83643ba5d6503b9 100644
--- a/libstdc++-v3/config/os/aix/t-aix
+++ b/libstdc++-v3/config/os/aix/t-aix
@@ -1,5 +1,5 @@
 ifeq ($(MULTIBUILDTOP),)
-BITS=$(shell if test -z "`ar -X64 t src/.libs/$(PACKAGE).a`" ; then \
+BITS=$(shell if test -z "`$(CC) -x c -E /dev/null -g3 -o - | grep 64BIT`" ; then \
     echo '64'; else echo '32'; fi)
 MAJOR=$(firstword $(subst :, ,$(libtool_VERSION)))
 all-local: