diff --git a/bin/smartlink b/bin/smartlink
index a7760c90fcdf47377a26d2548eea0c77086d4a1c..7e26f2d83efde571ea48cab7d31e2f5f0bc338f3 100755
--- a/bin/smartlink
+++ b/bin/smartlink
@@ -53,6 +53,14 @@ while test x$1 = x -a x$# != x0; do
   shift
 done
 
+if test -x /usr/bin/uname ; then
+  UNAME=`/usr/bin/uname -sr`
+elif test -x /bin/uname ; then
+  UNAME=`/bin/uname -sr`
+else
+  UNAME=unknown
+fi
+
 if test x$# != x0 ; then
 
   done="::$1:"
@@ -71,14 +79,6 @@ if test x$# != x0 ; then
     shift
   done
 
-  if test -x /usr/bin/uname ; then
-    UNAME=`/usr/bin/uname -sr`
-  elif test -x /bin/uname ; then
-    UNAME=`/bin/uname -sr`
-  else
-    UNAME=unknown
-  fi
-
   case "$LINKER $LDOPTS " in
     *\ -c\ * | cpp\ * | *\ -E\ *)
       LINKING=no
@@ -108,10 +108,18 @@ if test x$# != x0 ; then
   esac
 fi
 
-if test "x$NO_ULIMIT" = "x"; then
-  # Limit data segment size to 48MB.
-  ulimit -d 49152 >/dev/null 2>&1
-fi
+case "x$UNAME" in
+  AIX*)
+    # AIX cc doesn't work with ulimit set
+    :
+  ;;
+  *)
+    if test "x$NO_ULIMIT" = "x"; then
+      # Limit data segment size to 48MB.
+      ulimit -d 49152 >/dev/null 2>&1
+    fi
+  ;;
+esac
 
 # Used to be exec, but Digital-Unix's stupid sh has buggy variable-expansion.
 # /grubba