# Process this file with autoconf to produce a configure script. # Package version number, (as distinct from shared library version) # This must be manually synchronized with the version in src/glitz.h m4_define([GLITZ_VERSION], 0.5.7) AC_INIT(glitz, [GLITZ_VERSION]) AC_CONFIG_AUX_DIR(config) AM_INIT_AUTOMAKE([dist-bzip2 foreign]) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE dnl =========================================================================== # libtool shared library version # Increment if the interface has additions, changes, removals. m4_define([LT_CURRENT], 1) # Increment any time the source changes; set to # 0 if you increment CURRENT m4_define([LT_REVISION], 0) # Increment if any interfaces have been added; set to 0 # if any interfaces have been removed. removal has # precedence over adding, so set to 0 if both happened. m4_define([LT_AGE], 0) VERSION_INFO="LT_CURRENT:LT_REVISION:LT_AGE" AC_SUBST(VERSION_INFO) dnl =========================================================================== AC_ISC_POSIX AC_PROG_CC AC_PROG_CPP AC_PROG_AWK AM_PROG_LIBTOOL AC_STDC_HEADERS if test "x$GCC" = "xyes"; then case " $CFLAGS " in *[[\ \ ]]-Wall[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -Wall" ;; esac case " $CFLAGS " in *[[\ \ ]]-Wpointer-arith[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -Wpointer-arith" ;; esac case " $CFLAGS " in *[[\ \ ]]-Wstrict-prototypes[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -Wstrict-prototypes" ;; esac case " $CFLAGS " in *[[\ \ ]]-Wmissing-prototypes[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;; esac case " $CFLAGS " in *[[\ \ ]]-Wmissing-declarations[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -Wmissing-declarations" ;; esac case " $CFLAGS " in *[[\ \ ]]-Wnested-externs[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -Wnested-externs" ;; esac case " $CFLAGS " in *[[\ \ ]]-fno-strict-aliasing[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -fno-strict-aliasing" ;; esac if test "x$enable_ansi" = "xyes"; then case " $CFLAGS " in *[[\ \ ]]-ansi[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -ansi" ;; esac case " $CFLAGS " in *[[\ \ ]]-pedantic[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -pedantic" ;; esac fi fi AC_C_BIGENDIAN dnl =========================================================================== GLITZ_LIB='-L$(top_builddir)/src -lglitz' GLITZ_INC='-I$(top_builddir)/src -I$(top_srcdir)/src' AC_SUBST(GLITZ_LIB) AC_SUBST(GLITZ_INC) dnl =========================================================================== AC_MSG_CHECKING([for Win32]) case "$host" in *-*-mingw*) native_win32=yes ;; *) native_win32=no LIBM="-lm" ;; esac AC_MSG_RESULT([$native_win32]) AM_CONDITIONAL(OS_WIN32, [test $native_win32 = yes]) AC_SUBST(LIBM) have_gl=yes gl_REQUIRES="gl" PKG_CHECK_MODULES(gl, $gl_REQUIRES,, [ dnl Fallback to searching for headers AC_CHECK_HEADER(GL/gl.h,, [have_gl="no (gl.pc nor OpenGL headers not found)"]) if test "x$have_gl" = "xyes"; then gl_CFLAGS= gl_LIBS="-lGL" fi]) dnl =========================================================================== AC_ARG_ENABLE(glx, AC_HELP_STRING([--disable-glx], [Disable glitz's GLX backend]), [use_glx=$enableval], [use_glx=yes]) AH_TEMPLATE([XTHREADS], [Define if Xlib supports XTHREADS]) if test "x$use_glx" = "xyes"; then AC_PATH_XTRA if test "x$have_x" = "xyes"; then GLX_LIBS="$X_LIBS -lX11 $gl_LIBS" GLX_CFLAGS="$X_CFLAGS $gl_CFLAGS" save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $GLX_CFLAGS $gl_CFLAGS" LIBS="$LIBS $GLX_LIBS $gl_LIBS" AC_MSG_CHECKING([for XTHREADS in Xlib]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[return XInitThreads() == 0 ? 0 : 1;]])], [xthreads=no], [xthreads=yes], [xthreads=yes]) AC_MSG_RESULT($xthreads) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" if test "x$xthreads" = "xyes" then GLX_LIBS="$GLX_LIBS -lpthread" AC_DEFINE(XTHREADS, 1) fi use_glx="yes" else use_glx="no" fi fi if test "x$use_glx" = "xyes"; then AM_CONDITIONAL(GLITZ_BUILD_GLX_BACKEND, true) else AM_CONDITIONAL(GLITZ_BUILD_GLX_BACKEND, false) fi AC_SUBST(GLX_CFLAGS) AC_SUBST(GLX_LIBS) dnl =========================================================================== AC_ARG_ENABLE(agl, AC_HELP_STRING([--disable-agl], [Disable glitz's AGL backend]), [use_agl=$enableval], [use_agl=yes]) AH_TEMPLATE([PTHREADS], [Define if PTHREADS are supported]) if test "x$use_agl" = "xyes"; then AC_MSG_CHECKING([for AGL.framework]) save_libs="$LIBS" LIBS="-framework AGL" AC_TRY_LINK_FUNC(aglCreateContext, [use_agl=yes], [use_agl=no]) LIBS="$save_libs" AC_MSG_RESULT([$use_agl]) if test "x$use_agl" = "xyes"; then save_libs="$LIBS" LIBS="-lpthread" AC_MSG_CHECKING([for PTHREADS]) AC_TRY_LINK_FUNC(pthread_key_create, [use_pthreads=yes], [use_pthreads=no]) LIBS="$save_LIBS" if test "x$use_pthreads" = "xyes" then AGL_LIBS="$AGL_LIBS -lpthread" AC_DEFINE(PTHREADS, 1) fi AC_MSG_RESULT($use_pthreads) fi fi if test "x$use_agl" = "xyes"; then AM_CONDITIONAL(GLITZ_BUILD_AGL_BACKEND, true) else AM_CONDITIONAL(GLITZ_BUILD_AGL_BACKEND, false) fi AC_SUBST(AGL_CFLAGS) AC_SUBST(AGL_LIBS) dnl =========================================================================== AC_ARG_ENABLE(egl, AC_HELP_STRING([--enable-egl], [Enable glitz's EGL backend]), [use_egl=$enableval], [use_egl=no]) if test "x$use_egl" = "xyes"; then EGL_LIBS="-$gl_LIBS -lEGL" EGL_CFLAGS="$gl_CFLAGS $EGL_CFLAGS" save_libs="$LIBS" LIBS="-lpthread" AC_MSG_CHECKING([for PTHREADS]) AC_TRY_LINK_FUNC(pthread_key_create, [use_pthreads=yes], [use_pthreads=no]) LIBS="$save_LIBS" if test "x$use_pthreads" = "xyes" then EGL_LIBS="$EGL_LIBS -lpthread" AC_DEFINE(PTHREADS, 1) fi AC_MSG_RESULT($use_pthreads) fi if test "x$use_egl" = "xyes"; then AM_CONDITIONAL(GLITZ_BUILD_EGL_BACKEND, true) else AM_CONDITIONAL(GLITZ_BUILD_EGL_BACKEND, false) fi AC_SUBST(EGL_CFLAGS) AC_SUBST(EGL_LIBS) dnl =========================================================================== AC_ARG_ENABLE(wgl, AC_HELP_STRING([--disable-wgl], [Disable glitz's WGL backend]), [use_wgl=$enableval], [use_wgl=yes]) if test "x$use_wgl" = "xyes"; then AC_MSG_CHECKING([for WGL]) WGL_LIBS="-lopengl32 -lgdi32" WGL_CFLAGS="" save_libs="$LIBS" LIBS="$WGL_LIBS" AC_TRY_LINK([#include ], [int main() { wglCreateContext(0); }], [use_wgl=yes], [use_wgl=no]) LIBS="$save_libs" AC_MSG_RESULT([$use_wgl]) fi if test "x$use_wgl" = "xyes"; then AM_CONDITIONAL(GLITZ_BUILD_WGL_BACKEND, true) else AM_CONDITIONAL(GLITZ_BUILD_WGL_BACKEND, false) WGL_LIBS="" WGL_CFLAGS="" fi AC_SUBST(WGL_CFLAGS) AC_SUBST(WGL_LIBS) dnl =========================================================================== AC_OUTPUT([ Makefile src/Makefile src/glx/Makefile src/agl/Makefile src/egl/Makefile src/wgl/Makefile src/glitz.pc src/glx/glitz-glx.pc src/agl/glitz-agl.pc src/egl/glitz-egl.pc src/wgl/glitz-wgl.pc ]) dnl =========================================================================== echo "" echo "glitz will be compiled with the following backends:" echo " GLX: $use_glx" echo " AGL: $use_agl" echo " EGL: $use_egl" echo " WGL: $use_wgl" echo ""