Meet AX_CHECK_LIB_USING_HEADER. Also threw X11 back in because why the hell not. configure actually completes successfully now.

This commit is contained in:
Ben "root" Anderson
2013-10-24 17:31:34 -05:00
parent dfbda90abe
commit 7820c29bb4
5 changed files with 51 additions and 36 deletions
+24
View File
@@ -0,0 +1,24 @@
dnl AX_CHECK_LIB_USING_HEADER(lib, function, header, [action-if-found], [action-if-not-found])
dnl As AC_CHECK_LIB except "function" must be a fully valid function call and "header" the header file in which that function is defined. The benefit is that this can find functions whose symbols have been decorated, e.g. a lot of MinGW stuff.
AC_DEFUN([AX_CHECK_LIB_USING_HEADER],
[
dnl # On Windows OpenGL functions' library symbols don't match their function names. So we have to do it the hard way.
AC_MSG_CHECKING(for $2 in $1 using $3)
AC_LANG_PUSH(C)
LIBS_SAVE=$LIBS
LIBS="$LIBS -l$1"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <$3>], [$2])],
[AC_MSG_RESULT(yes)
$4],
[AC_MSG_RESULT(no)
$5]
)
LIBS=$LIBS_SAVE
AC_LANG_POP(C)
])
+4 -5
View File
@@ -2,11 +2,10 @@ AC_DEFUN([SM_BZIP],
[
AC_REQUIRE([SM_STATIC])
dnl # XXX: AC_CHECK_LIB doesn't work correctly on MinGW for BZip.
dnl # Hardcoding it because I'm so fed up with this shit.
if test "$host_os" != "mingw32"; then
AC_CHECK_LIB(bz2, BZ2_bzCompressInit, have_bzip=yes, have_bzip=no)
fi
AX_CHECK_LIB_USING_HEADER(bz2,
'BZ2_bzCompressInit((bz_stream*) NULL, 0, 0, 0)',
bzlib.h, have_bzip=yes, have_bzip=no)
AC_CHECK_HEADER(bzlib.h, have_bzip_header=yes, have_bzip_header=no)
AC_ARG_WITH(static-bzip, AS_HELP_STRING([--with-static-bzip],[Statically link bzip]), with_static_bzip=$withval, with_static_bzip=no)
+2 -22
View File
@@ -1,23 +1,3 @@
AC_DEFUN([SM_OPENGL_TRY_LIB],
[
dnl # On Windows OpenGL functions' library symbols don't match their function names. So we have to do it the hard way.
AC_MSG_CHECKING(for glBegin in $1)
AC_LANG_PUSH(C)
LIBS_SAVE=$LIBS
LIBS="$LIBS $1"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <GL/gl.h>], [glBegin(GL_POINTS)])],
[AC_MSG_RESULT(yes)
$2],
AC_MSG_RESULT(no)
)
LIBS=$LIBS_SAVE
AC_LANG_POP(C)
])
AC_DEFUN([SM_OPENGL],
[
@@ -28,10 +8,10 @@ AC_DEFUN([SM_OPENGL],
GL_LIBS=""
SM_OPENGL_TRY_LIB(-lGL, [GL_LIBS="-lGL"])
AX_CHECK_LIB_USING_HEADER(GL, 'glBegin(GL_POINTS)', GL/gl.h, [GL_LIBS="-lGL"])
if test x$GL_LIBS = "x"; then
SM_OPENGL_TRY_LIB(-lopengl32, [GL_LIBS="-lopengl32"])
AX_CHECK_LIB_USING_HEADER(opengl32, 'glBegin(GL_POINTS)', GL/gl.h, [GL_LIBS="-lopengl32"])
fi
if test x$GL_LIBS = "x"; then
AC_MSG_ERROR("No usable OpenGL library found.")