configure.ac 5.83 KB
Newer Older
1 2 3 4
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.55])
5
AC_INIT([SLUDGE], [2.2.2], [tobias.han@gmx.de], [sludge], [http://opensludge.github.io/])
6
AC_CONFIG_SRCDIR([source/CommonCode/tga.cpp])
7
AM_INIT_AUTOMAKE([subdir-objects])
8 9 10 11 12 13 14 15 16 17 18 19 20
AC_CONFIG_HEADERS([config.h])

m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
PKG_PROG_PKG_CONFIG()

AC_ARG_ENABLE([engine], [AC_HELP_STRING([--disable-engine], [don't build the SLUDGE Engine])])
AC_ARG_ENABLE([devkit], [AC_HELP_STRING([--enable-devkit], [build the SLUDGE DevKit])])
AC_ARG_ENABLE([doc], [AC_HELP_STRING([--enable-doc], [install the SLUDGE documentation])])
21
AC_ARG_ENABLE([gles2], [AC_HELP_STRING([--enable-gles2], [build engine using OpenGL ES 2.0])])
22 23 24
AC_ARG_ENABLE([pandora], [AC_HELP_STRING([--enable-pandora], [enable hacks for OpenPandora])])
AC_ARG_ENABLE([rpi], [AC_HELP_STRING([--enable-rpi], [enable Raspberry-PI support])])
AC_ARG_ENABLE([odroid], [AC_HELP_STRING([--enable-odroid], [enable ODroid support])])
25 26 27 28 29 30 31 32 33 34 35

# Set default targets:
if test "x$enable_engine" = x; then
  enable_engine="yes"
fi
if test "x$enable_devkit" = x; then
  enable_devkit="no"
fi
if test "x$enable_doc" = x; then
  enable_doc="no"
fi
36 37 38
if test "x$enable_gles2" = x; then
  enable_gles2="no"
fi
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
if test "x$enable_pandora" = x; then
  enable_pandora="no"
fi
if test "x$enable_rpi" = x; then
  enable_rpi="no"
fi
if test "x$enable_odroid" = x; then
  enable_odroid="no"
fi
if test "x$enable_pandora" = xyes; then
  enable_gles2="yes"
fi
if test "x$enable_rpi" = xyes; then
  enable_gles2="yes"
fi
if test "x$enable_odroid" = xyes; then
  enable_gles2="yes"
fi
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

# Are we cross compiling for windows?
case "${host}" in
        i[[3456789]]86-mingw32*) WIN32="yes" ;;
        *cygwin*) WIN32="yes" ;;
        *) WIN32="no" ;;
esac
AM_CONDITIONAL([COND_WIN32], test x"$WIN32" = xyes)

# Always build the Dev Kit for windows:
if test x"$WIN32" = xyes; then
  enable_engine="no"
  enable_devkit="yes"
fi

# Checks for libraries.
73
if test "x$enable_gles2" = xno; then
74
  PKG_CHECK_MODULES([GLEW], [glew])
75 76
else
  if test "x$enable_devkit" = xyes; then
77
    PKG_CHECK_MODULES([GLEW], [glew])
78 79
  fi
fi
80 81

if test "x$enable_engine" = xyes; then
82 83
  PKG_CHECK_MODULES([ENGINE], [sdl alure >= 1.1 openal vorbis ogg vpx])
  AC_CHECK_LIB([dumb], [duh_render], [ENGINE_LIBS="$ENGINE_LIBS -ldumb"], [AC_MSG_ERROR([cannot find DUMB library])])
84
  if test "x$enable_gles2" = xyes; then
85 86 87
    AC_CHECK_LIB([GLESv2], [glEnable], [ENGINE_LIBS="$ENGINE_LIBS -lGLESv2"], [AC_MSG_ERROR([cannot find GLESv2 library])])
    AC_CHECK_LIB([EGL], [eglInitialize], [ENGINE_LIBS="$ENGINE_LIBS -lEGL"], [AC_MSG_ERROR([cannot find EGL library])])
    AC_CHECK_LIB([X11], [XOpenDisplay], [ENGINE_LIBS="$ENGINE_LIBS -lX11"], [AC_MSG_ERROR([cannot find X11 library])])
88 89 90
  else
    PKG_CHECK_MODULES([GL], [gl glu])
  fi
91 92 93 94
fi

if test "x$enable_devkit" = xyes; then
  PKG_CHECK_MODULES([GTK], [gtk+-2.0 gthread-2.0 gobject-2.0 gtkglext-1.0 gmodule-2.0])
95
  PKG_CHECK_MODULES([GLIB], [glib-2.0])
96 97 98 99 100
fi

PKG_CHECK_MODULES([LIBPNG], [libpng])

# Checks for header files.
101 102 103
AC_CHECK_HEADERS([limits.h malloc.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h], [], [AC_MSG_ERROR([cannot find one or more of these header files: limits.h malloc.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])])
AC_CHECK_HEADERS([getopt.h], [], [AC_MSG_ERROR([cannot find getopt header files])])

104
if test "x$enable_engine" = xyes; then
105 106 107 108 109
  AC_CHECK_HEADERS([SDL/SDL.h SDL/SDL_syswm.h], [], [AC_MSG_ERROR([cannot find SDL header files])])
  AC_CHECK_HEADERS([AL/alure.h], [], [AC_MSG_ERROR([cannot find alure header files])])
  AC_CHECK_HEADERS([vpx/vpx_decoder.h], [], [AC_MSG_ERROR([cannot find vpx header files])])
  AC_CHECK_HEADERS([vorbis/codec.h], [], [AC_MSG_ERROR([cannot find vorbis header files])])
  AC_CHECK_HEADERS([ogg/ogg.h], [], [AC_MSG_ERROR([cannot find ogg header files])])
110
  AC_CHECK_HEADERS([dumb.h], [], [AC_MSG_ERROR([cannot find DUMB header files])])
111 112 113 114 115 116 117
  if test "x$enable_gles2" = xyes; then
    AC_CHECK_HEADERS([GLES2/gl2.h], [], [AC_MSG_ERROR([cannot find gles2 header files])])
    AC_CHECK_HEADERS([EGL/egl.h], [], [AC_MSG_ERROR([cannot find egl header files])])
    AC_CHECK_HEADERS([X11/Xlib.h X11/Xutil.h], [], [AC_MSG_ERROR([cannot find x11 header files])])
  else
    AC_CHECK_HEADERS([GL/glu.h], [], [AC_MSG_ERROR([cannot find glu header files])])
  fi
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
fi

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_CHECK_TYPES([ptrdiff_t])

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([atexit getcwd memset mkdir rmdir sqrt strstr strtol])

AM_CONDITIONAL([COND_ENGINE], [test "x$enable_engine" = xyes])
AM_CONDITIONAL([COND_DEVKIT], [test "x$enable_devkit" = xyes])
AM_CONDITIONAL([COND_DOC], [test "x$enable_doc" = xyes])
137
AM_CONDITIONAL([COND_GLES2], [test "x$enable_gles2" = xyes])
138 139 140
AM_CONDITIONAL([COND_PANDORA], [test "x$enable_pandora" = xyes])
AM_CONDITIONAL([COND_RPI], [test "x$enable_rpi" = xyes])
AM_CONDITIONAL([COND_ODROID], [test "x$enable_odroid" = xyes])
141 142 143 144 145 146 147 148 149 150

AC_CONFIG_FILES([Makefile
                 source/Makefile
                 source/Engine/Makefile
                 GTK_Dev_Kit/Makefile
                 GTK_Dev_Kit/support/Makefile
                 doc/Makefile])
AC_OUTPUT

echo "
151
SLUDGE configuration complete.
152
Note that Alure needs VorbisFile and FLAC to provide full sound support for the SLUDGE engine.
153 154 155 156 157 158 159 160 161 162 163 164 165

Will build..."
if test x"$WIN32" = xyes; then
echo "...the SLUDGE DevKit for Windows"
else
echo ""
echo "SLUDGE Engine        ..."$enable_engine
echo "SLUDGE DevKit        ..."$enable_devkit
echo "SLUDGE documentation ..."$enable_doc
echo "
Use the options --disable-engine, --enable-devkit and/or --enable-doc to (de)select components.
"
fi