Fix an ordering problem that was causing the default build to be "-O2
-g" instead of -O3.

Calling AM_OPTIONS before AC_PROG_CC doesn't work because CFLAGS is set
by the time AM_OPTIONS completes and we can't figure out if the command
line set CFLAGS or not.  Calling AM_OPTIONS after AC_PROG_CC isn't great
either, if --enable-debug was specified we want to default to "-O2 -g"
instead of -O3.

The autoconf docs say this about the AC_PROG_CC macro:

	If using the GNU C compiler, set shell variable GCC to yes. If output
	variable CFLAGS was not already set, set it to -g -O2 for the GNU C
	compiler (-O2 on systems where GCC does not accept -g), or -g for other
	compilers. If your package does not like this default, then it is
	acceptable to insert the line : ${CFLAGS=""} after AC_INIT and before
	AC_PROG_CC to select an empty default instead.

List of changes:

	Call AC_PROG_CC before calling AM_OPTIONS, back out defaulting
	CFLAGS to -O3, if --enable-debug is configured.

	Move the libtool configuration until after the compiler, language,
	API and configuration options have been dealt with.  This isn't a
	necessary change, but seems cleaner to me.

	Don't bother appending the -g flag to the existing flags when
	--enable-debug is configured, AC_PROG_CC sets -g by default.