comparison configure.ac @ 10036:0cabc95f0833

configure.ac: use libtool cache variables to simplify checks for dynamic linking api
author John W. Eaton <jwe@octave.org>
date Sun, 27 Dec 2009 22:19:07 -0500
parents 3b2f81d5a6dc
children 0b0bf1fd1ed7
comparison
equal deleted inserted replaced
10035:66d56fb7cbb8 10036:0cabc95f0833
1525 loadlibrary_api=false 1525 loadlibrary_api=false
1526 dyld_api=false 1526 dyld_api=false
1527 1527
1528 if $SHARED_LIBS || $ENABLE_DYNAMIC_LINKING; then 1528 if $SHARED_LIBS || $ENABLE_DYNAMIC_LINKING; then
1529 1529
1530 ## Check for dyld first since OS X can have a non-standard libdl 1530 case "$lt_cv_dlopen" in
1531 1531 dlopen)
1532 save_LIBS="$LIBS" 1532 dlopen_api=true
1533 use_mach_dyld=false 1533 DL_API_MSG="(dlopen)"
1534 AC_ARG_ENABLE(mach-dyld, 1534 AC_DEFINE(HAVE_DLOPEN_API, 1, [Define if your system has dlopen, dlsym, dlerror, and dlclose for dynamic linking])
1535 [AS_HELP_STRING([--enable-mach-dyld], [enable older Mach-O dyld interface])], 1535 OCTAVE_CXX_FLAG(-rdynamic, [RDYNAMIC_FLAG=-rdynamic])
1536 [if test "x$enableval" = xno; then 1536 ;;
1537 use_mach_dyld=false; 1537 shl_load)
1538 else 1538 shl_load_api=true
1539 use_mach_dyld=true; 1539 DL_API_MSG="(shl_load)"
1540 fi], []) 1540 AC_DEFINE(HAVE_SHL_LOAD_API, 1, [Define if your system has shl_load and shl_findsym for dynamic linking])
1541 if $use_mach_dyld; then 1541 ;;
1542 AC_CHECK_HEADER(mach-o/dyld.h) 1542 LoadLibrary)
1543 if test "$ac_cv_header_mach_o_dyld_h" = yes; then 1543 loadlibrary_api=true
1544 DL_API_MSG="(LoadLibrary)"
1545 AC_DEFINE(HAVE_LOADLIBRARY_API, 1, [Define if your system has LoadLibrary for dynamic linking])
1546 ;;
1547 dyld)
1544 dyld_api=true 1548 dyld_api=true
1545 fi 1549 DL_API_MSG="(dyld)"
1546 elif test "$dyld_api" = false; then 1550 AC_DEFINE(HAVE_DYLD_API, 1, [Define if your system has dyld for dynamic linking])
1547 AC_CHECK_LIB(dld, shl_load, [DL_LIBS=-ldld; LIBS="$LIBS $DL_LIBS"]) 1551 ;;
1548 AC_CHECK_FUNCS(shl_load shl_findsym) 1552 esac
1549 if test "$ac_cv_func_shl_load" = yes \ 1553
1550 && test "$ac_cv_func_shl_findsym" = yes; then 1554 DL_LIBS="$lt_cv_dlopen_libs"
1551 shl_load_api=true
1552 else
1553 AC_CHECK_LIB(wsock32, LoadLibrary, [
1554 DL_LIBS=-lwsock32; LIBS="$LIBS $DL_LIBS"])
1555 AC_CHECK_FUNCS(LoadLibrary)
1556 if test "$ac_cv_func_loadlibrary" = yes; then
1557 loadlibrary_api=true
1558 else
1559 ## With the dlopen option, LT_INIT has already checked for
1560 ## dlopen and the -ldl library. So we just look at cache values.
1561 if test "x$ac_cv_lib_dl_dlopen" = xyes; then
1562 DL_LIBS=-ldl;
1563 LIBS="$LIBS $DL_LIBS"
1564 fi
1565 if test "x$ac_cv_func_dlopen" = xyes \
1566 || test "x$ac_cv_lib_dl_dlopen" = xyes; then
1567 AC_CHECK_FUNCS(dlsym dlerror dlclose)
1568 if test "x$ac_cv_func_dlclose" = xyes \
1569 && test "x$ac_cv_func_dlerror" = xyes \
1570 && test "x$ac_cv_func_dlsym" = xyes; then
1571 dlopen_api=true
1572 else
1573 case "$canonical_host_type" in
1574 i[[3456]]86-*-sco3.2v5*)
1575 LD_CXX='LD_RUN_PATH=$LD_RUN_PATH:$(octlibdir) $(CXX)'
1576 dlopen_api=
1577 ;;
1578 esac
1579 fi
1580 fi
1581 fi
1582 fi
1583 fi
1584 LIBS="$save_LIBS"
1585 AC_SUBST(DL_LIBS) 1555 AC_SUBST(DL_LIBS)
1586
1587 ## autoconf test for LoadLibrary appears broken. Bypass for cygwin/mingw
1588 if $dlopen_api || $shl_load_api || $loadlibrary_api || $dyld_api; then
1589 true
1590 else
1591 case "$canonical_host_type" in
1592 *-*-cygwin* | *-*-mingw* | *-*-msdosmsvc)
1593 loadlibrary_api=true;
1594 ;;
1595 esac
1596 fi
1597
1598 if $dlopen_api; then
1599 DL_API_MSG="(dlopen)"
1600 AC_DEFINE(HAVE_DLOPEN_API, 1, [Define if your system has dlopen, dlsym, dlerror, and dlclose for dynamic linking])
1601 OCTAVE_CXX_FLAG(-rdynamic, [RDYNAMIC_FLAG=-rdynamic])
1602 elif $shl_load_api; then
1603 DL_API_MSG="(shl_load)"
1604 AC_DEFINE(HAVE_SHL_LOAD_API, 1, [Define if your system has shl_load and shl_findsym for dynamic linking])
1605 elif $loadlibrary_api; then
1606 DL_API_MSG="(LoadLibrary)"
1607 AC_DEFINE(HAVE_LOADLIBRARY_API, 1, [Define if your system has LoadLibrary for dynamic linking])
1608 elif $dyld_api; then
1609 DL_API_MSG="(dyld)"
1610 AC_DEFINE(HAVE_DYLD_API, 1, [Define if your system has dyld for dynamic linking])
1611 fi
1612 1556
1613 if $dlopen_api || $shl_load_api || $loadlibrary_api || $dyld_api; then 1557 if $dlopen_api || $shl_load_api || $loadlibrary_api || $dyld_api; then
1614 ENABLE_DYNAMIC_LINKING=true 1558 ENABLE_DYNAMIC_LINKING=true
1615 AC_DEFINE(ENABLE_DYNAMIC_LINKING, 1, [Define if using dynamic linking]) 1559 AC_DEFINE(ENABLE_DYNAMIC_LINKING, 1, [Define if using dynamic linking])
1616 fi 1560 fi