From f2ebf0b6267024b344301d44fc3569c5c4a829bc Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 3 Oct 2010 11:39:04 +0200 Subject: [PATCH] Changed: #1109 archlinux libwww linker error --- code/CMakeModules/FindLibwww.cmake | 134 ++++++++++++++++------------- 1 file changed, 73 insertions(+), 61 deletions(-) diff --git a/code/CMakeModules/FindLibwww.cmake b/code/CMakeModules/FindLibwww.cmake index db4a2f5ad..e57c77642 100644 --- a/code/CMakeModules/FindLibwww.cmake +++ b/code/CMakeModules/FindLibwww.cmake @@ -9,10 +9,10 @@ SET(LIBWWW_FIND_QUIETLY ${Libwww_FIND_QUIETLY}) # also defined, but not for general use are -IF(LIBWWW_LIBRARY AND LIBWWW_INCLUDE_DIR) +IF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) # in cache already SET(LIBWWW_FIND_QUIETLY TRUE) -ENDIF(LIBWWW_LIBRARY AND LIBWWW_INCLUDE_DIR) +ENDIF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) FIND_PATH(LIBWWW_INCLUDE_DIR WWWInit.h @@ -45,7 +45,7 @@ IF(LIBWWW_ADDITIONAL_INCLUDE_DIR) ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR) # helper to find all the libwww sub libraries -MACRO(FIND_WWW_LIBRARY MYLIBRARY) +MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION) FIND_LIBRARY(${MYLIBRARY} NAMES ${ARGN} PATHS @@ -59,77 +59,89 @@ MACRO(FIND_WWW_LIBRARY MYLIBRARY) /opt/lib /usr/freeware/lib64 ) - + IF(${MYLIBRARY}) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}}) - ELSE(${MYLIBRARY}) + IF(${OPTION} STREQUAL REQUIRED) + SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}}) + ENDIF(${OPTION} STREQUAL REQUIRED) + ELSE(${MYIBRARY}) IF(NOT LIBWWW_FIND_QUIETLY) MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}") ENDIF(NOT LIBWWW_FIND_QUIETLY) ENDIF(${MYLIBRARY}) MARK_AS_ADVANCED(${MYLIBRARY}) -ENDMACRO(FIND_WWW_LIBRARY MYLIBRARY) +ENDMACRO(FIND_WWW_LIBRARY) -# on eg. mac os x and arch linux, libwww sub libraries are not "inter-linked" -# we need to link them all manually +MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL) + LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL}) +ENDMACRO(LINK_WWW_LIBRARY) -FIND_WWW_LIBRARY(LIBWWWAPP_LIBRARY wwwapp) -FIND_WWW_LIBRARY(LIBWWWCORE_LIBRARY wwwcore) -FIND_WWW_LIBRARY(LIBWWWDIR_LIBRARY wwwdir) -FIND_WWW_LIBRARY(LIBWWWFILE_LIBRARY wwwfile) -FIND_WWW_LIBRARY(LIBWWWFTP_LIBRARY wwwftp) -FIND_WWW_LIBRARY(LIBWWWGOPHER_LIBRARY wwwgopher) -FIND_WWW_LIBRARY(LIBWWWHTML_LIBRARY wwwhtml) -FIND_WWW_LIBRARY(LIBWWWHTTP_LIBRARY wwwhttp) -FIND_WWW_LIBRARY(LIBWWWINIT_LIBRARY wwwinit) -FIND_WWW_LIBRARY(LIBWWWMIME_LIBRARY wwwmime) -FIND_WWW_LIBRARY(LIBWWWCACHE_LIBRARY wwwcache) -FIND_WWW_LIBRARY(LIBWWWMUX_LIBRARY wwwmux) -FIND_WWW_LIBRARY(LIBWWWNEWS_LIBRARY wwwnews) -FIND_WWW_LIBRARY(LIBWWWSTREAM_LIBRARY wwwstream) -FIND_WWW_LIBRARY(LIBWWWTELNET_LIBRARY wwwtelnet) -FIND_WWW_LIBRARY(LIBWWWTRANS_LIBRARY wwwtrans) -FIND_WWW_LIBRARY(LIBWWWUTILS_LIBRARY wwwutils) -FIND_WWW_LIBRARY(LIBWWWXML_LIBRARY wwwxml) -FIND_WWW_LIBRARY(LIBWWWZIP_LIBRARY wwwzip) -FIND_WWW_LIBRARY(LIBMD5_LIBRARY md5) +# Find and link required libs for static or dynamic +FIND_WWW_LIBRARY(LIBWWWAPP_LIBRARY REQUIRED wwwapp) # cache core file ftp gopher html http mime news stream telnet trans utils zip xml xmlparse +FIND_WWW_LIBRARY(LIBWWWCORE_LIBRARY REQUIRED wwwcore) # utils +FIND_WWW_LIBRARY(LIBWWWFILE_LIBRARY REQUIRED wwwfile) # core trans utils html +FIND_WWW_LIBRARY(LIBWWWHTML_LIBRARY REQUIRED wwwhtml) # core utils +FIND_WWW_LIBRARY(LIBWWWHTTP_LIBRARY REQUIRED wwwhttp) # md5 core mime stream utils +FIND_WWW_LIBRARY(LIBWWWMIME_LIBRARY REQUIRED wwwmime) # core cache stream utils +FIND_WWW_LIBRARY(LIBWWWTRANS_LIBRARY REQUIRED wwwtrans) # core utils +FIND_WWW_LIBRARY(LIBWWWUTILS_LIBRARY REQUIRED wwwutils) -# Windows libwww version needs GNU Regex -IF(WIN32 AND WITH_STATIC) - FIND_PATH(LIBWWW_REGEX_INCLUDE_DIR - regex.h - PATHS - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include - ) +# Required for static or if underlinking +FIND_WWW_LIBRARY(LIBWWWCACHE_LIBRARY OPTIONAL wwwcache) # core trans utils +FIND_WWW_LIBRARY(LIBWWWSTREAM_LIBRARY OPTIONAL wwwstream) # core file utils - # combine both include directories into one variable - IF(LIBWWW_REGEX_INCLUDE_DIR) - SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${LIBWWW_REGEX_INCLUDE_DIR}) - FIND_WWW_LIBRARY(LIBREGEX_LIBRARY gnu_regex) - ENDIF(LIBWWW_REGEX_INCLUDE_DIR) -ENDIF(WIN32 AND WITH_STATIC) +# Required only if underlinking -IF(WITH_STATIC) - # If compiled with expat support - FIND_PACKAGE(EXPAT QUIET) - IF(EXPAT_FOUND) - SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${EXPAT_INCLUDE_DIRS}) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${EXPAT_LIBRARIES}) - ENDIF(EXPAT_FOUND) +# Unused protocols +FIND_WWW_LIBRARY(LIBWWWFTP_LIBRARY OPTIONAL wwwftp) # core file utils +FIND_WWW_LIBRARY(LIBWWWGOPHER_LIBRARY OPTIONAL wwwgopher) # core html utils file +FIND_WWW_LIBRARY(LIBWWWNEWS_LIBRARY OPTIONAL wwwnews) # core html mime stream utils +FIND_WWW_LIBRARY(LIBWWWTELNET_LIBRARY OPTIONAL wwwtelnet) # core utils - # If compiled with OpenSSL support - FIND_PACKAGE(OpenSSL QUIET) - IF(OPENSSL_FOUND) - SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR}) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${OPENSSL_LIBRARIES}) - ENDIF(OPENSSL_FOUND) -ENDIF(WITH_STATIC) +# Other used by app +FIND_WWW_LIBRARY(LIBWWWDIR_LIBRARY OPTIONAL wwwdir) # file +FIND_WWW_LIBRARY(LIBWWWINIT_LIBRARY OPTIONAL wwwinit) # app cache core file html utils +FIND_WWW_LIBRARY(LIBWWWMUX_LIBRARY OPTIONAL wwwmux) # core stream trans utils +FIND_WWW_LIBRARY(LIBWWWXML_LIBRARY OPTIONAL wwwxml) # core utils xmlparse +FIND_WWW_LIBRARY(LIBWWWZIP_LIBRARY OPTIONAL wwwzip) # core utils +FIND_WWW_LIBRARY(LIBXMLPARSE_LIBRARY OPTIONAL xmlparse) # xmltok + +# Other used by other +FIND_WWW_LIBRARY(LIBXMLTOK_LIBRARY OPTIONAL xmltok) +FIND_WWW_LIBRARY(LIBWWWSSL_LIBRARY OPTIONAL wwwssl) +FIND_WWW_LIBRARY(LIBMD5_LIBRARY OPTIONAL md5) +FIND_WWW_LIBRARY(LIBPICS_LIBRARY OPTIONAL pics) + +# Other external libraries +FIND_PACKAGE(EXPAT QUIET) +FIND_PACKAGE(OpenSSL QUIET) +FIND_WWW_LIBRARY(LIBREGEX_LIBRARY OPTIONAL gnu_regex) + +# Now link all libs together +LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWCACHE_LIBRARY HTLoadCache) +LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWSTREAM_LIBRARY HTLoadStream) + +LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWFTP_LIBRARY HTLoadFTP) +LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWGOPHER_LIBRARY HTLoadGopher) +LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWNEWS_LIBRARY HTLoadNews) +LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWTELNET_LIBRARY HTLoadTelnet) + +LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWDIR_LIBRARY HTDir_new) +LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWINIT_LIBRARY HTProtocolInit) # HTProfile_delete +LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWXML_LIBRARY HTXML_new) +LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWZIP_LIBRARY HTZLib_inflate) + +# libwwwxml can be linked to xmlparse or expat +LINK_WWW_LIBRARY(LIBWWWXML_LIBRARY LIBXMLPARSE_LIBRARY XML_ParserCreate) + +IF(NOT LIBXMLPARSE_LIBRARY_LINKED) + LINK_WWW_LIBRARY(LIBWWWXML_LIBRARY EXPAT_LIBRARY XML_ParserCreate) +ENDIF(NOT LIBXMLPARSE_LIBRARY_LINKED) + +LINK_WWW_LIBRARY(LIBWWWHTTP_LIBRARY LIBMD5_LIBRARY MD5Init) +LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBREGEX_LIBRARY regexec) +LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY OPENSSL_LIBRARIES SSL_new) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibWWW DEFAULT_MSG