-# If the C++ libraries, libC and libC_r, are available we will prefer them
-# over the vanilla libc, because the libC contain loadAndInit() and
-# terminateAndUnload() which work correctly with C++ statics while libc
-# load() and unload() do not. See ext/DynaLoader/dl_aix.xs.
-# The C-to-C_r switch is done by usethreads.cbu, if needed.
-if test -f /lib/libC.a -a X"`$cc -v 2>&1 | grep gcc`" = X; then
+if test $usenativedlopen = 'true' ; then
+ ccflags="$ccflags -DUSE_NATIVE_DLOPEN"
+ # -brtl Enables a binary to use run time linking
+ # -bdynamic When used with -brtl, tells linker to search for
+ # ".so"-suffix libraries as well as ".a" suffix
+ # libraries. AIX allows both .so and .a libraries to
+ # contain dynamic shared objects.
+ # -bmaxdata:0x80000000 This increases the size of heap memory available
+ # to perl. Default is 256 MB, which sounds large but
+ # caused a software vendor problems. So this sets
+ # heap to 2 GB maximum. Anything higher and you'd
+ # want to consider 64 bit perl.
+ case "$cc" in
+ *gcc*) ldflags="$ldflags -Wl,-brtl -Wl,-bdynamic -Wl,-bmaxdata:0x80000000" ;;
+ *) ldflags="$ldflags -brtl -bdynamic -bmaxdata:0x80000000" ;;
+ esac
+elif test -f /lib/libC.a -a X"`$cc -v 2>&1 | grep gcc`" = X; then
+ # If the C++ libraries, libC and libC_r, are available we will
+ # prefer them over the vanilla libc, because the libC contain
+ # loadAndInit() and terminateAndUnload() which work correctly
+ # with C++ statics while libc load() and unload() do not. See
+ # ext/DynaLoader/dl_aix.xs. The C-to-C_r switch is done by
+ # usethreads.cbu, if needed.
+