aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: 7cbf67ae52b599a06f0ec0f1f6601ebea6bbacb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
dnl Process this file with autoconf to produce a configure script.

AC_INIT(thrust3d, 0.0.4, taw27@cam.ac.uk)
VERSION=AC_PACKAGE_VERSION

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(thrust3d, "$VERSION")

AC_PROG_CC
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S

AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
AC_C_CONST
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([strdup])

if test -z "$PKG_CONFIG"; then
	AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test "$PKG_CONFIG" = "no" ; then
	echo "*** pkg-config not found.  Do you have pkg-config installed?"
fi

AC_MSG_CHECKING([SDL])
if $PKG_CONFIG sdl ; then
        LIBSDL_CFLAGS=`$PKG_CONFIG --cflags sdl`
        LIBSDL_LIBS=`$PKG_CONFIG --libs sdl`
        AC_MSG_RESULT([yes])
else
        AC_MSG_RESULT([not found])
        AC_MSG_ERROR([
*** SDL not found.  Do you have 'libsdl-dev' or similar installed?])
fi

AC_CHECK_LIB(GL, main, [OPENGL_CFLAGS=-I/usr/include/GL
OPENGL_LIBS=-lGL],  AC_MSG_ERROR([
*** OpenGL not found.  Do you have 'libgl-dev' or similar installed?]))

AC_CHECK_LIB(GLU, main, [GLU_LIBS=-lGLU],  AC_MSG_ERROR([
*** GLU not found.  Do you have 'libglu-dev' or similar installed?]))

AC_CHECK_LIB(GLEW, main, [GLEW_LIBS=-lGLEW],  AC_MSG_ERROR([
*** GLEW not found.  Do you have 'libglew-dev' or similar installed?]))

AC_MSG_CHECKING([libpng])
if $PKG_CONFIG --atleast-version 1.2.0 libpng ; then
        LIBPNG_VERSION=`$PKG_CONFIG --modversion libpng`
        AC_MSG_RESULT($LIBPNG_VERSION)
        LIBPNG_CFLAGS=`$PKG_CONFIG --cflags libpng`
        LIBPNG_LIBS=`$PKG_CONFIG --libs libpng`
else
        AC_MSG_RESULT([Lower than 1.2.0 or not found])
        AC_MSG_ERROR([
*** libPNG not found.  Do you have 'libpng-dev' or similar installed?])
fi

CFLAGS="$CFLAGS $LIBSDL_CFLAGS $OPENGL_CFLAGS $LIBPNG_CFLAGS"
LIBS="$LIBS $LIBSDL_LIBS $OPENGL_LIBS $GLU_LIBS $GLEW_LIBS $LIBPNG_LIBS"

AC_OUTPUT(Makefile src/Makefile data/Makefile)