Navigation



Ignore:
Timestamp:
Feb 9, 2011, 6:08:54 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Added support for Internationalized Domain Names (IDNA) using GNU libidn

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/CMakeLists.txt

    r677 r707  
    1919SET(DEFAULT_EXTENSIONS_PATH ${CMAKE_INSTALL_PREFIX}/${INSTALL_EXTENSIONS_SUFFIX})
    2020
     21# IDNA considerations
     22OPTION(DIAMID_IDNA_IGNORE "Ignore completly invalid characters in Diameter Identities (process blindly)?" OFF)
     23IF (NOT DIAMID_IDNA_IGNORE)
     24        OPTION (DIAMID_IDNA_REJECT "Reject internationalized Diameter Identities, do not attempt to convert it (stringprep) ?" OFF)
     25ENDIF (NOT DIAMID_IDNA_IGNORE)
    2126
    22 MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO)
     27MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO DIAMID_IDNA_IGNORE DIAMID_IDNA_REJECT)
    2328
    2429########################
     
    109114SET(SCTP_LIBRARIES ${SCTP_LIBRARIES} PARENT_SCOPE)
    110115
     116# IDNA process: we use libidn from GNU (unless the function & header files are included in libc)
     117IF(NOT DIAMID_IDNA_IGNORE  AND NOT DIAMID_IDNA_REJECT)
     118        FIND_PACKAGE(IDNA)
     119        SET(CHECK_IDNA_SOURCE_CODE "
     120                #include <idna.h>
     121                int main() {
     122                   return idna_to_ascii_8z(NULL, NULL, 0);
     123                }
     124                ")
     125        SET(CMAKE_REQUIRED_INCLUDES ${IDNA_INCLUDE_DIR})
     126        SET(CMAKE_REQUIRED_LIBRARIES ${IDNA_LIBRARIES})
     127        CHECK_C_SOURCE_COMPILES("${CHECK_IDNA_SOURCE_CODE}" HAS_IDNA_SUPPORT)
     128        IF(NOT HAS_IDNA_SUPPORT)
     129                MESSAGE(SEND_ERROR "Unable to find idna.h header or idna_to_ascii_8z function, please install libidn-dev or equivalent, or set DIAMID_IDNA_IGNORE or DIAMID_IDNA_REJECT")
     130        ENDIF(NOT HAS_IDNA_SUPPORT)
     131ELSE (NOT DIAMID_IDNA_IGNORE  AND NOT DIAMID_IDNA_REJECT)
     132        MESSAGE(STATUS "Non-default Internationalized Domain Names (IDN) behavior selected (no stringprep).")
     133ENDIF(NOT DIAMID_IDNA_IGNORE  AND NOT DIAMID_IDNA_REJECT)
     134SET(IDNA_INCLUDE_DIR ${IDNA_INCLUDE_DIR} PARENT_SCOPE)
     135SET(IDNA_LIBRARIES ${IDNA_LIBRARIES} PARENT_SCOPE)
     136
    111137
    112138# Require GNU TLS for building the library
     
    135161
    136162# LFDPROTO_LIBS = libraries required by the libfdproto.
    137 SET(LFDPROTO_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_THREAD_LIBS_INIT} PARENT_SCOPE)
     163SET(LFDPROTO_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${IDNA_LIBRARIES} PARENT_SCOPE)
     164# And includes paths
     165SET(LFDPROTO_INCLUDES ${IDNA_INCLUDE_DIR} PARENT_SCOPE)
    138166# Dependencies: the libraries required by any code linking to libfdproto.
    139167SET(LFDPROTO_LINK_INTERFACES ${CMAKE_THREAD_LIBS_INIT} PARENT_SCOPE)
Note: See TracChangeset for help on using the changeset viewer.