1AC_INIT([s2tc], [0.1], [divVerent@xonotic.org])
2AC_CONFIG_MACRO_DIR([m4])
3AM_INIT_AUTOMAKE([-Wall foreign])
4
5have_CXXFLAGS=${CXXFLAGS+set}
6AC_PROG_CXX
7AM_PROG_AR
8# better default optimization flags for g++, please
9if test "$have_CXXFLAGS" != set; then
10	if test "$GXX" = yes; then
11		CXXFLAGS="-g -O3"
12	fi
13fi
14
15AC_PROG_LIBTOOL
16
17# Disable dependency on libstdc++ for the .so library.
18postdeps_CXX=`echo " $postdeps_CXX " | sed 's, -lstdc++ , ,g'`
19
20AC_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])
21AC_ARG_ENABLE(tools, AS_HELP_STRING([--disable-tools], [Do not build the s2tc_compress and s2_decompress tools]), [enable_tools=$enableval], [enable_tools=yes])
22AC_ARG_ENABLE(lib, AS_HELP_STRING([--disable-lib], [Do not build the included libtxc_dxtn library for S2TC]), [enable_lib=$enableval], [enable_lib=yes])
23
24AM_CONDITIONAL(ENABLE_RUNTIME_LINKING, [test x"$enable_runtime_linking" != xno])
25AM_CONDITIONAL(ENABLE_TOOLS, [test x"$enable_tools" != xno])
26AM_CONDITIONAL(ENABLE_LIB, [test x"$enable_lib" != xno])
27
28AC_CHECK_HEADERS([GL/gl.h], , [AC_MSG_ERROR([OpenGL includes not found])])
29
30AS_IF([test x"$enable_runtime_linking" = xno], ,
31	[AS_IF([test x"$enable_dlopen" != xno], ,
32		[AC_MSG_ERROR([dynamic linking not possible, try --disable-runtime-linking])])])
33
34if test x"$enable_runtime_linking" = xyes; then
35	case "$host_os" in
36	linux*)
37		LIBDL_LDADD='-ldl'
38		;;
39	esac
40fi
41AC_SUBST(LIBDL_LDADD)
42
43AC_CONFIG_FILES([Makefile txc_dxtn.pc])
44
45AC_OUTPUT
46