Add a new (custom) macro AC_AGI_COMPILE to help with writing tests that use the

headers+libraries into runnable programs.  Hopefully this will solve all the
-dev package situations on Linux.

Originally committed to SVN as r2113.
This commit is contained in:
Amar Takhar 2008-03-22 19:43:23 +00:00
parent a8cf14b714
commit 28a6ceab78
3 changed files with 30 additions and 0 deletions

View file

@ -1,3 +1,4 @@
m4_include([m4macros/ac_agi.m4])
m4_include([m4macros/ac_flag.m4])
m4_include([m4macros/acx_pthread.m4])
m4_include([m4macros/ax_check_gl.m4])

View file

@ -148,6 +148,21 @@ fi
AC_SUBST(GL_CFLAGS)
AC_SUBST(GL_LIBS)
#XXX: This needs to be fixed for OSX.
AC_AGI_COMPILE([OpenGL], [opengl], [$GL_CFLAGS], [$GL_LIBS],[
#include <GL/gl.h>
#include <X11/Xlib.h>
#include <GL/glx.h>
int main(void) {
glXCreateContext(NULL, NULL, NULL, True);
glFinish();
return 0;
}])
if test "$agi_with_opengl" = "no"; then
AC_MSG_FAILURE([Please install a working OpenGL library.])
fi
PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.7.0,
AC_DEFINE(WITH_FREETYPE2, 1, [Enable FreeType 2 support.]),
[AC_MSG_FAILURE([aegisub requires >= FreeType2 2.1.9])])

14
m4macros/ac_agi.m4 Normal file
View file

@ -0,0 +1,14 @@
AC_DEFUN([AC_AGI_COMPILE],[
aegisub_save_LDFLAGS="$LDFLAGS"
aegisub_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$3"
LDFLAGS="$4"
AC_CACHE_CHECK(
[wether $1 works], [agi_with_$2],
[AC_COMPILE_IFELSE([$5],
[eval agi_with_$2="yes"],
[eval agi_with_$2="no"])
])
CPPFLAGS="$aegisub_save_CPPFLAGS"
LDFLAGS="$aegisub_save_LDFLAGS"
])