-AC_ARG_WITH(opt,
-AC_HELP_STRING([--with-opt], [compile with reasonable optimizations])
-AC_HELP_STRING([--with-opt=FLAGS], [compile with specified FLAGS])
-AC_HELP_STRING([--with-opt=small], [compile for smallest code])
-AC_HELP_STRING([--with-opt=debug], [compile for debugging (default)]),
-[
- case "$withval" in
- yes)
- optflags="-O3"
- ;;
- small)
- optflags="-Os -fomit-frame-pointer -DNDEBUG"
- ;;
- no|debug)
- optflags="-g"
- ;;
- *)
- optflags="$withval"
- ;;
- esac
-])
-AC_CACHE_CHECK([what compiler optimizations to apply], [optflags], [optflags="-g"])
-AC_DEFINE(_XOPEN_SOURCE, 500, [Conform to Single Unix Specification.])
-CDEBUGFLAGS="$optflags -Wall -pedantic -Wpointer-arith \
- -Wstrict-prototypes -Wmissing-declarations -Wnested-externs"
-AC_SUBST(CDEBUGFLAGS)
-
-AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
-AC_CONFIG_FILES([xcb.pc])
+if test "x$GCC" = xyes ; then
+ CWARNFLAGS="-Wall -pedantic -Wpointer-arith \
+ -Wstrict-prototypes -Wmissing-declarations -Wnested-externs"
+else
+ AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
+ if test "x$SUNCC" = "xyes"; then
+ CWARNFLAGS="-v"
+ fi
+fi
+AC_SUBST(CWARNFLAGS)
+
+GCC_CHECK_VISIBILITY()
+
+# htmldir is not defined prior to autoconf 2.59c, so on earlier versions
+# set an equivalent value.
+AC_PREREQ([2.59c], [], [AC_SUBST([htmldir], [m4_ifset([AC_PACKAGE_TARNAME],
+ ['${datadir}/doc/${PACKAGE_TARNAME}'],
+ ['${datadir}/doc/${PACKAGE}'])
+])])
+AM_CHECK_DOXYGEN()
+
+AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile doc/Makefile])
+AC_CONFIG_FILES([xcb.pc xcb-xlib.pc xcb-composite.pc xcb-damage.pc xcb-dpms.pc xcb-glx.pc xcb-randr.pc xcb-record.pc xcb-render.pc xcb-res.pc xcb-screensaver.pc xcb-shape.pc xcb-shm.pc xcb-sync.pc xcb-xevie.pc xcb-xf86dri.pc xcb-xfixes.pc xcb-xinerama.pc xcb-xprint.pc xcb-xtest.pc xcb-xv.pc xcb-xvmc.pc])