Add WX_FIND_LIB() function to simplify testing for libraries in configure.
No real changes in behaviour but the new WX_FIND_LIB() function can now be used to test for any library. Closes #13375. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69556 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
65
acinclude.m4
65
acinclude.m4
@@ -115,6 +115,71 @@ AC_DEFUN([WX_LINK_PATH_EXIST],
|
|||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl Usage: WX_FIND_LIB(search-path, lib-name, [lib-function to test])
|
||||||
|
dnl
|
||||||
|
dnl Tests in a variety of ways for the presence of lib-name
|
||||||
|
dnl
|
||||||
|
dnl On success, returns any novel path found in ac_find_libraries; else "std"
|
||||||
|
dnl and any cflags in ac_find_cflags
|
||||||
|
dnl On failure, ac_find_libraries will be empty
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
AC_DEFUN([WX_FIND_LIB],
|
||||||
|
[
|
||||||
|
ac_find_libraries=
|
||||||
|
|
||||||
|
dnl Try with pkg-config first. It requires its lib-name parameter lowercase
|
||||||
|
fl_pkgname=`echo "$2" | tr [[:upper:]] [[:lower:]]`
|
||||||
|
dnl suppress PKG_PROG_PKG_CONFIG output; we don't want to keep seeing it
|
||||||
|
PKG_PROG_PKG_CONFIG() AS_MESSAGE_FD> /dev/null
|
||||||
|
PKG_CHECK_MODULES([$2], [$fl_pkgname],
|
||||||
|
[
|
||||||
|
dnl Start by assuming there are no novel lib paths
|
||||||
|
ac_find_libraries="std"
|
||||||
|
|
||||||
|
dnl A simple copy of the internal vars $2_CFLAGS $2_LIBS doesn't work
|
||||||
|
dnl inside the macro
|
||||||
|
dnl
|
||||||
|
dnl TODO: When we stop being autoconf 2.61 compatible, the next 2 lines
|
||||||
|
dnl should become:
|
||||||
|
dnl AS_VAR_COPY([ac_find_cflags], [$2_CFLAGS])
|
||||||
|
dnl AS_VAR_COPY([fl_libs], [$2_LIBS])
|
||||||
|
eval ac_find_cflags=\$$2_CFLAGS
|
||||||
|
eval fl_libs=\$$2_LIBS
|
||||||
|
|
||||||
|
dnl fl_libs may now contain -Lfoopath -lfoo (only non-standard paths are
|
||||||
|
dnl added) We only want the path bit, not the lib names
|
||||||
|
for fl_path in $fl_libs
|
||||||
|
do
|
||||||
|
if test `echo "$fl_path" | cut -c 1-2` = "-L"; then
|
||||||
|
dnl there shouldn't be >1 novel path
|
||||||
|
dnl return it without the -L, ready for WX_LINK_PATH_EXIST
|
||||||
|
ac_find_libraries=`echo "$fl_path" | cut -c 3-`
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
],
|
||||||
|
[
|
||||||
|
if test "x$ac_find_libraries" = "x"; then
|
||||||
|
dnl Next with AC_CHECK_LIB, if a test function was provided
|
||||||
|
if test "x$3" != "x"; then
|
||||||
|
AC_CHECK_LIB([$2], [$3], [ac_find_libraries="std"])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$ac_find_libraries" = "x"; then
|
||||||
|
dnl Finally try the search path
|
||||||
|
dnl Output a message again, as AC_CHECK_LIB will just have said "no"
|
||||||
|
AC_MSG_CHECKING([elsewhere])
|
||||||
|
WX_PATH_FIND_LIBRARIES([$1],[$2])
|
||||||
|
if test "x$ac_find_libraries" != "x"; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
dnl ===========================================================================
|
dnl ===========================================================================
|
||||||
dnl C++ features test
|
dnl C++ features test
|
||||||
dnl ===========================================================================
|
dnl ===========================================================================
|
||||||
|
69
configure.in
69
configure.in
@@ -3772,18 +3772,17 @@ USE_XINERAMA=0
|
|||||||
if test "$wxUSE_DISPLAY" = "yes"; then
|
if test "$wxUSE_DISPLAY" = "yes"; then
|
||||||
dnl Xinerama is used for wxGTK1/wxX11/wxMotif only
|
dnl Xinerama is used for wxGTK1/wxX11/wxMotif only
|
||||||
if test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$wxUSE_GTK1" = 1; then
|
if test "$wxUSE_MOTIF" = 1 -o "$wxUSE_X11" = 1 -o "$wxUSE_GTK1" = 1; then
|
||||||
AC_MSG_CHECKING([for Xinerama])
|
WX_FIND_LIB([$SEARCH_LIB], Xinerama, XineramaQueryScreens)
|
||||||
WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],Xinerama)
|
|
||||||
if test "$ac_find_libraries" != "" ; then
|
if test "$ac_find_libraries" != "" ; then
|
||||||
WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
|
if test "$ac_find_libraries" != "std" ; then
|
||||||
if test "$ac_path_to_link" != " -L/usr/lib" ; then
|
WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
|
||||||
LDFLAGS="$LDFLAGS $ac_path_to_link"
|
if test "$ac_path_to_link" != " -L/usr/lib" ; then
|
||||||
|
LDFLAGS="$LDFLAGS $ac_path_to_link"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
USE_XINERAMA=1
|
USE_XINERAMA=1
|
||||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXinerama"
|
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXinerama"
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
AC_MSG_WARN([Xinerama not found; disabling wxDisplay])
|
AC_MSG_WARN([Xinerama not found; disabling wxDisplay])
|
||||||
wxUSE_DISPLAY="no"
|
wxUSE_DISPLAY="no"
|
||||||
fi
|
fi
|
||||||
@@ -3796,10 +3795,8 @@ fi
|
|||||||
if test "$wxUSE_DISPLAY" = "yes"; then
|
if test "$wxUSE_DISPLAY" = "yes"; then
|
||||||
dnl wxGTK2 needs Xxf86vm as well as Xinerama-using ports from above
|
dnl wxGTK2 needs Xxf86vm as well as Xinerama-using ports from above
|
||||||
if test "$USE_XINERAMA" = 1 -o "$wxUSE_GTK" = 1; then
|
if test "$USE_XINERAMA" = 1 -o "$wxUSE_GTK" = 1; then
|
||||||
AC_MSG_CHECKING([for Xxf86vm extension])
|
WX_FIND_LIB([$SEARCH_LIB], Xxf86vm, XF86VidModeQueryExtension)
|
||||||
WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],Xxf86vm)
|
|
||||||
if test "$ac_find_libraries" != "" ; then
|
if test "$ac_find_libraries" != "" ; then
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
AC_CHECK_HEADERS([X11/extensions/xf86vmode.h],
|
AC_CHECK_HEADERS([X11/extensions/xf86vmode.h],
|
||||||
[
|
[
|
||||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXxf86vm"
|
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lXxf86vm"
|
||||||
@@ -3810,8 +3807,6 @@ if test "$wxUSE_DISPLAY" = "yes"; then
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#endif
|
#endif
|
||||||
])
|
])
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -3821,17 +3816,16 @@ dnl X11 session management
|
|||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
if test "$wxUSE_DETECT_SM" = "yes"; then
|
if test "$wxUSE_DETECT_SM" = "yes"; then
|
||||||
if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_MAC" != 1 -a "$wxUSE_OLD_COCOA" != 1; then
|
if test "$wxUSE_UNIX" = "yes" -a "$wxUSE_MAC" != 1 -a "$wxUSE_OLD_COCOA" != 1; then
|
||||||
AC_MSG_CHECKING([for -lSM - X11 session management])
|
WX_FIND_LIB([$SEARCH_LIB], SM, SmcOpenConnection)
|
||||||
WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],SM)
|
|
||||||
if test "$ac_find_libraries" != "" ; then
|
if test "$ac_find_libraries" != "" ; then
|
||||||
WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
|
if test "$ac_find_libraries" != "std" ; then
|
||||||
if test "$ac_path_to_link" != " -L/usr/lib" ; then
|
WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
|
||||||
|
if test "$ac_path_to_link" != " -L/usr/lib" ; then
|
||||||
LDFLAGS="$LDFLAGS $ac_path_to_link"
|
LDFLAGS="$LDFLAGS $ac_path_to_link"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lSM"
|
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lSM"
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
AC_MSG_WARN([libSM not found; disabling session management detection])
|
AC_MSG_WARN([libSM not found; disabling session management detection])
|
||||||
wxUSE_DETECT_SM="no"
|
wxUSE_DETECT_SM="no"
|
||||||
fi
|
fi
|
||||||
@@ -3872,48 +3866,43 @@ if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then
|
|||||||
AC_CHECK_HEADER(GL/glu.h, [
|
AC_CHECK_HEADER(GL/glu.h, [
|
||||||
found_gl=0
|
found_gl=0
|
||||||
|
|
||||||
AC_MSG_CHECKING([for -lGL])
|
WX_FIND_LIB([$SEARCH_LIB /opt/graphics/OpenGL/lib], GL, glBegin)
|
||||||
WX_PATH_FIND_LIBRARIES([$SEARCH_LIB /opt/graphics/OpenGL/lib],GL)
|
|
||||||
if test "$ac_find_libraries" != "" ; then
|
if test "$ac_find_libraries" != "" ; then
|
||||||
AC_MSG_RESULT([found in $ac_find_libraries])
|
if test "$ac_find_libraries" != "std" ; then
|
||||||
|
WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
|
||||||
WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
|
if test "$ac_path_to_link" != " -L/usr/lib" ; then
|
||||||
if test "$ac_path_to_link" != " -L/usr/lib" ; then
|
|
||||||
LDFLAGS_GL="$ac_path_to_link"
|
LDFLAGS_GL="$ac_path_to_link"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl don't suppose that libGL and libGLU are always in the
|
dnl don't suppose that libGL and libGLU are always in the
|
||||||
dnl same directory -- this is not true for some common
|
dnl same directory -- this is not true for some common
|
||||||
dnl distributions
|
dnl distributions
|
||||||
AC_MSG_CHECKING([for -lGLU])
|
WX_FIND_LIB([$SEARCH_LIB], GLU, gluBeginCurve)
|
||||||
WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],GLU)
|
|
||||||
if test "$ac_find_libraries" != "" ; then
|
if test "$ac_find_libraries" != "" ; then
|
||||||
|
if test "$ac_find_libraries" != "std" ; then
|
||||||
WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
|
WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
|
||||||
if test "$ac_path_to_link" != " -L/usr/lib" -a \
|
if test "$ac_path_to_link" != " -L/usr/lib" -a \
|
||||||
"$ac_path_to_link" != "$LDFLAGS_GL"; then
|
"$ac_path_to_link" != "$LDFLAGS_GL" ; then
|
||||||
LDFLAGS_GL="$LDFLAGS_GL$ac_path_to_link"
|
LDFLAGS_GL="$LDFLAGS_GL$ac_path_to_link"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
found_gl=1
|
found_gl=1
|
||||||
OPENGL_LIBS="-lGL -lGLU"
|
OPENGL_LIBS="-lGL -lGLU"
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$found_gl" != 1; then
|
if test "$found_gl" != 1; then
|
||||||
AC_MSG_CHECKING([for -lMesaGL])
|
WX_FIND_LIB([$SEARCH_LIB], MesaGL, glEnable)
|
||||||
WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],MesaGL)
|
|
||||||
if test "$ac_find_libraries" != "" ; then
|
if test "$ac_find_libraries" != "" ; then
|
||||||
|
if test "$ac_find_libraries" != "std" ; then
|
||||||
WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
|
WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
|
||||||
LDFLAGS_GL="$LDFLAGS$ac_path_to_link"
|
if test "$ac_path_to_link" != " -L/usr/lib" ; then
|
||||||
OPENGL_LIBS="-lMesaGL -lMesaGLU"
|
LDFLAGS_GL="$LDFLAGS_GL$ac_path_to_link"
|
||||||
AC_MSG_RESULT([yes])
|
fi
|
||||||
else
|
fi
|
||||||
AC_MSG_RESULT([no])
|
OPENGL_LIBS="-lMesaGL -lMesaGLU"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
],, [ ])
|
],, [ ])
|
||||||
|
Reference in New Issue
Block a user