OSDN Git Service

Fix some warnings, fixes #3
[android-x86/external-s2tc.git] / configure.ac
index 3f516b2..2500ee3 100644 (file)
@@ -1,9 +1,32 @@
 AC_INIT([s2tc], [0.1], [divVerent@xonotic.org])
-C_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([-Wall foreign])
-AC_PROG_CC
+
+have_CXXFLAGS=${CXXFLAGS+set}
+AC_PROG_CXX
+# better default optimization flags for g++, please
+if test "$have_CXXFLAGS" != set; then
+       if test "$GXX" = yes; then
+               CXXFLAGS="-g -O3"
+       fi
+fi
+
 AC_PROG_LIBTOOL
 
-AC_CONFIG_FILES([Makefile libtxc_dxtn.pc])
+AC_ARG_ENABLE(runtime-linking, AS_HELP_STRING([--disable-runtime-linking], [Do not load the library at runtime (faster startup, more dependencies)]), [enable_runtime_linking=$enableval], [enable_runtime_linking=yes])
+AC_ARG_ENABLE(tools, AS_HELP_STRING([--disable-tools], [Do not build the s2tc_compress and s2_decompress tools]), [enable_tools=$enableval], [enable_tools=yes])
+AC_ARG_ENABLE(lib, AS_HELP_STRING([--disable-lib], [Do not build the included libtxc_dxtn library for S2TC]), [enable_lib=$enableval], [enable_lib=yes])
+
+AM_CONDITIONAL(ENABLE_RUNTIME_LINKING, [test x"$enable_runtime_linking" != xno])
+AM_CONDITIONAL(ENABLE_TOOLS, [test x"$enable_tools" != xno])
+AM_CONDITIONAL(ENABLE_LIB, [test x"$enable_lib" != xno])
+
+AC_CHECK_HEADERS([GL/gl.h], , [AC_MSG_ERROR([OpenGL includes not found])])
+
+AS_IF([test x"$enable_runtime_linking" = xno], ,
+       [AS_IF([test x"$enable_dlopen" != xno], ,
+               [AC_MSG_ERROR([dynamic linking not possible, try --disable-runtime-linking])])])
+
+AC_CONFIG_FILES([Makefile txc_dxtn.pc])
 
 AC_OUTPUT