Change the WX tests for OpenGL and StyledTextControl to use AC_AGI_LINK, which

is similar to AC_AGI_COMPILE, instead it checks for a header + links the library
in seperate tests.

Originally committed to SVN as r2140.
This commit is contained in:
Amar Takhar 2008-03-25 00:24:39 +00:00
parent cd177995d2
commit d82bf5ec6f
2 changed files with 48 additions and 31 deletions

View File

@ -707,48 +707,41 @@ AM_OPTIONS_WXCONFIG
AM_PATH_WXCONFIG(2.8.1, [have_wxconfig=1], [have_wxconfig=0], [std,gl,stc]) AM_PATH_WXCONFIG(2.8.1, [have_wxconfig=1], [have_wxconfig=0], [std,gl,stc])
if test "$have_wxconfig" != 1; then if test "$have_wxconfig" != 1; then
AC_MSG_FAILURE([ AC_MSG_FAILURE([wxWidgets detection failed, please set --with-wx* or add
wxWidgets detection failed, please set --with-wx* or add the libraries to your LDFLAGS, CXX/CFLAGS.])
the libraries to your LDFLAGS, CXX/CFLAGS.
])
fi fi
aegisub_save_CPPLAGS="$CPPLAGS" aegisub_save_CPPLAGS="$CPPLAGS"
CPPFLAGS="$WX_CFLAGS" CPPFLAGS="$WX_CFLAGS"
AC_ARG_ENABLE(wx-opengl, [ --enable-wx-opengl Force wxwidgets OpenGL support. ]) AC_ARG_ENABLE(wx-opengl, [ --enable-wx-opengl Force wxwidgets OpenGL support. ])
AC_MSG_CHECKING([wxWidgets OpenGL support])
if test "$enable_wx_opengl" != "yes"; then AC_AGI_LINK([wxWidgets OpenGL support], [wxopengl], [wx/glcanvas.h], [$GL_CFLAGS $WX_CFLAGS], [$GL_LIBS $WX_LIBS],[
AC_TRY_COMPILE([#include <wx/glcanvas.h>], #include <wx/glcanvas.h>
[wxGLCanvas *canvas;], int main(void) {
with_wxgl=yes, with_wxgl=no) wxGLCanvas *canvas;
else return 0;
with_wxgl="yes" }])
fi
AC_MSG_RESULT($with_wxgl) if test "$with_agi_wxopengl" = "no"; then
if test "$with_wxgl" = "no"; then
AC_MSG_FAILURE([wxWidgets OpenGL support missing]) AC_MSG_FAILURE([wxWidgets OpenGL support missing])
fi fi
AC_ARG_ENABLE(wx-styledtextctrl, [ --enable-wx-styledtextctrl AC_ARG_ENABLE(wx-styledtextctrl, [ --enable-wx-styledtextctrl
Force wxwidgets StyledTextCtrl support.]) Force wxwidgets StyledTextCtrl support.])
AC_MSG_CHECKING([wxWidgets StyledTextCtrl support])
if test "$enable_wx_styledtextctrl" != "yes"; then AC_AGI_LINK([wxWidgets StyledTextCtrl support], [wxstc], [wx/stc/stc.h], [$WX_CFLAGS], [$WX_LIBS],[
AC_TRY_COMPILE([#include <wx/stc/stc.h>], #include <wx/stc/stc.h>
[wxStyledTextCtrl *canvas;], int main(void) {
with_wxstc=yes, with_wxstc=no) wxStyledTextCtrl *canvas;
else return 0;
with_wxstc="yes" }
])
if test "$with_agi_wxstc" = "no"; then
AC_MSG_FAILURE([wxWidgets StyledTextCtrl support missing])
fi fi
AC_MSG_RESULT($with_wxstc)
if test "$with_wxstc" = "no"; then
AC_MSG_FAILURE([wxWidgets missing StyledTextCtrl])
fi
CPPFLAGS="$aegisub_save_CPPFLAGS"
################################################ ################################################

View File

@ -12,3 +12,27 @@ AC_DEFUN([AC_AGI_COMPILE],[
CPPFLAGS="$aegisub_save_CPPFLAGS" CPPFLAGS="$aegisub_save_CPPFLAGS"
LDFLAGS="$aegisub_save_LDFLAGS" LDFLAGS="$aegisub_save_LDFLAGS"
]) ])
AC_DEFUN([AC_AGI_LINK],[
aegisub_save_CPPFLAGS="$CPPFLAGS"
aegisub_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$4"
CXXFLAGS="$CPPFLAGS"
AC_CHECK_HEADER([$3],[agi_header="yes"], [agi_header="no"])
if test "$agi_header" = "yes"; then
aegisub_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$5"
AC_CACHE_CHECK(
[whether $1 works], [agi_with_$2],
[AC_LINK_IFELSE([$6],
[eval agi_with_$2="yes"],
[eval agi_with_$2="no"])
])
LDFLAGS="$aegisub_save_LDFLAGS"
else
eval agi_with_$2="no"
fi
CPPFLAGS="$aegisub_save_CPPFLAGS"
CXXFLAGS="$aegisub_save_CXXFLAGS"
])