diff options
-rw-r--r-- | CMakeLists.txt | 36 | ||||
-rw-r--r-- | cmake/FindLibEV.cmake | 120 | ||||
-rw-r--r-- | cmake/LighttpdMacros.cmake | 76 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1152 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 8 |
5 files changed, 696 insertions, 696 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cbe202c6..52fdd21d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,27 +1,27 @@ -PROJECT(lighttpd C) +project(lighttpd C) -CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0 FATAL_ERROR) +cmake_minimum_required(VERSION 2.4.0 FATAL_ERROR) -SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) -INCLUDE(CTest) +include(CTest) -ENABLE_TESTING() +enable_testing() -SET(CPACK_PACKAGE_VERSION_MAJOR 1) -SET(CPACK_PACKAGE_VERSION_MINOR 4) -SET(CPACK_PACKAGE_VERSION_PATCH 37) -SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") +set(CPACK_PACKAGE_VERSION_MAJOR 1) +set(CPACK_PACKAGE_VERSION_MINOR 4) +set(CPACK_PACKAGE_VERSION_PATCH 37) +set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") -SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") -SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README") -SET(CPACK_PACKAGE_VENDOR "jan@kneschke.de") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") +set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README") +set(CPACK_PACKAGE_VENDOR "jan@kneschke.de") -SET(CPACK_SOURCE_GENERATOR "TGZ") -SET(CPACK_SOURCE_IGNORE_FILES "/\\\\.;~$;/_;build/;CMakeFiles/;CMakeCache;gz$;Makefile\\\\.;trace;Testing/;foo;autom4te;cmake_install;CPack;\\\\.pem;ltmain.sh;configure;libtool;/config\\\\.;missing;autogen.sh;install-sh;Dart;aclocal;log$;Makefile$") +set(CPACK_SOURCE_GENERATOR "TGZ") +set(CPACK_SOURCE_IGNORE_FILES "/\\\\.;~$;/_;build/;CMakeFiles/;CMakeCache;gz$;Makefile\\\\.;trace;Testing/;foo;autom4te;cmake_install;CPack;\\\\.pem;ltmain.sh;configure;libtool;/config\\\\.;missing;autogen.sh;install-sh;Dart;aclocal;log$;Makefile$") -SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") -ADD_SUBDIRECTORY(src build) -#ADD_SUBDIRECTORY(doc) -ADD_SUBDIRECTORY(tests) +add_subdirectory(src build) +#add_subdirectory(doc) +add_subdirectory(tests) diff --git a/cmake/FindLibEV.cmake b/cmake/FindLibEV.cmake index 54e33fca..ee6e9cf5 100644 --- a/cmake/FindLibEV.cmake +++ b/cmake/FindLibEV.cmake @@ -1,70 +1,70 @@ -SET(LIBEV_PATH "" CACHE PATH "Base path for include/ev.h and lib/libev*") -SET(LIBEV_INCLUDE_PATH "" CACHE PATH "Include path for ev.h") -SET(LIBEV_LIBDIR "" CACHE PATH "Path containing libev") +set(LIBEV_PATH "" CACHE PATH "Base path for include/ev.h and lib/libev*") +set(LIBEV_INCLUDE_PATH "" CACHE PATH "Include path for ev.h") +set(LIBEV_LIBDIR "" CACHE PATH "Path containing libev") -IF(LIBEV_PATH) - SET(LIBEV_INCLUDE_PATH "${LIBEV_PATH}/include" CACHE PATH "Include path for ev.h" FORCE) - SET(LIBEV_LIBDIR "${LIBEV_PATH}/lib" CACHE PATH "Path containing libev" FORCE) -ENDIF(LIBEV_PATH) +if(LIBEV_PATH) + set(LIBEV_INCLUDE_PATH "${LIBEV_PATH}/include" CACHE PATH "Include path for ev.h" FORCE) + set(LIBEV_LIBDIR "${LIBEV_PATH}/lib" CACHE PATH "Path containing libev" FORCE) +endif() -IF(LIBEV_INCLUDE_PATH) - INCLUDE_DIRECTORIES(${LIBEV_INCLUDE_PATH}) -ENDIF(LIBEV_INCLUDE_PATH) +if(LIBEV_INCLUDE_PATH) + include_directories(${LIBEV_INCLUDE_PATH}) +endif() # Use cached result -IF(NOT LIBEV_FOUND) - UNSET(HAVE_EV_H) - UNSET(HAVE_LIBEV) - UNSET(HAVE_EV_H CACHE) - UNSET(HAVE_LIBEV CACHE) - UNSET(LIBEV_CFLAGS) - UNSET(LIBEV_LDFLAGS) +if(NOT LIBEV_FOUND) + unset(HAVE_EV_H) + unset(HAVE_LIBEV) + unset(HAVE_EV_H CACHE) + unset(HAVE_LIBEV CACHE) + unset(LIBEV_CFLAGS) + unset(LIBEV_LDFLAGS) - IF(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR) - SET(CMAKE_REQUIRED_INCLUDES ${LIBEV_INCLUDE_PATH}) -# MESSAGE(STATUS "Looking for ev.h in ${CMAKE_REQUIRED_INCLUDES}") - CHECK_INCLUDE_FILES(ev.h HAVE_EV_H) - IF(HAVE_EV_H) -# MESSAGE(STATUS "Looking for lib ev in ${LIBEV_LIBDIR}") - CHECK_LIBRARY_EXISTS(ev ev_time "${LIBEV_LIBDIR}" HAVE_LIBEV) - IF(HAVE_LIBEV) - SET(LIBEV_CFLAGS "" CACHE INTERNAL "") - SET(LIBEV_LDFLAGS "-L${LIBEV_LIBDIR} -lev" CACHE INTERNAL "") - SET(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev" FORCE) - ELSE(HAVE_LIBEV) - MESSAGE(STATUS "Couldn't find lib ev in ${LIBEV_LIBDIR}") - ENDIF(HAVE_LIBEV) - ELSE(HAVE_EV_H) - MESSAGE(STATUS "Couldn't find <ev.h> in ${LIBEV_INCLUDE_PATH}") - ENDIF(HAVE_EV_H) - ELSE(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR) + if(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR) + set(CMAKE_REQUIRED_INCLUDES ${LIBEV_INCLUDE_PATH}) +# message(STATUS "Looking for ev.h in ${CMAKE_REQUIRED_INCLUDES}") + check_include_files(ev.h HAVE_EV_H) + if(HAVE_EV_H) +# message(STATUS "Looking for lib ev in ${LIBEV_LIBDIR}") + check_library_exists(ev ev_time "${LIBEV_LIBDIR}" HAVE_LIBEV) + if(HAVE_LIBEV) + set(LIBEV_CFLAGS "" CACHE INTERNAL "") + set(LIBEV_LDFLAGS "-L${LIBEV_LIBDIR} -lev" CACHE INTERNAL "") + set(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev" FORCE) + else() + message(STATUS "Couldn't find lib ev in ${LIBEV_LIBDIR}") + endif() + else() + message(STATUS "Couldn't find <ev.h> in ${LIBEV_INCLUDE_PATH}") + endif() + else() pkg_check_modules(LIBEV libev) - IF(NOT LIBEV_FOUND) -# MESSAGE(STATUS "Looking for ev.h in ${CMAKE_REQUIRED_INCLUDES}") - CHECK_INCLUDE_FILES(ev.h HAVE_EV_H) - IF(HAVE_EV_H) -# MESSAGE(STATUS "Looking for lib ev") - CHECK_LIBRARY_EXISTS(ev ev_time "" HAVE_LIBEV) - IF(HAVE_LIBEV) - SET(LIBEV_CFLAGS "" CACHE INTERNAL "") - SET(LIBEV_LDFLAGS "-lev" CACHE INTERNAL "") - SET(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev" FORCE) - ELSE(HAVE_LIBEV) - MESSAGE(STATUS "Couldn't find lib ev") - ENDIF(HAVE_LIBEV) - ELSE(HAVE_EV_H) - MESSAGE(STATUS "Couldn't find <ev.h>") - ENDIF(HAVE_EV_H) - ENDIF(NOT LIBEV_FOUND) - ENDIF(LIBEV_INCLUDE_PATH OR LIBEV_LIBDIR) + if(NOT LIBEV_FOUND) +# message(STATUS "Looking for ev.h in ${CMAKE_REQUIRED_INCLUDES}") + check_include_files(ev.h HAVE_EV_H) + if(HAVE_EV_H) +# message(STATUS "Looking for lib ev") + check_library_exists(ev ev_time "" HAVE_LIBEV) + if(HAVE_LIBEV) + set(LIBEV_CFLAGS "" CACHE INTERNAL "") + set(LIBEV_LDFLAGS "-lev" CACHE INTERNAL "") + set(LIBEV_FOUND TRUE CACHE INTERNAL "Found libev" FORCE) + else() + message(STATUS "Couldn't find lib ev") + endif() + else() + message(STATUS "Couldn't find <ev.h>") + endif() + endif() + endif() -ENDIF(NOT LIBEV_FOUND) +endif() -IF(NOT LIBEV_FOUND) - IF(LibEV_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find libev") - ENDIF(LibEV_FIND_REQUIRED) -ENDIF(NOT LIBEV_FOUND) +if(NOT LIBEV_FOUND) + if(LibEV_FIND_REQUIRED) + message(FATAL_ERROR "Could not find libev") + endif() +endif() -MARK_AS_ADVANCED(LIBEV_PATH LIBEV_INCLUDE_PATH LIBEV_LIBDIR) +mark_as_advanced(LIBEV_PATH LIBEV_INCLUDE_PATH LIBEV_LIBDIR) diff --git a/cmake/LighttpdMacros.cmake b/cmake/LighttpdMacros.cmake index e188c514..f3356990 100644 --- a/cmake/LighttpdMacros.cmake +++ b/cmake/LighttpdMacros.cmake @@ -1,43 +1,43 @@ ## our modules are without the "lib" prefix -MACRO(ADD_AND_INSTALL_LIBRARY LIBNAME SRCFILES) - IF(BUILD_STATIC) - ADD_LIBRARY(${LIBNAME} STATIC ${SRCFILES}) - TARGET_LINK_LIBRARIES(lighttpd ${LIBNAME}) - ELSE(BUILD_STATIC) - ADD_LIBRARY(${LIBNAME} SHARED ${SRCFILES}) - SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} ${LIBNAME}) - ## Windows likes to link it this way back to app! - IF(WIN32) - SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS lighttpd.lib) - ENDIF(WIN32) +macro(ADD_AND_INSTALL_LIBRARY LIBNAME SRCFILES) + if(BUILD_STATIC) + add_library(${LIBNAME} STATIC ${SRCFILES}) + target_link_libraries(lighttpd ${LIBNAME}) + else() + add_library(${LIBNAME} SHARED ${SRCFILES}) + set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} ${LIBNAME}) + ## Windows likes to link it this way back to app! + if(WIN32) + set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS lighttpd.lib) + endif() - IF(APPLE) - SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress") - ENDIF(APPLE) - ENDIF(BUILD_STATIC) -ENDMACRO(ADD_AND_INSTALL_LIBRARY) + if(APPLE) + set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress") + endif() + endif() +endmacro(ADD_AND_INSTALL_LIBRARY) -MACRO(LEMON_PARSER SRCFILE) - GET_FILENAME_COMPONENT(SRCBASE ${SRCFILE} NAME_WE) - ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.c ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.h - COMMAND ${CMAKE_BINARY_DIR}/build/lemon - ARGS -q ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c - DEPENDS ${CMAKE_BINARY_DIR}/build/lemon ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c - COMMENT "Generating ${SRCBASE}.c from ${SRCFILE}" -) -ENDMACRO(LEMON_PARSER) +macro(LEMON_PARSER SRCFILE) + get_filename_component(SRCBASE ${SRCFILE} NAME_WE) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.c ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.h + COMMAND ${CMAKE_BINARY_DIR}/build/lemon + ARGS -q ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c + DEPENDS ${CMAKE_BINARY_DIR}/build/lemon ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c + COMMENT "Generating ${SRCBASE}.c from ${SRCFILE}" + ) +endmacro(LEMON_PARSER) -MACRO(ADD_TARGET_PROPERTIES _target _name) - SET(_properties) - FOREACH(_prop ${ARGN}) - SET(_properties "${_properties} ${_prop}") - ENDFOREACH(_prop) - GET_TARGET_PROPERTY(_old_properties ${_target} ${_name}) - MESSAGE("adding property to ${_target} ${_name}:" ${_properties}) - IF(NOT _old_properties) - # in case it's NOTFOUND - SET(_old_properties) - ENDIF(NOT _old_properties) - SET_TARGET_PROPERTIES(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}") -ENDMACRO(ADD_TARGET_PROPERTIES) +macro(ADD_TARGET_PROPERTIES _target _name) + set(_properties) + foreach(_prop ${ARGN}) + set(_properties "${_properties} ${_prop}") + endforeach() + get_target_property(_old_properties ${_target} ${_name}) + message("adding property to ${_target} ${_name}:" ${_properties}) + if(NOT _old_properties) + # in case it's NOTFOUND + set(_old_properties) + endif() + set_target_properties(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}") +endmacro(ADD_TARGET_PROPERTIES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d45d14b6..e24c0736 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,425 +1,425 @@ -INCLUDE(CheckCSourceCompiles) -INCLUDE(CheckIncludeFiles) -INCLUDE(CheckFunctionExists) -INCLUDE(CheckVariableExists) -INCLUDE(CheckTypeSize) -INCLUDE(CheckLibraryExists) -INCLUDE(CMakeDetermineCCompiler) -INCLUDE(FindThreads) -INCLUDE(FindPkgConfig) - -INCLUDE(LighttpdMacros) - -ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES) - -OPTION(WITH_XATTR "with xattr-support for the stat-cache [default: off]") -OPTION(WITH_MYSQL "with mysql-support for the mod_sql_vhost [default: off]") -# OPTION(WITH_POSTGRESQL "with postgress-support for the mod_sql_vhost [default: off]") -OPTION(WITH_OPENSSL "with openssl-support [default: off]") -OPTION(WITH_PCRE "with regex support [default: on]" ON) -OPTION(WITH_WEBDAV_PROPS "with property-support for mod_webdav [default: off]") -OPTION(WITH_WEBDAV_LOCKS "locks in webdav [default: off]") -OPTION(WITH_BZIP "with bzip2-support for mod_compress [default: off]") -OPTION(WITH_ZLIB "with deflate-support for mod_compress [default: on]" ON) -OPTION(WITH_LDAP "with LDAP-support for the mod_auth [default: off]") -OPTION(WITH_LUA "with lua 5.1 for mod_magnet [default: off]") -# OPTION(WITH_VALGRIND "with internal support for valgrind [default: off]") -# OPTION(WITH_KERBEROS5 "use Kerberos5 support with OpenSSL [default: off]") -OPTION(WITH_FAM "fam/gamin for reducing number of stat() calls [default: off]") -OPTION(WITH_GDBM "gdbm storage for mod_trigger_b4_dl [default: off]") -OPTION(WITH_MEMCACHE "memcached storage for mod_trigger_b4_dl [default: off]") -OPTION(WITH_LIBEV "libev support for fdevent handlers [default: off]") -OPTION(WITH_LIBUNWIND "with libunwind to print backtraces in asserts [default: off]") - -IF(CMAKE_COMPILER_IS_GNUCC) - OPTION(BUILD_EXTRA_WARNINGS "extra warnings") - - IF(BUILD_EXTRA_WARNINGS) - SET(WARN_FLAGS "-g -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -Wl,--as-needed -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security") +include(CheckCSourceCompiles) +include(CheckIncludeFiles) +include(CheckFunctionExists) +include(CheckVariableExists) +include(CheckTypeSize) +include(CheckLibraryExists) +include(CMakeDetermineCCompiler) +include(FindThreads) +include(FindPkgConfig) + +include(LighttpdMacros) + +add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES) + +option(WITH_XATTR "with xattr-support for the stat-cache [default: off]") +option(WITH_MYSQL "with mysql-support for the mod_sql_vhost [default: off]") +# option(WITH_POSTGRESQL "with postgress-support for the mod_sql_vhost [default: off]") +option(WITH_OPENSSL "with openssl-support [default: off]") +option(WITH_PCRE "with regex support [default: on]" ON) +option(WITH_WEBDAV_PROPS "with property-support for mod_webdav [default: off]") +option(WITH_WEBDAV_LOCKS "locks in webdav [default: off]") +option(WITH_BZIP "with bzip2-support for mod_compress [default: off]") +option(WITH_ZLIB "with deflate-support for mod_compress [default: on]" ON) +option(WITH_LDAP "with LDAP-support for the mod_auth [default: off]") +option(WITH_LUA "with lua 5.1 for mod_magnet [default: off]") +# option(WITH_VALGRIND "with internal support for valgrind [default: off]") +# option(WITH_KERBEROS5 "use Kerberos5 support with OpenSSL [default: off]") +option(WITH_FAM "fam/gamin for reducing number of stat() calls [default: off]") +option(WITH_GDBM "gdbm storage for mod_trigger_b4_dl [default: off]") +option(WITH_MEMCACHE "memcached storage for mod_trigger_b4_dl [default: off]") +option(WITH_LIBEV "libev support for fdevent handlers [default: off]") +option(WITH_LIBUNWIND "with libunwind to print backtraces in asserts [default: off]") + +if(CMAKE_COMPILER_IS_GNUCC) + option(BUILD_EXTRA_WARNINGS "extra warnings") + + if(BUILD_EXTRA_WARNINGS) + set(WARN_FLAGS "-g -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -Wl,--as-needed -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security") # -Werror -Wbad-function-cast -Wmissing-prototypes - ELSE(BUILD_EXTRA_WARNINGS) - SET(WARN_FLAGS "") - ENDIF(BUILD_EXTRA_WARNINGS) -ENDIF(CMAKE_COMPILER_IS_GNUCC) - -OPTION(BUILD_STATIC "build a static lighttpd with all modules added") - -IF(BUILD_STATIC) - SET(LIGHTTPD_STATIC 1) -ELSE(BUILD_STATIC) - SET(CMAKE_SHARED_LIBRARY_PREFIX "") -ENDIF(BUILD_STATIC) - -IF(WITH_LIBEV) - FIND_PACKAGE(LibEV REQUIRED) - SET(HAVE_LIBEV 1 FORCE) -ENDIF(WITH_LIBEV) - -IF(WITH_LIBUNWIND) - pkg_check_modules(LIBUNWIND REQUIRED libunwind) - SET(HAVE_LIBUNWIND 1 FORCE) -ENDIF() - -IF(WITH_WEBDAV_PROPS) - SET(WITH_XML 1) - SET(WITH_SQLITE3 1) - SET(WITH_UUID 1) -ENDIF(WITH_WEBDAV_PROPS) - -CHECK_INCLUDE_FILES(sys/devpoll.h HAVE_SYS_DEVPOLL_H) -CHECK_INCLUDE_FILES(sys/epoll.h HAVE_SYS_EPOLL_H) -CHECK_INCLUDE_FILES(sys/event.h HAVE_SYS_EVENT_H) -CHECK_INCLUDE_FILES(sys/mman.h HAVE_SYS_MMAN_H) -CHECK_INCLUDE_FILES(sys/poll.h HAVE_SYS_POLL_H) -CHECK_INCLUDE_FILES(sys/port.h HAVE_SYS_PORT_H) -CHECK_INCLUDE_FILES(sys/prctl.h HAVE_SYS_PRCTL_H) -CHECK_INCLUDE_FILES(sys/resource.h HAVE_SYS_RESOURCE_H) -CHECK_INCLUDE_FILES(sys/sendfile.h HAVE_SYS_SENDFILE_H) -CHECK_INCLUDE_FILES(sys/select.h HAVE_SYS_SELECT_H) -CHECK_INCLUDE_FILES(sys/syslimits.h HAVE_SYS_SYSLIMITS_H) -CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H) -CHECK_INCLUDE_FILES(sys/uio.h HAVE_SYS_UIO_H) -CHECK_INCLUDE_FILES(sys/un.h HAVE_SYS_UN_H) -CHECK_INCLUDE_FILES(sys/wait.h HAVE_SYS_WAIT_H) -CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H) -CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H) -CHECK_INCLUDE_FILES(pthread.h HAVE_PTHREAD_H) -CHECK_INCLUDE_FILES(getopt.h HAVE_GETOPT_H) -CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H) -CHECK_INCLUDE_FILES(poll.h HAVE_POLL_H) -CHECK_INCLUDE_FILES(pwd.h HAVE_PWD_H) -CHECK_INCLUDE_FILES(stddef.h HAVE_STDDEF_H) -CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H) -CHECK_INCLUDE_FILES(syslog.h HAVE_SYSLOG_H) + else() + set(WARN_FLAGS "") + endif() +endif() + +option(BUILD_STATIC "build a static lighttpd with all modules added") + +if(BUILD_STATIC) + set(LIGHTTPD_STATIC 1) +else() + set(CMAKE_SHARED_LIBRARY_PREFIX "") +endif() + +if(WITH_LIBEV) + find_package(LibEV REQUIRED) + set(HAVE_LIBEV 1 FORCE) +endif() + +if(WITH_LIBUNWIND) + pkg_check_modules(LIBUNWIND REQUIRED libunwind) + set(HAVE_LIBUNWIND 1 FORCE) +endif() + +if(WITH_WEBDAV_PROPS) + set(WITH_XML 1) + set(WITH_SQLITE3 1) + set(WITH_UUID 1) +endif() + +check_include_files(sys/devpoll.h HAVE_SYS_DEVPOLL_H) +check_include_files(sys/epoll.h HAVE_SYS_EPOLL_H) +check_include_files(sys/event.h HAVE_SYS_EVENT_H) +check_include_files(sys/mman.h HAVE_SYS_MMAN_H) +check_include_files(sys/poll.h HAVE_SYS_POLL_H) +check_include_files(sys/port.h HAVE_SYS_PORT_H) +check_include_files(sys/prctl.h HAVE_SYS_PRCTL_H) +check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H) +check_include_files(sys/sendfile.h HAVE_SYS_SENDFILE_H) +check_include_files(sys/select.h HAVE_SYS_SELECT_H) +check_include_files(sys/syslimits.h HAVE_SYS_SYSLIMITS_H) +check_include_files(sys/types.h HAVE_SYS_TYPES_H) +check_include_files(sys/uio.h HAVE_SYS_UIO_H) +check_include_files(sys/un.h HAVE_SYS_UN_H) +check_include_files(sys/wait.h HAVE_SYS_WAIT_H) +check_include_files(sys/time.h HAVE_SYS_TIME_H) +check_include_files(unistd.h HAVE_UNISTD_H) +check_include_files(pthread.h HAVE_PTHREAD_H) +check_include_files(getopt.h HAVE_GETOPT_H) +check_include_files(inttypes.h HAVE_INTTYPES_H) +check_include_files(poll.h HAVE_POLL_H) +check_include_files(pwd.h HAVE_PWD_H) +check_include_files(stddef.h HAVE_STDDEF_H) +check_include_files(stdint.h HAVE_STDINT_H) +check_include_files(syslog.h HAVE_SYSLOG_H) # check for fastcgi lib, for the tests only -CHECK_INCLUDE_FILES(fastcgi.h HAVE_FASTCGI_H) -CHECK_INCLUDE_FILES(fastcgi/fastcgi.h HAVE_FASTCGI_FASTCGI_H) +check_include_files(fastcgi.h HAVE_FASTCGI_H) +check_include_files(fastcgi/fastcgi.h HAVE_FASTCGI_FASTCGI_H) # will be needed for auth -CHECK_INCLUDE_FILES(crypt.h HAVE_CRYPT_H) +check_include_files(crypt.h HAVE_CRYPT_H) # check if we need libcrypt for crypt_r() -CHECK_LIBRARY_EXISTS(crypt crypt_r "" HAVE_LIBCRYPT_CRYPT_R) -IF(HAVE_LIBCRYPT_CRYPT_R) - SET(HAVE_CRYPT_R 1 FORCE) - SET(HAVE_LIBCRYPT 1 FORCE) -ELSE(HAVE_LIBCRYPT_CRYPT_R) - CHECK_LIBRARY_EXISTS(crypt crypt "" HAVE_LIBCRYPT) -ENDIF(HAVE_LIBCRYPT_CRYPT_R) -CHECK_FUNCTION_EXISTS(crypt_r HAVE_CRYPT_R) - -CHECK_INCLUDE_FILES(sys/inotify.h HAVE_SYS_INOTIFY_H) -IF(HAVE_SYS_INOTIFY_H) - CHECK_FUNCTION_EXISTS(inotify_init HAVE_INOTIFY_INIT) -ENDIF(HAVE_SYS_INOTIFY_H) - -SET(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h) -CHECK_TYPE_SIZE(socklen_t HAVE_SOCKLEN_T) -SET(CMAKE_EXTRA_INCLUDE_FILES) - -CHECK_TYPE_SIZE(long SIZEOF_LONG) -CHECK_TYPE_SIZE(off_t SIZEOF_OFF_T) - -CHECK_FUNCTION_EXISTS(chroot HAVE_CHROOT) -CHECK_FUNCTION_EXISTS(crypt HAVE_CRYPT) -CHECK_FUNCTION_EXISTS(epoll_ctl HAVE_EPOLL_CTL) -CHECK_FUNCTION_EXISTS(fork HAVE_FORK) -CHECK_FUNCTION_EXISTS(getrlimit HAVE_GETRLIMIT) -CHECK_FUNCTION_EXISTS(getuid HAVE_GETUID) -CHECK_FUNCTION_EXISTS(gmtime_r HAVE_GMTIME_R) -CHECK_FUNCTION_EXISTS(inet_ntop HAVE_INET_NTOP) -CHECK_FUNCTION_EXISTS(kqueue HAVE_KQUEUE) -CHECK_FUNCTION_EXISTS(localtime_r HAVE_LOCALTIME_R) -CHECK_FUNCTION_EXISTS(lstat HAVE_LSTAT) -CHECK_FUNCTION_EXISTS(madvise HAVE_MADVISE) -CHECK_FUNCTION_EXISTS(memcpy HAVE_MEMCPY) -CHECK_FUNCTION_EXISTS(memset HAVE_MEMSET) -CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP) -CHECK_FUNCTION_EXISTS(pathconf HAVE_PATHCONF) -CHECK_FUNCTION_EXISTS(poll HAVE_POLL) -CHECK_FUNCTION_EXISTS(port_create HAVE_PORT_CREATE) -CHECK_FUNCTION_EXISTS(prctl HAVE_PRCTL) -CHECK_FUNCTION_EXISTS(pread HAVE_PREAD) -CHECK_FUNCTION_EXISTS(posix_fadvise HAVE_POSIX_FADVISE) -CHECK_FUNCTION_EXISTS(select HAVE_SELECT) -CHECK_FUNCTION_EXISTS(sendfile HAVE_SENDFILE) -CHECK_FUNCTION_EXISTS(send_file HAVE_SEND_FILE) -CHECK_FUNCTION_EXISTS(sendfile64 HAVE_SENDFILE64) -CHECK_FUNCTION_EXISTS(sendfilev HAVE_SENDFILEV) -CHECK_FUNCTION_EXISTS(sigaction HAVE_SIGACTION) -CHECK_FUNCTION_EXISTS(signal HAVE_SIGNAL) -CHECK_FUNCTION_EXISTS(sigtimedwait HAVE_SIGTIMEDWAIT) -CHECK_FUNCTION_EXISTS(strptime HAVE_STRPTIME) -CHECK_FUNCTION_EXISTS(syslog HAVE_SYSLOG) -CHECK_FUNCTION_EXISTS(writev HAVE_WRITEV) -CHECK_FUNCTION_EXISTS(inet_aton HAVE_INET_ATON) -CHECK_C_SOURCE_COMPILES(" +check_library_exists(crypt crypt_r "" HAVE_LIBCRYPT_CRYPT_R) +if(HAVE_LIBCRYPT_CRYPT_R) + set(HAVE_CRYPT_R 1 FORCE) + set(HAVE_LIBCRYPT 1 FORCE) +else() + check_library_exists(crypt crypt "" HAVE_LIBCRYPT) +endif() +check_function_exists(crypt_r HAVE_CRYPT_R) + +check_include_files(sys/inotify.h HAVE_SYS_INOTIFY_H) +if(HAVE_SYS_INOTIFY_H) + check_function_exists(inotify_init HAVE_INOTIFY_INIT) +endif() + +set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h) +check_type_size(socklen_t HAVE_SOCKLEN_T) +set(CMAKE_EXTRA_INCLUDE_FILES) + +check_type_size(long SIZEOF_LONG) +check_type_size(off_t SIZEOF_OFF_T) + +check_function_exists(chroot HAVE_CHROOT) +check_function_exists(crypt HAVE_CRYPT) +check_function_exists(epoll_ctl HAVE_EPOLL_CTL) +check_function_exists(fork HAVE_FORK) +check_function_exists(getrlimit HAVE_GETRLIMIT) +check_function_exists(getuid HAVE_GETUID) +check_function_exists(gmtime_r HAVE_GMTIME_R) +check_function_exists(inet_ntop HAVE_INET_NTOP) +check_function_exists(kqueue HAVE_KQUEUE) +check_function_exists(localtime_r HAVE_LOCALTIME_R) +check_function_exists(lstat HAVE_LSTAT) +check_function_exists(madvise HAVE_MADVISE) +check_function_exists(memcpy HAVE_MEMCPY) +check_function_exists(memset HAVE_MEMSET) +check_function_exists(mmap HAVE_MMAP) +check_function_exists(pathconf HAVE_PATHCONF) +check_function_exists(poll HAVE_POLL) +check_function_exists(port_create HAVE_PORT_CREATE) +check_function_exists(prctl HAVE_PRCTL) +check_function_exists(pread HAVE_PREAD) +check_function_exists(posix_fadvise HAVE_POSIX_FADVISE) +check_function_exists(select HAVE_SELECT) +check_function_exists(sendfile HAVE_SENDFILE) +check_function_exists(send_file HAVE_SEND_FILE) +check_function_exists(sendfile64 HAVE_SENDFILE64) +check_function_exists(sendfilev HAVE_SENDFILEV) +check_function_exists(sigaction HAVE_SIGACTION) +check_function_exists(signal HAVE_SIGNAL) +check_function_exists(sigtimedwait HAVE_SIGTIMEDWAIT) +check_function_exists(strptime HAVE_STRPTIME) +check_function_exists(syslog HAVE_SYSLOG) +check_function_exists(writev HAVE_WRITEV) +check_function_exists(inet_aton HAVE_INET_ATON) +check_c_source_compiles(" #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> - + int main() { struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0; return 0; }" HAVE_IPV6) -CHECK_FUNCTION_EXISTS(issetugid HAVE_ISSETUGID) -CHECK_FUNCTION_EXISTS(inet_pton HAVE_INET_PTON) +check_function_exists(issetugid HAVE_ISSETUGID) +check_function_exists(inet_pton HAVE_INET_PTON) ## refactor me -MACRO(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags) +macro(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags) # reset the variables at the beginning - SET(${_include_DIR}) - SET(${_link_DIR}) - SET(${_link_FLAGS}) - SET(${_cflags}) - - FIND_PROGRAM(${_package}CONFIG_EXECUTABLE NAMES ${_package} PATHS /usr/local/bin ) - - # if pkg-config has been found - IF(${_package}CONFIG_EXECUTABLE) - SET(XCONFIG_EXECUTABLE "${${_package}CONFIG_EXECUTABLE}") - MESSAGE(STATUS "found ${_package}: ${XCONFIG_EXECUTABLE}") - - EXEC_PROGRAM(${XCONFIG_EXECUTABLE} ARGS --libs OUTPUT_VARIABLE __link_FLAGS) - STRING(REPLACE "\n" "" ${_link_FLAGS} ${__link_FLAGS}) - EXEC_PROGRAM(${XCONFIG_EXECUTABLE} ARGS --cflags OUTPUT_VARIABLE __cflags) - STRING(REPLACE "\n" "" ${_cflags} ${__cflags}) - - ELSE(${_package}CONFIG_EXECUTABLE) - MESSAGE(STATUS "found ${_package}: no") - ENDIF(${_package}CONFIG_EXECUTABLE) -ENDMACRO(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags) - -IF(WITH_XATTR) - CHECK_INCLUDE_FILES(attr/attributes.h HAVE_ATTR_ATTRIBUTES_H) - IF(HAVE_ATTR_ATTRIBUTES_H) - CHECK_LIBRARY_EXISTS(attr attr_get "" HAVE_XATTR) - ENDIF(HAVE_ATTR_ATTRIBUTES_H) -ENDIF(WITH_XATTR) - -IF(WITH_MYSQL) - XCONFIG(mysql_config MYSQL_INCDIR MYSQL_LIBDIR MYSQL_LDFLAGS MYSQL_CFLAGS) - - SET(CMAKE_REQUIRED_INCLUDES /usr/include/mysql) - CHECK_INCLUDE_FILES(mysql.h HAVE_MYSQL_H) - SET(CMAKE_REQUIRED_INCLUDES) - IF(HAVE_MYSQL_H) - CHECK_LIBRARY_EXISTS(mysqlclient mysql_real_connect "" HAVE_MYSQL) - ENDIF(HAVE_MYSQL_H) -ENDIF(WITH_MYSQL) - -IF(WITH_OPENSSL) - CHECK_INCLUDE_FILES(openssl/ssl.h HAVE_OPENSSL_SSL_H) - IF(HAVE_OPENSSL_SSL_H) - CHECK_LIBRARY_EXISTS(crypto BIO_f_base64 "" HAVE_LIBCRYPTO) - IF(HAVE_LIBCRYPTO) - SET(OPENSSL_NO_KRB5 1) - CHECK_LIBRARY_EXISTS(ssl SSL_new "" HAVE_LIBSSL) - ENDIF(HAVE_LIBCRYPTO) - ENDIF(HAVE_OPENSSL_SSL_H) -ENDIF(WITH_OPENSSL) - -IF(WITH_PCRE) - ## if we have pcre-config, use it - XCONFIG(pcre-config PCRE_INCDIR PCRE_LIBDIR PCRE_LDFLAGS PCRE_CFLAGS) - IF(PCRE_LDFLAGS OR PCRE_CFLAGS) - MESSAGE(STATUS "found pcre at: LDFLAGS: ${PCRE_LDFLAGS} CFLAGS: ${PCRE_CFLAGS}") - - IF(NOT PCRE_CFLAGS STREQUAL "\n") - ## if it is empty we'll get newline returned - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PCRE_CFLAGS}") - ENDIF(NOT PCRE_CFLAGS STREQUAL "\n") - - SET(HAVE_PCRE_H 1) - SET(HAVE_LIBPCRE 1) - ELSE(PCRE_LDFLAGS OR PCRE_CFLAGS) - IF(NOT WIN32) - CHECK_INCLUDE_FILES(pcre.h HAVE_PCRE_H) - CHECK_LIBRARY_EXISTS(pcre pcre_exec "" HAVE_LIBPCRE) - SET(PCRE_LDFLAGS -lpcre) - ELSE(NOT WIN32) - FIND_PATH(PCRE_INCLUDE_DIR pcre.h - /usr/local/include - /usr/include - ) - - SET(PCRE_NAMES pcre) - FIND_LIBRARY(PCRE_LIBRARY - NAMES ${PCRE_NAMES} - PATHS /usr/lib /usr/local/lib - ) - - IF(PCRE_INCLUDE_DIR AND PCRE_LIBRARY) - SET(CMAKE_REQUIRED_INCLUDES ${PCRE_INCLUDE_DIR}) - SET(CMAKE_REQUIRED_LIBRARIES ${PCRE_LIBRARY}) - CHECK_INCLUDE_FILES(pcre.h HAVE_PCRE_H) - CHECK_LIBRARY_EXISTS(pcre pcre_exec "" HAVE_LIBPCRE) - SET(CMAKE_REQUIRED_INCLUDES) - SET(CMAKE_REQUIRED_LIBRARIES) - INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR}) - ENDIF(PCRE_INCLUDE_DIR AND PCRE_LIBRARY) - ENDIF(NOT WIN32) - ENDIF(PCRE_LDFLAGS OR PCRE_CFLAGS) - - IF(NOT HAVE_PCRE_H) - MESSAGE(FATAL_ERROR "pcre.h couldn't be found") - ENDIF(NOT HAVE_PCRE_H) - IF(NOT HAVE_LIBPCRE) - MESSAGE(FATAL_ERROR "libpcre couldn't be found") - ENDIF(NOT HAVE_LIBPCRE) - -ENDIF(WITH_PCRE) - - -IF(WITH_XML) - XCONFIG(xml2-config XML2_INCDIR XML2_LIBDIR XML2_LDFLAGS XML2_CFLAGS) - IF(XML2_LDFLAGS OR XML2_CFLAGS) - MESSAGE(STATUS "found xml2 at: LDFLAGS: ${XML2_LDFLAGS} CFLAGS: ${XML2_CFLAGS}") - - ## if it is empty we'll get newline returned - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XML2_CFLAGS}") - - CHECK_INCLUDE_FILES(libxml/tree.h HAVE_LIBXML_H) - - SET(CMAKE_REQUIRED_FLAGS ${XML2_LDFLAGS}) - CHECK_LIBRARY_EXISTS(xml2 xmlParseChunk "" HAVE_LIBXML) - SET(CMAKE_REQUIRED_FLAGS) - ELSE(XML2_LDFLAGS OR XML2_CFLAGS) - CHECK_INCLUDE_FILES(libxml.h HAVE_LIBXML_H) - CHECK_LIBRARY_EXISTS(xml2 xmlParseChunk "" HAVE_LIBXML) - ENDIF(XML2_LDFLAGS OR XML2_CFLAGS) - - IF(NOT HAVE_LIBXML_H) - MESSAGE(FATAL_ERROR "libxml/tree.h couldn't be found") - ENDIF(NOT HAVE_LIBXML_H) - IF(NOT HAVE_LIBXML) - MESSAGE(FATAL_ERROR "libxml2 couldn't be found") - ENDIF(NOT HAVE_LIBXML) - -ENDIF(WITH_XML) - -IF(WITH_SQLITE3) - CHECK_INCLUDE_FILES(sqlite3.h HAVE_SQLITE3_H) - CHECK_LIBRARY_EXISTS(sqlite3 sqlite3_reset "" HAVE_SQLITE3) -ENDIF(WITH_SQLITE3) - -IF(WITH_UUID) - CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_UUID_H) - CHECK_LIBRARY_EXISTS(uuid uuid_generate "" NEED_LIBUUID) - IF(NOT NEED_LIBUUID) - CHECK_FUNCTION_EXISTS(uuid_generate HAVE_LIBUUID) - ELSE(NOT NEED_LIBUUID) - SET(HAVE_LIBUUID 1) - ENDIF(NOT NEED_LIBUUID) -ENDIF(WITH_UUID) - -IF(WITH_ZLIB) - IF(NOT WIN32) - CHECK_INCLUDE_FILES(zlib.h HAVE_ZLIB_H) - CHECK_LIBRARY_EXISTS(z deflate "" HAVE_LIBZ) - SET(ZLIB_LIBRARY z) - ELSE(NOT WIN32) - FIND_PATH(ZLIB_INCLUDE_DIR zlib.h - /usr/local/include - /usr/include - ) - - SET(ZLIB_NAMES z zlib zdll) - FIND_LIBRARY(ZLIB_LIBRARY - NAMES ${ZLIB_NAMES} - PATHS /usr/lib /usr/local/lib - ) - - - IF(ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY) - SET(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR}) - SET(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY}) - GET_FILENAME_COMPONENT(ZLIB_NAME ${ZLIB_LIBRARY} NAME) - CHECK_INCLUDE_FILES(zlib.h HAVE_ZLIB_H) - CHECK_LIBRARY_EXISTS(${ZLIB_NAME} deflate "" HAVE_LIBZ) - SET(CMAKE_REQUIRED_INCLUDES) - SET(CMAKE_REQUIRED_LIBRARIES) - INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) - - ENDIF(ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY) - ENDIF(NOT WIN32) -ENDIF(WITH_ZLIB) - -IF(WITH_BZIP) - CHECK_INCLUDE_FILES(bzlib.h HAVE_BZLIB_H) - CHECK_LIBRARY_EXISTS(bz2 BZ2_bzCompress "" HAVE_LIBBZ2) -ENDIF(WITH_BZIP) - -IF(WITH_LDAP) - CHECK_INCLUDE_FILES(ldap.h HAVE_LDAP_H) - CHECK_LIBRARY_EXISTS(ldap ldap_bind "" HAVE_LIBLDAP) - CHECK_INCLUDE_FILES(lber.h HAVE_LBER_H) - CHECK_LIBRARY_EXISTS(lber ber_printf "" HAVE_LIBLBER) - SET(LDAP_DEPRECATED 1) # Using deprecated ldap api -ENDIF(WITH_LDAP) - -IF(WITH_LUA) - pkg_search_module(LUA REQUIRED lua lua5.1 lua-5.1) - MESSAGE(STATUS "found lua at: INCDIR: ${LUA_INCLUDE_DIRS} LIBDIR: ${LUA_LIBRARY_DIRS} LDFLAGS: ${LUA_LDFLAGS} CFLAGS: ${LUA_CFLAGS}") - SET(HAVE_LIBLUA 1 "Have liblua") - SET(HAVE_LUA_H 1 "Have liblua header") -ENDIF(WITH_LUA) - -IF(WITH_FAM) - CHECK_INCLUDE_FILES(fam.h HAVE_FAM_H) - CHECK_LIBRARY_EXISTS(fam FAMOpen2 "" HAVE_LIBFAM) - IF(HAVE_LIBFAM) - SET(CMAKE_REQUIRED_LIBRARIES fam) - CHECK_FUNCTION_EXISTS(FAMNoExists HAVE_FAMNOEXISTS) - ENDIF(HAVE_LIBFAM) -ENDIF(WITH_FAM) - -IF(WITH_GDBM) - CHECK_INCLUDE_FILES(gdbm.h HAVE_GDBM_H) - CHECK_LIBRARY_EXISTS(gdbm gdbm_open "" HAVE_GDBM) -ENDIF(WITH_GDBM) - -IF(WITH_MEMCACHE) - CHECK_INCLUDE_FILES(memcache.h HAVE_MEMCACHE_H) - CHECK_LIBRARY_EXISTS(memcache mc_new "" HAVE_MEMCACHE) -ENDIF(WITH_MEMCACHE) - -IF(NOT BUILD_STATIC) - CHECK_INCLUDE_FILES(dlfcn.h HAVE_DLFCN_H) -ENDIF(NOT BUILD_STATIC) - -IF(HAVE_DLFCN_H) - CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL) -ENDIF(HAVE_DLFCN_H) - -SET(LIGHTTPD_VERSION_ID 10400) -SET(PACKAGE_NAME "${CMAKE_PROJECT_NAME}") -SET(PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}") -EXEC_PROGRAM(date ARGS "'+%b %d %Y %H:%M:%S UTC'" OUTPUT_VARIABLE PACKAGE_BUILD_DATE) - -IF(NOT SBINDIR) - SET(SBINDIR "sbin") -ENDIF(NOT SBINDIR) - -IF(NOT LIGHTTPD_MODULES_DIR) - SET(LIGHTTPD_MODULES_DIR "lib${LIB_SUFFIX}/lighttpd") -ENDIF(NOT LIGHTTPD_MODULES_DIR) - -IF(NOT WIN32) - SET(LIGHTTPD_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/${LIGHTTPD_MODULES_DIR}") -ELSE(NOT WIN32) + set(${_include_DIR}) + set(${_link_DIR}) + set(${_link_FLAGS}) + set(${_cflags}) + + find_program(${_package}CONFIG_EXECUTABLE NAMES ${_package} PATHS /usr/local/bin ) + + # if pkg-config has been found + if(${_package}CONFIG_EXECUTABLE) + set(XCONFIG_EXECUTABLE "${${_package}CONFIG_EXECUTABLE}") + message(STATUS "found ${_package}: ${XCONFIG_EXECUTABLE}") + + exec_program(${XCONFIG_EXECUTABLE} ARGS --libs OUTPUT_VARIABLE __link_FLAGS) + string(REPLACE "\n" "" ${_link_FLAGS} ${__link_FLAGS}) + exec_program(${XCONFIG_EXECUTABLE} ARGS --cflags OUTPUT_VARIABLE __cflags) + string(REPLACE "\n" "" ${_cflags} ${__cflags}) + + else() + message(STATUS "found ${_package}: no") + endif() +endmacro(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags) + +if(WITH_XATTR) + check_include_files(attr/attributes.h HAVE_ATTR_ATTRIBUTES_H) + if(HAVE_ATTR_ATTRIBUTES_H) + check_library_exists(attr attr_get "" HAVE_XATTR) + endif() +endif() + +if(WITH_MYSQL) + xconfig(mysql_config MYSQL_INCDIR MYSQL_LIBDIR MYSQL_LDFLAGS MYSQL_CFLAGS) + + set(CMAKE_REQUIRED_INCLUDES /usr/include/mysql) + check_include_files(mysql.h HAVE_MYSQL_H) + set(CMAKE_REQUIRED_INCLUDES) + if(HAVE_MYSQL_H) + check_library_exists(mysqlclient mysql_real_connect "" HAVE_MYSQL) + endif() +endif() + +if(WITH_OPENSSL) + check_include_files(openssl/ssl.h HAVE_OPENSSL_SSL_H) + if(HAVE_OPENSSL_SSL_H) + check_library_exists(crypto BIO_f_base64 "" HAVE_LIBCRYPTO) + if(HAVE_LIBCRYPTO) + set(OPENSSL_NO_KRB5 1) + check_library_exists(ssl SSL_new "" HAVE_LIBSSL) + endif() + endif() +endif() + +if(WITH_PCRE) + ## if we have pcre-config, use it + xconfig(pcre-config PCRE_INCDIR PCRE_LIBDIR PCRE_LDFLAGS PCRE_CFLAGS) + if(PCRE_LDFLAGS OR PCRE_CFLAGS) + message(STATUS "found pcre at: LDFLAGS: ${PCRE_LDFLAGS} CFLAGS: ${PCRE_CFLAGS}") + + if(NOT PCRE_CFLAGS STREQUAL "\n") + ## if it is empty we'll get newline returned + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PCRE_CFLAGS}") + endif() + + set(HAVE_PCRE_H 1) + set(HAVE_LIBPCRE 1) + else() + if(NOT WIN32) + check_include_files(pcre.h HAVE_PCRE_H) + check_library_exists(pcre pcre_exec "" HAVE_LIBPCRE) + set(PCRE_LDFLAGS -lpcre) + else() + find_path(PCRE_INCLUDE_DIR pcre.h + /usr/local/include + /usr/include + ) + + set(PCRE_NAMES pcre) + find_library(PCRE_LIBRARY + NAMES ${PCRE_NAMES} + PATHS /usr/lib /usr/local/lib + ) + + if(PCRE_INCLUDE_DIR AND PCRE_LIBRARY) + set(CMAKE_REQUIRED_INCLUDES ${PCRE_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${PCRE_LIBRARY}) + check_include_files(pcre.h HAVE_PCRE_H) + check_library_exists(pcre pcre_exec "" HAVE_LIBPCRE) + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_LIBRARIES) + include_directories(${PCRE_INCLUDE_DIR}) + endif() + endif() + endif() + + if(NOT HAVE_PCRE_H) + message(FATAL_ERROR "pcre.h couldn't be found") + endif() + if(NOT HAVE_LIBPCRE) + message(FATAL_ERROR "libpcre couldn't be found") + endif() + +endif() + + +if(WITH_XML) + xconfig(xml2-config XML2_INCDIR XML2_LIBDIR XML2_LDFLAGS XML2_CFLAGS) + if(XML2_LDFLAGS OR XML2_CFLAGS) + message(STATUS "found xml2 at: LDFLAGS: ${XML2_LDFLAGS} CFLAGS: ${XML2_CFLAGS}") + + ## if it is empty we'll get newline returned + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XML2_CFLAGS}") + + check_include_files(libxml/tree.h HAVE_LIBXML_H) + + set(CMAKE_REQUIRED_FLAGS ${XML2_LDFLAGS}) + check_library_exists(xml2 xmlParseChunk "" HAVE_LIBXML) + set(CMAKE_REQUIRED_FLAGS) + else() + check_include_files(libxml.h HAVE_LIBXML_H) + check_library_exists(xml2 xmlParseChunk "" HAVE_LIBXML) + endif() + + if(NOT HAVE_LIBXML_H) + message(FATAL_ERROR "libxml/tree.h couldn't be found") + endif() + if(NOT HAVE_LIBXML) + message(FATAL_ERROR "libxml2 couldn't be found") + endif() + +endif() + +if(WITH_SQLITE3) + check_include_files(sqlite3.h HAVE_SQLITE3_H) + check_library_exists(sqlite3 sqlite3_reset "" HAVE_SQLITE3) +endif() + +if(WITH_UUID) + check_include_files(uuid/uuid.h HAVE_UUID_UUID_H) + check_library_exists(uuid uuid_generate "" NEED_LIBUUID) + if(NOT NEED_LIBUUID) + check_function_exists(uuid_generate HAVE_LIBUUID) + else() + set(HAVE_LIBUUID 1) + endif() +endif() + +if(WITH_ZLIB) + if(NOT WIN32) + check_include_files(zlib.h HAVE_ZLIB_H) + check_library_exists(z deflate "" HAVE_LIBZ) + set(ZLIB_LIBRARY z) + else() + find_path(ZLIB_INCLUDE_DIR zlib.h + /usr/local/include + /usr/include + ) + + set(ZLIB_NAMES z zlib zdll) + find_library(ZLIB_LIBRARY + NAMES ${ZLIB_NAMES} + PATHS /usr/lib /usr/local/lib + ) + + + if(ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY) + set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY}) + get_filename_component(ZLIB_NAME ${ZLIB_LIBRARY} NAME) + check_include_files(zlib.h HAVE_ZLIB_H) + check_library_exists(${ZLIB_NAME} deflate "" HAVE_LIBZ) + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_LIBRARIES) + include_directories(${ZLIB_INCLUDE_DIR}) + + endif() + endif() +endif() + +if(WITH_BZIP) + check_include_files(bzlib.h HAVE_BZLIB_H) + check_library_exists(bz2 BZ2_bzCompress "" HAVE_LIBBZ2) +endif() + +if(WITH_LDAP) + check_include_files(ldap.h HAVE_LDAP_H) + check_library_exists(ldap ldap_bind "" HAVE_LIBLDAP) + check_include_files(lber.h HAVE_LBER_H) + check_library_exists(lber ber_printf "" HAVE_LIBLBER) + set(LDAP_DEPRECATED 1) # Using deprecated ldap api +endif() + +if(WITH_LUA) + pkg_search_module(LUA REQUIRED lua lua5.1 lua-5.1) + message(STATUS "found lua at: INCDIR: ${LUA_INCLUDE_DIRS} LIBDIR: ${LUA_LIBRARY_DIRS} LDFLAGS: ${LUA_LDFLAGS} CFLAGS: ${LUA_CFLAGS}") + set(HAVE_LIBLUA 1 "Have liblua") + set(HAVE_LUA_H 1 "Have liblua header") +endif() + +if(WITH_FAM) + check_include_files(fam.h HAVE_FAM_H) + check_library_exists(fam FAMOpen2 "" HAVE_LIBFAM) + if(HAVE_LIBFAM) + set(CMAKE_REQUIRED_LIBRARIES fam) + check_function_exists(FAMNoExists HAVE_FAMNOEXISTS) + endif() +endif() + +if(WITH_GDBM) + check_include_files(gdbm.h HAVE_GDBM_H) + check_library_exists(gdbm gdbm_open "" HAVE_GDBM) +endif() + +if(WITH_MEMCACHE) + check_include_files(memcache.h HAVE_MEMCACHE_H) + check_library_exists(memcache mc_new "" HAVE_MEMCACHE) +endif() + +if(NOT BUILD_STATIC) + check_include_files(dlfcn.h HAVE_DLFCN_H) +endif() + +if(HAVE_DLFCN_H) + check_library_exists(dl dlopen "" HAVE_LIBDL) +endif() + +set(LIGHTTPD_VERSION_ID 10400) +set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}") +set(PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}") +exec_program(date ARGS "'+%b %d %Y %H:%M:%S UTC'" OUTPUT_VARIABLE PACKAGE_BUILD_DATE) + +if(NOT SBINDIR) + set(SBINDIR "sbin") +endif() + +if(NOT LIGHTTPD_MODULES_DIR) + set(LIGHTTPD_MODULES_DIR "lib${LIB_SUFFIX}/lighttpd") +endif() + +if(NOT WIN32) + set(LIGHTTPD_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/${LIGHTTPD_MODULES_DIR}") +else() ## We use relative path in windows - SET(LIGHTTPD_LIBRARY_DIR "lib") -ENDIF(NOT WIN32) + set(LIGHTTPD_LIBRARY_DIR "lib") +endif() ## Write out config.h -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) -ADD_DEFINITIONS(-DHAVE_CONFIG_H) +add_definitions(-DHAVE_CONFIG_H) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -SET(COMMON_SRC +set(COMMON_SRC buffer.c log.c keyvalue.c chunk.c http_chunk.c stream.c fdevent.c @@ -443,24 +443,24 @@ SET(COMMON_SRC status_counter.c ) -IF(WIN32) - MESSAGE(STATUS "Adding local getopt implementation.") - SET(COMMON_SRC ${COMMON_SRC} xgetopt.c) -ENDIF(WIN32) +if(WIN32) + message(STATUS "Adding local getopt implementation.") + set(COMMON_SRC ${COMMON_SRC} xgetopt.c) +endif() -ADD_EXECUTABLE(lemon lemon.c) +add_executable(lemon lemon.c) ## Build parsers by using lemon... -LEMON_PARSER(configparser.y) -LEMON_PARSER(mod_ssi_exprparser.y) +lemon_parser(configparser.y) +lemon_parser(mod_ssi_exprparser.y) -SET(L_INSTALL_TARGETS) +set(L_INSTALL_TARGETS) -ADD_EXECUTABLE(lighttpd-angel lighttpd-angel.c) -SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd-angel) -ADD_TARGET_PROPERTIES(lighttpd-angel COMPILE_FLAGS "-DSBIN_DIR=\\\\\"${CMAKE_INSTALL_PREFIX}/${SBINDIR}\\\\\"") +add_executable(lighttpd-angel lighttpd-angel.c) +set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd-angel) +add_target_properties(lighttpd-angel COMPILE_FLAGS "-DSBIN_DIR=\\\\\"${CMAKE_INSTALL_PREFIX}/${SBINDIR}\\\\\"") -ADD_EXECUTABLE(lighttpd +add_executable(lighttpd server.c response.c connections.c @@ -471,176 +471,176 @@ ADD_EXECUTABLE(lighttpd proc_open.c ${COMMON_SRC} ) -SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd) - -ADD_AND_INSTALL_LIBRARY(mod_access mod_access.c) -ADD_AND_INSTALL_LIBRARY(mod_accesslog mod_accesslog.c) -ADD_AND_INSTALL_LIBRARY(mod_alias mod_alias.c) -ADD_AND_INSTALL_LIBRARY(mod_auth "mod_auth.c;http_auth.c") -IF(NOT WIN32) -ADD_AND_INSTALL_LIBRARY(mod_cgi mod_cgi.c) -ENDIF(NOT WIN32) -ADD_AND_INSTALL_LIBRARY(mod_cml "mod_cml.c;mod_cml_lua.c;mod_cml_funcs.c") -ADD_AND_INSTALL_LIBRARY(mod_compress mod_compress.c) -ADD_AND_INSTALL_LIBRARY(mod_dirlisting mod_dirlisting.c) -ADD_AND_INSTALL_LIBRARY(mod_evasive mod_evasive.c) -ADD_AND_INSTALL_LIBRARY(mod_evhost mod_evhost.c) -ADD_AND_INSTALL_LIBRARY(mod_expire mod_expire.c) -ADD_AND_INSTALL_LIBRARY(mod_extforward mod_extforward.c) -ADD_AND_INSTALL_LIBRARY(mod_fastcgi mod_fastcgi.c) -ADD_AND_INSTALL_LIBRARY(mod_flv_streaming mod_flv_streaming.c) -ADD_AND_INSTALL_LIBRARY(mod_indexfile mod_indexfile.c) -ADD_AND_INSTALL_LIBRARY(mod_magnet "mod_magnet.c;mod_magnet_cache.c") -ADD_AND_INSTALL_LIBRARY(mod_mysql_vhost mod_mysql_vhost.c) -ADD_AND_INSTALL_LIBRARY(mod_proxy mod_proxy.c) -ADD_AND_INSTALL_LIBRARY(mod_redirect mod_redirect.c) -ADD_AND_INSTALL_LIBRARY(mod_rewrite mod_rewrite.c) -ADD_AND_INSTALL_LIBRARY(mod_rrdtool mod_rrdtool.c) -ADD_AND_INSTALL_LIBRARY(mod_scgi mod_scgi.c) -ADD_AND_INSTALL_LIBRARY(mod_secdownload mod_secure_download.c) -ADD_AND_INSTALL_LIBRARY(mod_setenv mod_setenv.c) -ADD_AND_INSTALL_LIBRARY(mod_simple_vhost mod_simple_vhost.c) -ADD_AND_INSTALL_LIBRARY(mod_ssi "mod_ssi_exprparser.c;mod_ssi_expr.c;mod_ssi.c") -ADD_AND_INSTALL_LIBRARY(mod_staticfile mod_staticfile.c) -ADD_AND_INSTALL_LIBRARY(mod_status mod_status.c) -ADD_AND_INSTALL_LIBRARY(mod_trigger_b4_dl mod_trigger_b4_dl.c) -# ADD_AND_INSTALL_LIBRARY(mod_uploadprogress mod_uploadprogress.c) -ADD_AND_INSTALL_LIBRARY(mod_userdir mod_userdir.c) -ADD_AND_INSTALL_LIBRARY(mod_usertrack mod_usertrack.c) -ADD_AND_INSTALL_LIBRARY(mod_webdav mod_webdav.c) - -IF(HAVE_PCRE_H) - TARGET_LINK_LIBRARIES(lighttpd ${PCRE_LDFLAGS}) - ADD_TARGET_PROPERTIES(lighttpd COMPILE_FLAGS ${PCRE_CFLAGS}) - TARGET_LINK_LIBRARIES(mod_rewrite ${PCRE_LDFLAGS}) - ADD_TARGET_PROPERTIES(mod_rewrite COMPILE_FLAGS ${PCRE_CFLAGS}) - TARGET_LINK_LIBRARIES(mod_dirlisting ${PCRE_LDFLAGS}) - ADD_TARGET_PROPERTIES(mod_dirlisting COMPILE_FLAGS ${PCRE_CFLAGS}) - TARGET_LINK_LIBRARIES(mod_redirect ${PCRE_LDFLAGS}) - ADD_TARGET_PROPERTIES(mod_redirect COMPILE_FLAGS ${PCRE_CFLAGS}) - TARGET_LINK_LIBRARIES(mod_ssi ${PCRE_LDFLAGS}) - ADD_TARGET_PROPERTIES(mod_ssi COMPILE_FLAGS ${PCRE_CFLAGS}) - TARGET_LINK_LIBRARIES(mod_trigger_b4_dl ${PCRE_LDFLAGS}) - ADD_TARGET_PROPERTIES(mod_trigger_b4_dl COMPILE_FLAGS ${PCRE_CFLAGS}) -ENDIF(HAVE_PCRE_H) - -TARGET_LINK_LIBRARIES(mod_magnet ${LUA_LDFLAGS}) -ADD_TARGET_PROPERTIES(mod_magnet COMPILE_FLAGS ${LUA_CFLAGS}) - -TARGET_LINK_LIBRARIES(mod_cml ${LUA_LDFLAGS}) -ADD_TARGET_PROPERTIES(mod_cml COMPILE_FLAGS ${LUA_CFLAGS}) - -IF(HAVE_MYSQL_H AND HAVE_MYSQL) - TARGET_LINK_LIBRARIES(mod_mysql_vhost mysqlclient) - INCLUDE_DIRECTORIES(/usr/include/mysql) -ENDIF(HAVE_MYSQL_H AND HAVE_MYSQL) - -SET(L_MOD_WEBDAV) -IF(HAVE_SQLITE3_H) - SET(L_MOD_WEBDAV ${L_MOD_WEBDAV} sqlite3) -ENDIF(HAVE_SQLITE3_H) -IF(HAVE_LIBXML_H) - TARGET_LINK_LIBRARIES(mod_webdav ${XML2_LDFLAGS}) -ENDIF(HAVE_LIBXML_H) -IF(HAVE_UUID_H) - IF(NEED_LIBUUID) - SET(L_MOD_WEBDAV ${L_MOD_WEBDAV} uuid) - ENDIF(NEED_LIBUUID) -ENDIF(HAVE_UUID_H) - -TARGET_LINK_LIBRARIES(mod_webdav ${L_MOD_WEBDAV}) - -SET(L_MOD_AUTH) -IF(HAVE_LIBCRYPT) - SET(L_MOD_AUTH ${L_MOD_AUTH} crypt) -ENDIF(HAVE_LIBCRYPT) - -IF(HAVE_LDAP_H) - SET(L_MOD_AUTH ${L_MOD_AUTH} ldap lber) -ENDIF(HAVE_LDAP_H) -TARGET_LINK_LIBRARIES(mod_auth ${L_MOD_AUTH}) - -IF(HAVE_ZLIB_H) - IF(HAVE_BZLIB_H) - TARGET_LINK_LIBRARIES(mod_compress ${ZLIB_LIBRARY} bz2) - ELSE(HAVE_BZLIB_H) - TARGET_LINK_LIBRARIES(mod_compress ${ZLIB_LIBRARY}) - ENDIF(HAVE_BZLIB_H) -ENDIF(HAVE_ZLIB_H) - -IF(HAVE_LIBFAM) - TARGET_LINK_LIBRARIES(lighttpd fam) -ENDIF(HAVE_LIBFAM) - -IF(HAVE_GDBM_H) - TARGET_LINK_LIBRARIES(mod_trigger_b4_dl gdbm) -ENDIF(HAVE_GDBM_H) - -IF(HAVE_MEMCACHE_H) - TARGET_LINK_LIBRARIES(mod_trigger_b4_dl memcache) -ENDIF(HAVE_MEMCACHE_H) - -IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -g -Wshadow -W -pedantic ${WARN_FLAGS}") - SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0") - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2") - ADD_DEFINITIONS(-D_GNU_SOURCE) -ENDIF(CMAKE_COMPILER_IS_GNUCC) - -ADD_TARGET_PROPERTIES(lighttpd LINK_FLAGS "-export-dynamic") - -SET_TARGET_PROPERTIES(lighttpd PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) - -IF(WIN32) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVALGRIND") - ADD_TARGET_PROPERTIES(lighttpd COMPILE_FLAGS "-DLI_DECLARE_EXPORTS") - TARGET_LINK_LIBRARIES(lighttpd ws2_32) - TARGET_LINK_LIBRARIES(mod_proxy ws2_32) - TARGET_LINK_LIBRARIES(mod_fcgi ws2_32) - TARGET_LINK_LIBRARIES(mod_scgi ws2_32) - TARGET_LINK_LIBRARIES(mod_ssi ws2_32) - - IF(MINGW) - TARGET_LINK_LIBRARIES(lighttpd msvcr70) - ADD_TARGET_PROPERTIES(lighttpd LINK_FLAGS "-Wl,-subsystem,console") - ENDIF(MINGW) -ENDIF(WIN32) - -IF(NOT BUILD_STATIC) - IF(HAVE_LIBDL) - TARGET_LINK_LIBRARIES(lighttpd dl) - ENDIF(HAVE_LIBDL) -ENDIF(NOT BUILD_STATIC) - -IF(HAVE_LIBSSL AND HAVE_LIBCRYPTO) - TARGET_LINK_LIBRARIES(lighttpd ssl) - TARGET_LINK_LIBRARIES(lighttpd crypto) -ENDIF(HAVE_LIBSSL AND HAVE_LIBCRYPTO) - -IF(WITH_LIBEV) - TARGET_LINK_LIBRARIES(lighttpd ${LIBEV_LDFLAGS}) - ADD_TARGET_PROPERTIES(lighttpd COMPILE_FLAGS ${LIBEV_CFLAGS}) -ENDIF(WITH_LIBEV) - -IF(WITH_LIBUNWIND) - TARGET_LINK_LIBRARIES(lighttpd ${LIBUNWIND_LDFLAGS}) - ADD_TARGET_PROPERTIES(lighttpd COMPILE_FLAGS ${LIBUNWIND_CFLAGS}) -ENDIF() - -IF(NOT WIN32) -INSTALL(TARGETS ${L_INSTALL_TARGETS} +set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd) + +add_and_install_library(mod_access mod_access.c) +add_and_install_library(mod_accesslog mod_accesslog.c) +add_and_install_library(mod_alias mod_alias.c) +add_and_install_library(mod_auth "mod_auth.c;http_auth.c") +if(NOT WIN32) +add_and_install_library(mod_cgi mod_cgi.c) +endif() +add_and_install_library(mod_cml "mod_cml.c;mod_cml_lua.c;mod_cml_funcs.c") +add_and_install_library(mod_compress mod_compress.c) +add_and_install_library(mod_dirlisting mod_dirlisting.c) +add_and_install_library(mod_evasive mod_evasive.c) +add_and_install_library(mod_evhost mod_evhost.c) +add_and_install_library(mod_expire mod_expire.c) +add_and_install_library(mod_extforward mod_extforward.c) +add_and_install_library(mod_fastcgi mod_fastcgi.c) +add_and_install_library(mod_flv_streaming mod_flv_streaming.c) +add_and_install_library(mod_indexfile mod_indexfile.c) +add_and_install_library(mod_magnet "mod_magnet.c;mod_magnet_cache.c") +add_and_install_library(mod_mysql_vhost mod_mysql_vhost.c) +add_and_install_library(mod_proxy mod_proxy.c) +add_and_install_library(mod_redirect mod_redirect.c) +add_and_install_library(mod_rewrite mod_rewrite.c) +add_and_install_library(mod_rrdtool mod_rrdtool.c) +add_and_install_library(mod_scgi mod_scgi.c) +add_and_install_library(mod_secdownload mod_secure_download.c) +add_and_install_library(mod_setenv mod_setenv.c) +add_and_install_library(mod_simple_vhost mod_simple_vhost.c) +add_and_install_library(mod_ssi "mod_ssi_exprparser.c;mod_ssi_expr.c;mod_ssi.c") +add_and_install_library(mod_staticfile mod_staticfile.c) +add_and_install_library(mod_status mod_status.c) +add_and_install_library(mod_trigger_b4_dl mod_trigger_b4_dl.c) +# add_and_install_library(mod_uploadprogress mod_uploadprogress.c) +add_and_install_library(mod_userdir mod_userdir.c) +add_and_install_library(mod_usertrack mod_usertrack.c) +add_and_install_library(mod_webdav mod_webdav.c) + +if(HAVE_PCRE_H) + target_link_libraries(lighttpd ${PCRE_LDFLAGS}) + add_target_properties(lighttpd COMPILE_FLAGS ${PCRE_CFLAGS}) + target_link_libraries(mod_rewrite ${PCRE_LDFLAGS}) + add_target_properties(mod_rewrite COMPILE_FLAGS ${PCRE_CFLAGS}) + target_link_libraries(mod_dirlisting ${PCRE_LDFLAGS}) + add_target_properties(mod_dirlisting COMPILE_FLAGS ${PCRE_CFLAGS}) + target_link_libraries(mod_redirect ${PCRE_LDFLAGS}) + add_target_properties(mod_redirect COMPILE_FLAGS ${PCRE_CFLAGS}) + target_link_libraries(mod_ssi ${PCRE_LDFLAGS}) + add_target_properties(mod_ssi COMPILE_FLAGS ${PCRE_CFLAGS}) + target_link_libraries(mod_trigger_b4_dl ${PCRE_LDFLAGS}) + add_target_properties(mod_trigger_b4_dl COMPILE_FLAGS ${PCRE_CFLAGS}) +endif() + +target_link_libraries(mod_magnet ${LUA_LDFLAGS}) +add_target_properties(mod_magnet COMPILE_FLAGS ${LUA_CFLAGS}) + +target_link_libraries(mod_cml ${LUA_LDFLAGS}) +add_target_properties(mod_cml COMPILE_FLAGS ${LUA_CFLAGS}) + +if(HAVE_MYSQL_H AND HAVE_MYSQL) + target_link_libraries(mod_mysql_vhost mysqlclient) + include_directories(/usr/include/mysql) +endif() + +set(L_MOD_WEBDAV) +if(HAVE_SQLITE3_H) + set(L_MOD_WEBDAV ${L_MOD_WEBDAV} sqlite3) +endif() +if(HAVE_LIBXML_H) + target_link_libraries(mod_webdav ${XML2_LDFLAGS}) +endif() +if(HAVE_UUID_H) + if(NEED_LIBUUID) + set(L_MOD_WEBDAV ${L_MOD_WEBDAV} uuid) + endif() +endif() + +target_link_libraries(mod_webdav ${L_MOD_WEBDAV}) + +set(L_MOD_AUTH) +if(HAVE_LIBCRYPT) + set(L_MOD_AUTH ${L_MOD_AUTH} crypt) +endif() + +if(HAVE_LDAP_H) + set(L_MOD_AUTH ${L_MOD_AUTH} ldap lber) +endif() +target_link_libraries(mod_auth ${L_MOD_AUTH}) + +if(HAVE_ZLIB_H) + if(HAVE_BZLIB_H) + target_link_libraries(mod_compress ${ZLIB_LIBRARY} bz2) + else() + target_link_libraries(mod_compress ${ZLIB_LIBRARY}) + endif() +endif() + +if(HAVE_LIBFAM) + target_link_libraries(lighttpd fam) +endif() + +if(HAVE_GDBM_H) + target_link_libraries(mod_trigger_b4_dl gdbm) +endif() + +if(HAVE_MEMCACHE_H) + target_link_libraries(mod_trigger_b4_dl memcache) +endif() + +if(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -g -Wshadow -W -pedantic ${WARN_FLAGS}") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2") + add_definitions(-D_GNU_SOURCE) +endif() + +add_target_properties(lighttpd LINK_FLAGS "-export-dynamic") + +set_target_properties(lighttpd PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) + +if(WIN32) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVALGRIND") + add_target_properties(lighttpd COMPILE_FLAGS "-DLI_DECLARE_EXPORTS") + target_link_libraries(lighttpd ws2_32) + target_link_libraries(mod_proxy ws2_32) + target_link_libraries(mod_fcgi ws2_32) + target_link_libraries(mod_scgi ws2_32) + target_link_libraries(mod_ssi ws2_32) + + if(MINGW) + target_link_libraries(lighttpd msvcr70) + add_target_properties(lighttpd LINK_FLAGS "-Wl,-subsystem,console") + endif() +endif() + +if(NOT BUILD_STATIC) + if(HAVE_LIBDL) + target_link_libraries(lighttpd dl) + endif() +endif() + +if(HAVE_LIBSSL AND HAVE_LIBCRYPTO) + target_link_libraries(lighttpd ssl) + target_link_libraries(lighttpd crypto) +endif() + +if(WITH_LIBEV) + target_link_libraries(lighttpd ${LIBEV_LDFLAGS}) + add_target_properties(lighttpd COMPILE_FLAGS ${LIBEV_CFLAGS}) +endif() + +if(WITH_LIBUNWIND) + target_link_libraries(lighttpd ${LIBUNWIND_LDFLAGS}) + add_target_properties(lighttpd COMPILE_FLAGS ${LIBUNWIND_CFLAGS}) +endif() + +if(NOT WIN32) +install(TARGETS ${L_INSTALL_TARGETS} RUNTIME DESTINATION ${SBINDIR} LIBRARY DESTINATION ${LIGHTTPD_MODULES_DIR} ARCHIVE DESTINATION ${LIGHTTPD_MODULES_DIR}/static) -ELSE(NOT WIN32) +else() ## HACK to make win32 to install our libraries in desired directory.. -INSTALL(TARGETS lighttpd +install(TARGETS lighttpd RUNTIME DESTINATION ${SBINDIR} ARCHIVE DESTINATION lib/static) -LIST(REMOVE_ITEM L_INSTALL_TARGETS lighttpd) -INSTALL(TARGETS ${L_INSTALL_TARGETS} +list(REMOVE_ITEM L_INSTALL_TARGETS lighttpd) +install(TARGETS ${L_INSTALL_TARGETS} RUNTIME DESTINATION ${SBINDIR}/lib LIBRARY DESTINATION lib ARCHIVE DESTINATION lib/static) -ENDIF(NOT WIN32) +endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f09d3acb..699df828 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -SET(T_FILES +set(T_FILES prepare.sh cachable.t core-404-handler.t @@ -28,9 +28,9 @@ SET(T_FILES cleanup.sh ) -FOREACH(it ${T_FILES}) - ADD_TEST(NAME ${it} COMMAND "${lighttpd_SOURCE_DIR}/tests/wrapper.sh" +foreach(it ${T_FILES}) + add_test(NAME ${it} COMMAND "${lighttpd_SOURCE_DIR}/tests/wrapper.sh" "${lighttpd_SOURCE_DIR}/tests" "${lighttpd_BINARY_DIR}" "${lighttpd_SOURCE_DIR}/tests/${it}") -ENDFOREACH(it) +endforeach() |