dnl Process this file with autoconf to produce a configure script. dnl---------------------------------------------------------- dnl configure.in for Kobo Deluxe - David Olofson, 2001-2007 dnl Some tests stolen from SDL (http://www.libsdl.org) dnl---------------------------------------------------------- AC_INIT(Makefile.am) AC_CONFIG_SRCDIR([Makefile.am]) AM_CONFIG_HEADER(aconfig.h) AC_CANONICAL_HOST AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(KoboDeluxe, 0.5.1) dnl (For Extreme Pickyness Mode) LOCALCFLAGS='' dnl------------------------------------------------------- dnl Look for X dnl------------------------------------------------------- dnl *MUST* be out here! Pretty much everything breaks on dnl some targets if they're inside the case statement... AC_PATH_X AC_PATH_XTRA dnl------------------------------------------------------- dnl Detect target platform and build style dnl------------------------------------------------------- AC_MSG_CHECKING(target platform and install style); build_macosx_bundle=no build_simple_bundle=no unix_scoredir=yes DATADIR='$(datadir)/kobo-deluxe' SCOREDIR='$(sharedstatedir)/kobo-deluxe/scores' CONFIGDIR='HOME>>' CONFIGFILE='.kobodlrc' EXEFILE=kobodl case "$target_os" in linux*) AC_MSG_RESULT(GNU/Linux; Un*x style) MATHLIB="-lm" if test x$have_x = xyes; then CFLAGS="$CFLAGS $X_CFLAGS" fi ;; beos) AC_MSG_RESULT(BeOS; Un*x style install) MATHLIB="" ;; mingw32*) AC_MSG_RESULT(Win32 (mingw32); Simple bundle) build_simple_bundle=yes unix_scoredir=no DATADIR='EXE>>' SCOREDIR='EXE>>scores' CONFIGDIR='EXE>>' CONFIGFILE='kobodl.cfg' EXEFILE=kobodl.exe MATHLIB="" ;; cygwin*) AC_MSG_RESULT(Win32 (cygwin); Simple bundle) build_simple_bundle=yes unix_scoredir=no DATADIR='EXE>>' SCOREDIR='EXE>>scores' CONFIGDIR='EXE>>' CONFIGFILE='kobodl.cfg' EXEFILE=kobodl.exe MATHLIB="" ;; darwin*) AC_MSG_RESULT(Mac OS X/Darwin; Mac OS X bundle) build_macosx_bundle=yes DATADIR='EXE>>../Resources' SCOREDIR='/Library/Preferences/KoboDeluxe/scores' CONFIGDIR='HOME>>Library/Preferences' CONFIGFILE='KoboDeluxe Preferences' MATHLIB="" ;; aix*) AC_MSG_RESULT(AIX; Un*x style) if test x$ac_cv_c_compiler_gnu = xyes; then CFLAGS="-mthreads" fi if test x$have_x = xyes; then CFLAGS="$CFLAGS $X_CFLAGS" fi ;; solaris*) AC_MSG_RESULT(Solaris SPARC; Un*x style) MATHLIB="-lm" CFLAGS="$CFLAGS $X_CFLAGS" ;; *) AC_MSG_RESULT(Unknown (assuming Un*x-like); Un*x style) MATHLIB="-lm" if test x$have_x = xyes; then CFLAGS="$CFLAGS $X_CFLAGS" fi ;; esac AM_CONDITIONAL(BUILD_MACOSX_BUNDLE, test x$build_macosx_bundle = xyes) AM_CONDITIONAL(BUILD_SIMPLE_BUNDLE, test x$build_simple_bundle = xyes) AM_CONDITIONAL(UNIX_SCOREDIR, test x$unix_scoredir = xyes) AC_SUBST(DATADIR) AC_SUBST(SCOREDIR) AC_SUBST(CONFIGDIR) AC_SUBST(CONFIGFILE) AC_SUBST(EXEFILE) AC_SUBST(MATHLIB) dnl------------------------------------------------------- dnl Checks for debug mode dnl------------------------------------------------------- AC_ARG_ENABLE(debug, [ --enable-debug Build with debug switches and defines [default=no]], , enable_debug=no) AC_MSG_CHECKING(for debug build) if test x$enable_debug = xyes; then CFLAGS="$CFLAGS -g -DDEBUG" CXXFLAGS="$CXXFLAGS -g -DDEBUG" fi AC_MSG_RESULT($enable_debug) dnl------------------------------------------------------- dnl Checks for programs. dnl------------------------------------------------------- AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL AC_PROG_AWK AC_PROG_RANLIB dnl------------------------------------------------------- dnl Checks for SDL dnl------------------------------------------------------- SDL_VERSION=1.2.0 AM_PATH_SDL($SDL_VERSION,:, AC_MSG_ERROR([*** SDL version $SDL_VERSION required!]) ) CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" dnl------------------------------------------------------- dnl Checks for SDL_image dnl------------------------------------------------------- AC_CHECK_LIB(SDL_image, IMG_Load,, AC_MSG_ERROR([You need the SDL_image library to compile this software. Get it at http://www.libsdl.org/projects/SDL_image/]), -lSDL ) LIBS="$LIBS -lSDL_image" dnl------------------------------------------------------- dnl Checks for OpenGL dnl------------------------------------------------------- AC_MSG_CHECKING(for OpenGL support) have_opengl=no AC_TRY_COMPILE([ #if defined(__APPLE__) && defined(__MACH__) #include #else #include #endif ],[ ],[ have_opengl=yes ]) AC_ARG_ENABLE(opengl, [ --enable-opengl use OpenGL rendering layer [default=yes]], , enable_opengl=yes) if test x$enable_opengl = xyes; then AC_MSG_RESULT($have_opengl) else have_opengl=no AC_MSG_RESULT(Disabled) fi if test x$have_opengl = xyes; then CFLAGS="$CFLAGS -DHAVE_OPENGL" CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL" fi dnl------------------------------------------------------- dnl Checks for header files. dnl------------------------------------------------------- AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_TIME AC_CHECK_HEADERS(errno.h fcntl.h stdlib.h string.h) AC_CHECK_HEADERS(sys/ioctl.h sys/time.h unistd.h) AC_CHECK_HEADERS(SDL/SDL_opengl.h) dnl------------------------------------------------------- dnl Checks for typedefs, structures, and compiler characteristics. dnl------------------------------------------------------- AC_C_CONST AC_C_INLINE AC_TYPE_SIGNAL dnl------------------------------------------------------- dnl Checks for library functions. dnl------------------------------------------------------- AC_CHECK_FUNCS(strdup strstr strchr strrchr) AC_CHECK_FUNCS(snprintf _snprintf vsnprintf _vsnprintf) AC_CHECK_FUNCS(pow sqrt) AC_CHECK_FUNCS(munmap mkdir select stat) AC_CHECK_FUNCS(atexit floor memmove memset memcmp) AC_CHECK_FUNCS(gettimeofday) AC_CHECK_FUNCS(getegid setgid) AC_FUNC_MEMCMP AC_FUNC_STRTOD AC_FUNC_VPRINTF AC_FUNC_MMAP dnl AC_FUNC_MALLOC AC_FUNC_STAT AC_PROG_GCC_TRADITIONAL dnl------------------------------------------------------- dnl See if the OSS audio interface is supported (from SDL) dnl------------------------------------------------------- AC_MSG_CHECKING(for OSS audio support) if test x$enable_oss = xyes; then have_oss=no if test x$have_oss != xyes; then AC_TRY_COMPILE([ #include ],[ int arg = SNDCTL_DSP_SETFRAGMENT; ++arg; ],[ have_oss=yes ]) fi if test x$have_oss != xyes; then AC_TRY_COMPILE([ #include ],[ int arg = SNDCTL_DSP_SETFRAGMENT; ],[ have_oss=yes CFLAGS="$CFLAGS -DOSS_USE_SOUNDCARD_H" CXXFLAGS="$CXXFLAGS -DOSS_USE_SOUNDCARD_H" ]) fi fi AC_ARG_ENABLE(oss, [ --enable-oss support the OSS audio API [default=no]], , enable_oss=no) if test x$enable_oss = xyes; then AC_MSG_RESULT($have_oss) else have_oss=no AC_MSG_RESULT(Disabled) fi if test x$have_oss = xyes; then CFLAGS="$CFLAGS -DHAVE_OSS" CXXFLAGS="$CXXFLAGS -DHAVE_OSS" fi dnl------------------------------------------------------- dnl See if the ALSA audio interface is supported (from SDL) dnl------------------------------------------------------- AC_CHECK_HEADER(sys/asoundlib.h, have_alsa_hdr=yes) AC_CHECK_LIB(asound, snd_pcm_open, have_alsa_lib=yes) AC_MSG_CHECKING(for ALSA audio support) have_alsa=no if test x$have_alsa_hdr = xyes -a x$have_alsa_lib = xyes; then have_alsa=yes fi AC_ARG_ENABLE(alsa, [ --enable-alsa support the ALSA audio API [default=no]], , enable_alsa=no) if test x$enable_alsa = xyes; then AC_MSG_RESULT($have_alsa) else have_alsa=no AC_MSG_RESULT(Disabled) fi if test x$have_alsa = xyes; then CFLAGS="$CFLAGS -DHAVE_ALSA" CXXFLAGS="$CXXFLAGS -DHAVE_ALSA" AUDIO_LIBS="-lasound" else AUDIO_LIBS="" fi AC_SUBST(AUDIO_LIBS) dnl------------------------------------------------------- dnl Checks for Extreme Pickyness Mode dnl We have to put this here, as throwing -Werror dnl into C(XX)FLAGS will cause lots of autoconf dnl tests to fail on some systems. dnl------------------------------------------------------- AC_ARG_ENABLE(epm, [ --enable-epm Compile with extremely picky settings [default=no]], , enable_epm=no) AC_MSG_CHECKING(for Extreme Pickyness Mode) if test x$enable_epm = xyes; then LOCALCFLAGS="$LOCALCFLAGS -Wall -Werror -Wwrite-strings -fno-builtin" fi AC_MSG_RESULT($enable_epm) AC_SUBST(LOCALCFLAGS) dnl------------------------------------------------------- dnl Check if we should use ElectricFence dnl------------------------------------------------------- AC_ARG_ENABLE(efence, [ --enable-efence Link with ElectricFence [default=no]], , enable_efence=no) AC_MSG_CHECKING(if we should use ElectricFence) if test x$enable_efence = xyes; then LIBS="$LIBS -lefence" fi AC_MSG_RESULT($enable_efence) AC_SUBST(LOCALCFLAGS) dnl------------------------------------------------------- dnl Generate output files dnl------------------------------------------------------- AC_OUTPUT([Makefile Info.plist graphics/Makefile sound/Makefile data/Makefile data/sfx/Makefile data/gfx/Makefile eel/Makefile ])