1dnl Process this file with autoconf to produce a configure script. 2AC_INIT(gtkglarea, 2.0.1) 3AC_CONFIG_AUX_DIR(.auto) 4AC_CONFIG_HEADER(config.h) 5AM_INIT_AUTOMAKE([no-define]) 6 7#shared library versioning 8GTKGL_LIBRARY_VERSION=1:1:0 9# | | | 10# +------+ | +---+ 11# | | | 12# current:revision:age 13# | | | 14# | | +- increment if interfaces have been added 15# | | set to zero if interfaces have been removed or changed 16# | +- increment if source code has changed 17# | set to zero if current is incremented 18# +- increment if interfaces have been added, removed or changed 19# 20# Value of current - age. Used by libtool in Win32 DLL names. We need 21# to know the DLL name to build MSVC import libraries. 22LT_CURRENT_MINUS_AGE=1 23 24AC_SUBST(GTKGL_LIBRARY_VERSION) 25AC_SUBST(LT_CURRENT_MINUS_AGE) 26AC_SUBST(VERSION) 27 28dnl Checks for programs. 29AC_PROG_CC 30AC_PROG_CPP 31AC_LIBTOOL_WIN32_DLL 32AM_PROG_LIBTOOL 33AM_SANITY_CHECK 34AM_MAINTAINER_MODE 35 36dnl 37dnl Check for the operating system 38dnl 39AC_MSG_CHECKING([for Win32]) 40case "$host" in 41 *mingw* | pw32* | *cygwin*) 42 native_win32=yes 43 ;; 44 *) 45 native_win32=no 46 ;; 47esac 48AC_MSG_RESULT([$native_win32]) 49AM_CONDITIONAL(OS_WIN32, test "$native_win32" = "yes") 50 51if test "$native_win32" = "yes"; then 52 AC_CHECK_PROG(ms_librarian, lib.exe, yes, no) 53fi 54AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes) 55 56dnl 57dnl Check for GTK libraries 58dnl 59GTK_REQUIRED_VERSION=2.0.0 60PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED_VERSION gmodule-2.0 >= $GTK_REQUIRED_VERSION) 61 62AC_SUBST(GTK_CFLAGS) 63AC_SUBST(GTK_LIBS) 64 65dnl 66dnl Check for GL/MesaGL libraries 67dnl 68AC_ARG_WITH(GL-prefix, [ --with-GL-prefix=DIR Prefix where GL/MesaGL is installed]) 69AC_ARG_WITH(lib-GL, [ --with-lib-GL use '-lGL']) 70AC_ARG_WITH(lib-MesaGL, [ --with-lib-MesaGL use '-lMesaGL']) 71AC_ARG_WITH(lib-opengl32,[ --with-lib-opengl32 use '-lopengl32']) 72 73if test "x$with_GL_prefix" = "x" ; then 74 GL_LDOPTS="" 75 GL_CFLAGS="" 76else 77 GL_LDOPTS="-L$with_GL_prefix/lib" 78 GL_CFLAGS="-I$with_GL_prefix/include" 79fi 80 81saved_LIBS="$LIBS" 82 83AC_MSG_CHECKING([OpenGL]) 84LIBS="$saved_LIBS $GTK_LIBS $GL_LDOPTS -lGL" 85AC_TRY_LINK( ,[ char glBegin(); glBegin(); ], have_GL=yes, 86 LIBS="$saved_LIBS $GTK_LIBS $GL_LDOPTS -lopengl32" 87 [AC_TRY_LINK([ #include <windows.h> 88 #include <GL/gl.h>], 89 [ glBegin(GL_TRIANGLES); ], 90 [have_opengl32=yes 91 have_GL=yes], 92 have_GL=no)]) 93AC_MSG_RESULT($have_GL) 94 95AC_MSG_CHECKING([Mesa]) 96LIBS="$saved_LIBS $GTK_LIBS $GL_LDOPTS -lMesaGL" 97AC_TRY_LINK( ,[ char glBegin(); glBegin(); ], have_MesaGL=yes, have_MesaGL=no) 98AC_MSG_RESULT($have_MesaGL) 99 100if test "x$have_MesaGL" = "xno"; then 101 AC_MSG_CHECKING([Mesa with pthreads]) 102 LIBS="$saved_LIBS $GTK_LIBS $GL_LDOPTS -lMesaGL -lpthread" 103 AC_TRY_LINK( ,[ char glBegin(); glBegin(); ], have_MesaGL_pthread=yes, have_MesaGL_pthread=no) 104 AC_MSG_RESULT($have_MesaGL_pthread) 105fi 106 107LIBS="$saved_LIBS" 108 109if test "x$with_lib_GL" = "xyes"; then 110 111 if test "x$have_GL" = "xyes"; then 112 GL_LIBS="$GL_LDOPTS -lGLU -lGL" 113 else 114 AC_MSG_ERROR([Missing GL library]) 115 fi 116 117elif test "x$with_lib_MesaGL" = "xyes"; then 118 119 if test "x$have_MesaGL" = "xyes"; then 120 GL_LIBS="$GL_LDOPTS -lMesaGLU -lMesaGL" 121 elif test "x$have_MesaGL_pthread" = "xyes"; then 122 GL_LIBS="$GL_LDOPTS -lMesaGLU -lMesaGL -lpthread" 123 else 124 AC_MSG_ERROR([Missing MesaGL library]) 125 fi 126 127elif test "x$with_lib_opengl32" = "xyes"; then 128 129 if test "x$have_opengl32" = "xyes"; then 130 GL_LIBS="$GL_LDOPTS -lglu32 -lopengl32" 131 else 132 AC_MSG_ERROR([Missing OpenGL32 library]) 133 fi 134 135else 136 137 if test "x$have_opengl32" = "xyes"; then 138 GL_LIBS="$GL_LDOPTS -lglu32 -lopengl32" 139 elif test "x$have_GL" = "xyes"; then 140 GL_LIBS="$GL_LDOPTS -lGLU -lGL" 141 elif test "x$have_MesaGL" = "xyes"; then 142 GL_LIBS="$GL_LDOPTS -lMesaGLU -lMesaGL" 143 elif test "x$have_MesaGL_pthread" = "xyes"; then 144 GL_LIBS="$GL_LDOPTS -lMesaGLU -lMesaGL -lpthread" 145 else 146 AC_MSG_ERROR([You need GL or MesaGL libraries]) 147 fi 148 149fi 150 151saved_LIBS="$LIBS" 152AC_MSG_CHECKING([OpenGL shaders]) 153LIBS="$saved_LIBS $GTK_LIBS $GL_LDOPTS $GL_LIBS" 154AC_TRY_LINK( ,[ char glCreateProgram(); glCreateProgram(); ], 155 have_shaders=yes, have_shaders=no) 156AC_MSG_RESULT($have_shaders) 157LIBS="$saved_LIBS" 158AM_CONDITIONAL(HAVE_SHADERS, test "$have_shaders" = "yes") 159 160AC_SUBST(GL_CFLAGS) 161AC_SUBST(GL_LIBS) 162 163CFLAGS="$CFLAGS $GTK_CFLAGS $GL_CFLAGS" 164CFLAGS="$CFLAGS -Wall" 165 166dnl Checks for header files. 167AC_HEADER_STDC 168 169 170dnl Checks for typedefs, structures, and compiler characteristics. 171AC_C_CONST 172 173dnl Checks for library functions. 174 175AC_OUTPUT( 176 Makefile 177 gtkgl-2.0.pc 178 gtkgl/Makefile 179 gtkgl/makefile.mingw 180 docs/Makefile 181 examples/Makefile 182 examples/makefile.mingw 183) 184 185 186echo "---" 187echo "Configuration summary" 188echo "" 189echo " * Installation prefix: $prefix" 190echo " * Win32: $native_win32" 191echo " * OpenGL: $have_GL" 192echo "" 193echo "---" 194