Save and restore the LIBS variable since autotools overwrites it
Apply fix for AIX