From e7272c085692e058092e3d9cc20103f9110de15b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 18 Sep 2005 00:44:06 +0000 Subject: [PATCH] finally really fixes IRIX build: - determine the name of the standard libraries directory (lib, lib32, lib64 or lib/64) and use it to find other standard libraries - look in default libraries locations after checking the other ones, not before git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35549 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- acinclude.m4 | 31 ++++++++++++------- configure.in | 85 +++++++++++++++++++++++++++++++++------------------- 2 files changed, 74 insertions(+), 42 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 817275d7f4..708e54862d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -60,21 +60,30 @@ AC_DEFUN([WX_PATH_FIND_LIBRARIES_IN_PATH], ]) dnl --------------------------------------------------------------------------- -dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries +dnl return list of standard library paths +dnl --------------------------------------------------------------------------- +dnl return all default locations: +dnl - /usr/lib: standard +dnl - /usr/lib32: n32 ABI on IRIX +dnl - /usr/lib64: n64 ABI on IRIX +dnl - /usr/lib/64: 64 bit ABI on Solaris and Linux x86-64 +dnl +dnl NB: if any of directories in the list is not a subdir of /usr, code setting +dnl wx_cv_std_libpath needs to be updated +AC_DEFUN([WX_STD_LIBPATH], [/usr/lib /usr/lib32 /usr/lib/64 /usr/lib64]) + +dnl --------------------------------------------------------------------------- +dnl call WX_PATH_FIND_LIBRARIES(search path, lib name), sets ac_find_libraries dnl to the full name of the file that was found or leaves it empty if not found dnl --------------------------------------------------------------------------- AC_DEFUN([WX_PATH_FIND_LIBRARIES], [ - dnl check in default locations first: - dnl - /usr/lib: standard - dnl - /usr/lib32: n32 ABI on IRIX - dnl - /usr/lib64: n64 ABI on IRIX - dnl - /usr/lib/64: 64 bit ABI on Solaris and Linux x86-64 - WX_PATH_FIND_LIBRARIES_IN_PATH([/usr/lib /usr/lib32 /usr/lib/64 /usr/lib64], $2) - if test "$ac_find_libraries" != "" ; then - ac_find_libraries="default location" - else - WX_PATH_FIND_LIBRARIES_IN_PATH($1, $2) + WX_PATH_FIND_LIBRARIES_IN_PATH($1, $2) + if test "x$ac_find_libraries" = "x" ; then + WX_PATH_FIND_LIBRARIES_IN_PATH(WX_STD_LIBPATH(), $2) + if test "x$ac_find_libraries" != "x" ; then + ac_find_libraries="default location" + fi fi ]) diff --git a/configure.in b/configure.in index a74bac5c66..882ec4a2aa 100644 --- a/configure.in +++ b/configure.in @@ -2152,9 +2152,32 @@ SEARCH_INCLUDE="\ \ /usr/openwin/share/include" -dnl add 64 bit X11 libs for Linux on AMD, they must come before the usual -dnl locations or 64 bit compilation failed -SEARCH_LIB="/usr/X11R6/lib64 `echo "$SEARCH_INCLUDE" | sed s/include/lib/g`" +dnl try to find out the standard lib locations +AC_CACHE_CHECK([for libraries directory], + wx_cv_std_libpath, + [ + for d in WX_STD_LIBPATH(); do + for e in a so sl dylib dll.a; do + libc="$d/libc.$e" + if test -f $libc; then + save_LIBS="$LIBS" + LIBS="$libc" + AC_LINK_IFELSE([int main() { return 0; }], + wx_cv_std_libpath=`echo $d | sed s@/usr/@@`) + LIBS="$save_LIBS" + if test "x$wx_cv_std_libpath" != "x"; then + break 2 + fi + fi + done + done + if test "x$wx_cv_std_libpath" = "x"; then + wx_cv_std_libpath="lib" + fi + ] +) + +SEARCH_LIB=`echo "$SEARCH_INCLUDE" | sed s@include@$wx_cv_std_libpath@g` dnl Cross compiling with gcc? if test "$build" != "$host" -a "$GCC" = yes; then @@ -3082,41 +3105,41 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config CFLAGS=$save_CFLAGS fi - if test "$COMPILED_X_PROGRAM" = 0; then - AC_MSG_CHECKING(for Motif/Lesstif library) - WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm) - if test "$ac_find_libraries" != "" ; then - AC_MSG_RESULT(found in $ac_find_libraries) - WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY) - GUI_TK_LIBRARY="$GUI_TK_LIBRARY$ac_path_to_link" - else - dnl it might happen that we found headers in one of the - dnl standard paths but the libs are elsewhere - we do need to - dnl try to compile a sample program then here - save_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS $TOOLKIT_INCLUDE" + AC_MSG_CHECKING(for Motif/Lesstif library) + WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm) - AC_TRY_COMPILE( - [ - #include - ], - [ - int version; - version = xmUseVersion; - ], - [ - AC_MSG_RESULT(found in default search path) - COMPILED_X_PROGRAM=1 - ], - [ + if test "x$ac_find_libraries" != "x" ; then + AC_MSG_RESULT(found in $ac_find_libraries) + + WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY) + GUI_TK_LIBRARY="$GUI_TK_LIBRARY$ac_path_to_link" + else + dnl it might happen that we found headers in one of the standard + dnl paths but the libs are elsewhere but still in default (linker) + dnl path -- try to compile a test program to check for this + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $TOOLKIT_INCLUDE" + + AC_TRY_LINK( + [ + #include + ], + [ + int version; + version = xmUseVersion; + ], + [ + AC_MSG_RESULT(found in default search path) + COMPILED_X_PROGRAM=1 + ], + [ AC_MSG_RESULT(no) AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm) ] ) - CFLAGS=$save_CFLAGS - fi + CFLAGS=$save_CFLAGS fi AC_MSG_CHECKING([if we need -lXp and/or -lSM -lICE])