1dnl Initialise autoconf 2 3AC_INIT([sage], [0.2.0]) 4AC_CONFIG_HEADERS([config.h]) 5 6dnl Detect the canonical host and target build environment 7AC_CANONICAL_SYSTEM 8 9SAGE_CURRENT=2 10SAGE_REVISION=0 11SAGE_AGE=0 12SAGE_VERSION_INFO=$SAGE_CURRENT:$SAGE_REVISION:$SAGE_AGE 13 14AC_SUBST(SAGE_VERSION_INFO) 15 16SAGE_REQUIRES="" 17 18AM_INIT_AUTOMAKE([check-news]) 19 20dnl Need libtool 21AC_LIBTOOL_WIN32_DLL 22AM_PROG_LIBTOOL 23AC_PROG_CC 24#AC_MINGW32 25#AC_CYGWIN 26AC_EXEEXT 27 28case "$target" in 29 *-*-darwin* | *-*-macos*) 30 AC_TRY_COMPILE([ 31 #include <OpenGL/gl.h> 32 ],[ 33 ],[ 34 LIBS="$LIBS -framework OpenGL -framework AGL" 35 ],[ 36 AC_TRY_COMPILE([ 37 #include <GL/gl.h> 38 ],[ 39 ],[ 40 LIBS="$LIBS -lGL" 41 ],[ 42 AC_MSG_ERROR(Cannot find OpenGL) 43 ]) 44 ]) 45 ;; 46 *-*-linux*) 47 AC_PATH_X 48 AC_PATH_XTRA 49 50 AC_CHECK_LIB(GL,glViewport, [ 51 LIBS="$LIBS -lGL" 52 ],[ 53 AC_MSG_ERROR(Couldn't find OpenGL) 54 ]) 55esac 56 57case "$host_os" in 58 *cygwin* | *mingw32*) 59 LIBS="$LIBS -lopengl32" 60esac 61 62if test "$enable_shared" = yes; then 63 if test "x$CYGWIN" = xyes -o "x$MINGW32" = xyes; then 64 SAGE_DLL=sage.dll 65 AC_SUBST(SAGE_DLL) 66 AC_CHECK_TOOL(DLLWRAP, dllwrap) 67 AC_CHECK_TOOL(DLLTOOL, dlltool) 68 BUILD_IT=true 69 else 70 BUILD_IT=false 71 fi 72else 73 BUILD_IT=false 74fi 75 76AM_CONDITIONAL(BUILD_DLL, test x$SAGE_DLL = xsage.dll, true, false) 77AC_SUBST(BUILD_IT) 78 79 80AC_ARG_ENABLE(debug, 81 [ --enable-debug enable debug information [default=no]], 82 [ 83 if test "$enableval" = "yes"; then 84 CFLAGS="$CFLAGS -ggdb -O0 -DDEBUG" 85 else 86 CFLAGS="$CFLAGS -O3 -DNDEBUG" 87 fi 88 ],[ 89 CFLAGS="$CFLAGS -O3 -DNDEBUG" 90 ] 91) 92 93dnl Set compile only flag 94CFLAGS="$CFLAGS -DSAGE_COMPILE" 95 96dnl Check SDL 97SDL_VERSION=1.2.2 98AC_SUBST(SDL_VERSION) 99AM_PATH_SDL($SDL_VERSION, [ 100CFLAGS="$CFLAGS $SDL_CFLAGS" 101LIBS="$LIBS $SDL_LIBS" 102], 103[ 104 AC_MSG_ERROR(Couldn't find SDL or insufficent version found. Please goto http://www.libsdl.org/ and get at least version $SDL_VERSION) 105]) 106 107 108#AC_CHECK_HEADER(windows.h, [], []) 109#AM_CONDITIONAL(BUILD_WGL, test "$ac_cv_header_windows_h" == "yes") 110AM_CONDITIONAL(BUILD_WGL, false) 111 112AC_CHECK_HEADER(X11/Xlib.h, [], []) 113AM_CONDITIONAL(BUILD_GLX, test "$ac_cv_header_X11_Xlib_h" == "yes") 114AM_CONDITIONAL(BUILD_GLX, false) 115 116SAGE_LIBS="-lsage" 117SAGE_CFLAGS="" 118 119AC_SUBST(SAGE_REQUIRES) 120AC_SUBST(SAGE_LIBS) 121AC_SUBST(SAGE_CFLAGS) 122 123AC_SUBST(PREFIX) 124 125 126dnl Generate files 127AC_OUTPUT([ 128 Makefile 129 sage/Makefile 130 sage/header.h 131 templates/Makefile 132 sage.spec 133 sage.pc 134 man/Makefile 135 man/man3/Makefile 136]) 137