Commit ce00713c authored by Milan Crha's avatar Milan Crha

Correct build when nss/nspr do not provide pkg-config files

parent 70e65049
......@@ -931,6 +931,14 @@ pkg_check_modules(CAMEL REQUIRED gio-2.0 gmodule-2.0 ${mozilla_nss} ${mozilla_ns
set(CAMEL_CFLAGS ${CAMEL_CFLAGS} ${KRB5_CFLAGS} ${MANUAL_NSS_CFLAGS} ${MANUAL_NSPR_CFLAGS} ${ICU_CFLAGS})
set(CAMEL_LDFLAGS ${CAMEL_LDFLAGS} -lz ${KRB5_LDFLAGS} ${MANUAL_NSS_LIBS} ${MANUAL_NSPR_LIBS} ${ICU_LDFLAGS})
if(NOT (MANUAL_NSPR_INCLUDES STREQUAL ""))
list(APPEND CAMEL_INCLUDE_DIRS ${MANUAL_NSPR_INCLUDES})
endif(NOT (MANUAL_NSPR_INCLUDES STREQUAL ""))
if(NOT (MANUAL_NSS_INCLUDES STREQUAL ""))
list(APPEND CAMEL_INCLUDE_DIRS ${MANUAL_NSS_INCLUDES})
endif(NOT (MANUAL_NSS_INCLUDES STREQUAL ""))
# ******************************
# libical tweaks, part II (re-using CALENDAR modules)
# ******************************
......
......@@ -66,6 +66,8 @@ if(NOT (WITH_NSPR_INCLUDES STREQUAL ""))
set(CMAKE_REQUIRED_INCLUDES ${WITH_NSPR_INCLUDES})
endif(NOT (WITH_NSPR_INCLUDES STREQUAL ""))
unset(_have_headers CACHE)
CHECK_INCLUDE_FILES("nspr.h;prio.h" _have_headers)
unset(CMAKE_REQUIRED_INCLUDES)
......@@ -75,11 +77,13 @@ if(NOT _have_headers)
endif(NOT _have_headers)
set(MANUAL_NSPR_INCLUDES "${WITH_NSPR_INCLUDES}")
string(STRIP ${MANUAL_NSPR_INCLUDES} MANUAL_NSPR_INCLUDES)
set(nsprlibs "-lplc4 -lplds4 -lnspr4")
set(CMAKE_REQUIRED_INCLUDES ${MANUAL_NSPR_INCLUDES})
set(CMAKE_REQUIRED_LIBRARIES ${nsprlibs})
unset(_nsprlibs_okay CACHE)
CHECK_C_SOURCE_COMPILES("#include <prinit.h>
int main(void) { PR_Initialized(); return 0; }" _nsprlibs_okay)
unset(CMAKE_REQUIRED_INCLUDES)
......@@ -96,6 +100,7 @@ if(NOT (WITH_NSPR_LIBS STREQUAL ""))
endif(NOT (WITH_NSPR_LIBS STREQUAL ""))
set(MANUAL_NSPR_LIBS "${MANUAL_NSPR_LIBS} ${nsprlibs}")
string(STRIP ${MANUAL_NSPR_LIBS} MANUAL_NSPR_LIBS)
# *****************
# Check for NSS 3
......@@ -119,12 +124,14 @@ if(NOT _have_headers)
message(FATAL_ERROR "NSS headers not found. Use -DWITH_NSS_INCLUDES=/path/to/nss to specify the include dir of NSS.")
endif(NOT _have_headers)
set(MANUAL_NSS_INCLUDES "${WITH_NSS_INCLUDES} ${MANUAL_NSPR_INCLUDES}")
set(MANUAL_NSS_INCLUDES "${WITH_NSS_INCLUDES}")
string(STRIP ${MANUAL_NSS_INCLUDES} MANUAL_NSS_INCLUDES)
set(nsslibs "-lssl3 -lsmime3 -lnss3")
set(CMAKE_REQUIRED_INCLUDES ${MANUAL_NSS_INCLUDES})
set(CMAKE_REQUIRED_INCLUDES ${MANUAL_NSS_INCLUDES} ${MANUAL_NSPR_INCLUDES})
set(CMAKE_REQUIRED_LIBRARIES ${nsslibs} ${nsprlibs})
unset(_nsslibs_okay CACHE)
CHECK_C_SOURCE_COMPILES("#include <nss.h>
int main(void) { NSS_Init(\"\"); return 0; }" _nsslibs_okay)
unset(CMAKE_REQUIRED_INCLUDES)
......@@ -142,6 +149,7 @@ if(NOT (WITH_NSS_LIBS STREQUAL ""))
endif(NOT (WITH_NSS_LIBS STREQUAL ""))
set(MANUAL_NSS_LIBS "${MANUAL_NSS_LIBS} ${nsslibs} ${MANUAL_NSPR_LIBS}")
string(STRIP ${MANUAL_NSS_LIBS} MANUAL_NSS_LIBS)
if(MOZILLA_NSS_LIB_DIR STREQUAL "")
set(MOZILLA_NSS_LIB_DIR "${LIB_INSTALL_DIR}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment