1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.61)
5
6AC_INIT(Gource, 0.51, [acaudwell@gmail.com])
7AC_CONFIG_AUX_DIR([build-aux])
8AC_CONFIG_SRCDIR([src/main.h])
9AM_INIT_AUTOMAKE([dist-bzip2 foreign subdir-objects])
10
11AC_CANONICAL_HOST
12
13# Checks for programs.
14AC_PROG_CXX
15AC_LANG(C++)
16
17AC_CHECK_FUNCS([timegm unsetenv])
18
19#Disable X11 on Macs unless required
20AS_IF([test "$with_x" != yes], [
21    case "$host_os" in
22    darwin*)
23        with_x="no"
24        LIBS="$LIBS -framework CoreFoundation"
25    ;;
26    esac
27], [])
28
29#GL
30AX_CHECK_GL
31AX_CHECK_GLU
32CXXFLAGS="$CXXFLAGS $GL_CFLAGS $GLU_CFLAGS"
33CPPFLAGS="$CPPFLAGS $GL_CFLAGS $GLU_CFLAGS"
34LIBS="$LIBS $GL_LIBS $GLU_LIBS"
35
36PKG_CHECK_MODULES([FT2], [freetype2 >= 9.0.3])
37PKG_CHECK_MODULES([PCRE], [libpcre])
38PKG_CHECK_MODULES([GLEW], [glew])
39PKG_CHECK_MODULES([SDL2], [sdl2 SDL2_image]);
40PKG_CHECK_MODULES([PNG], [libpng >= 1.2])
41
42CPPFLAGS="${CPPFLAGS} ${FT2_CFLAGS} ${PCRE_CFLAGS} ${GLEW_CFLAGS} ${SDL2_CFLAGS} ${PNG_CFLAGS}"
43LIBS="${LIBS} ${FT2_LIBS} ${PCRE_LIBS} ${GLEW_LIBS} ${SDL2_LIBS} ${PNG_LIBS}"
44
45AC_CHECK_FUNCS([IMG_LoadPNG_RW], , AC_MSG_ERROR([SDL2_image with PNG support required. Please see INSTALL]))
46AC_CHECK_FUNCS([IMG_LoadJPG_RW], , AC_MSG_ERROR([SDL2_image with JPEG support required. Please see INSTALL]))
47
48#BOOST
49AX_BOOST_BASE([1.46], , AC_MSG_ERROR(Boost Filesystem >= 1.46 is required. Please see INSTALL))
50AX_BOOST_SYSTEM
51AX_BOOST_FILESYSTEM
52
53CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
54LIBS="$LIBS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB"
55
56AC_ARG_ENABLE(font-file,[AS_HELP_STRING([--enable-font-file=FILE],[override the default font])],[gourcefontfile="$enableval"],[gourcefontfile=""])
57AM_CONDITIONAL([FONTFILE], [test "x$gourcefontfile" != "x"])
58AC_SUBST(gourcefontfile)
59
60#see if ttf-font-dir option is enabled
61AC_ARG_ENABLE(ttf-font-dir,[AS_HELP_STRING([--enable-ttf-font-dir=DIR],[directory containing GNU FreeFont TTF fonts])],[gourcefontdir="$enableval"],[gourcefontdir=""])
62AM_CONDITIONAL([FONTDIR], [test "x$gourcefontdir" != "x"])
63AC_SUBST(gourcefontdir)
64
65#GLM
66AC_CHECK_HEADER([glm/glm.hpp],, AC_MSG_ERROR(GLM headers are required. Please see INSTALL))
67
68#see if building against system TinyXML library
69use_tinyxml_system_library=no
70AC_ARG_WITH(tinyxml, AC_HELP_STRING([--with-tinyxml], [Use system installed TinyXML library]), use_tinyxml_system_library=$withval)
71if test "x$use_tinyxml_system_library" = "xyes"; then
72    AC_HAVE_LIBRARY(tinyxml,, AC_MSG_ERROR([TinyXML library was requested but not found]))
73fi
74AM_CONDITIONAL(USE_BUNDLED_TINYXML, test "x$use_tinyxml_system_library" != "xyes")
75
76AC_CONFIG_FILES([Makefile])
77AC_OUTPUT
78