Browse Source

[build] cmake,meson socket libs for win32, Illumos (fixes #3130)

(thx devnexen)

cmake, meson: specify socket libs for win32, Illumos

x-ref:
  "Solaris build fix proposal"
  https://redmine.lighttpd.net/issues/3130
master
Glenn Strauss 5 months ago
parent
commit
b9d58fa723
  1. 16
      src/CMakeLists.txt
  2. 27
      src/meson.build
  3. 10
      tests/CMakeLists.txt
  4. 15
      tests/meson.build

16
src/CMakeLists.txt

@ -93,7 +93,9 @@ set(CMAKE_REQUIRED_FLAGS)
check_include_files(sys/filio.h HAVE_SYS_FILIO_H)
check_include_files(sys/inotify.h HAVE_SYS_INOTIFY_H)
check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
set(CMAKE_REQUIRED_FLAGS "-include sys/time.h")
check_include_files(sys/loadavg.h HAVE_SYS_LOADAVG_H)
set(CMAKE_REQUIRED_FLAGS)
check_include_files(sys/poll.h HAVE_SYS_POLL_H)
check_include_files(sys/prctl.h HAVE_SYS_PRCTL_H)
check_include_files(sys/procctl.h HAVE_SYS_PROCCTL_H)
@ -1061,7 +1063,6 @@ set_target_properties(lighttpd PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_P
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)
@ -1139,6 +1140,19 @@ if(WITH_LIBUNWIND)
add_target_properties(test_mod COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
endif()
if(WIN32)
set(SOCKLIBS ws2_32)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
set(SOCKLIBS socket nsl)
endif()
if(SOCKLIBS)
target_link_libraries(lighttpd ${SOCKLIBS})
target_link_libraries(test_common ${SOCKLIBS})
target_link_libraries(test_configfile ${SOCKLIBS})
target_link_libraries(test_mod ${SOCKLIBS})
endif()
if(NOT WIN32)
install(TARGETS ${L_INSTALL_TARGETS}
RUNTIME DESTINATION ${SBINDIR}

27
src/meson.build

@ -1,3 +1,4 @@
compiler = meson.get_compiler('c')
sbinddir = join_paths(get_option('prefix'), get_option('sbindir'))
moduledir = join_paths(get_option('prefix'), get_option('moduledir'))
@ -15,16 +16,20 @@ defs = [
'-D_GNU_SOURCE',
]
libws2_32 = []
socket_libs = []
if target_machine.system() == 'windows'
libws2_32 = [ compiler.find_library('ws2_32') ]
socket_libs = [ compiler.find_library('ws2_32') ]
defs += [
'-DNVALGRIND',
]
endif
if target_machine.system() == 'sunos'
socket_libs = [ compiler.find_library('socket')
, compiler.find_library('nsl')
]
endif
compiler = meson.get_compiler('c')
conf_data = configuration_data()
conf_data.set('HAVE_SYS_DEVPOLL_H', compiler.has_header('sys/devpoll.h'))
@ -837,7 +842,7 @@ executable('lighttpd', configparser,
, libpcre
, libunwind
, libxxhash
, libws2_32
, socket_libs
, clock_lib
],
install: true,
@ -863,7 +868,7 @@ test('test_common', executable('test_common',
dependencies: [ common_flags
, libpcre
, libunwind
, libws2_32
, socket_libs
, clock_lib
],
build_by_default: false,
@ -886,7 +891,7 @@ test('test_configfile', executable('test_configfile',
dependencies: [ common_flags
, libpcre
, libunwind
, libws2_32
, socket_libs
, clock_lib
],
build_by_default: false,
@ -915,7 +920,7 @@ test('test_mod', executable('test_mod',
, libpcre
, libunwind
, libxxhash
, libws2_32
, socket_libs
, clock_lib
],
build_by_default: false,
@ -934,18 +939,18 @@ modules = [
[ 'mod_evhost', [ 'mod_evhost.c' ] ],
[ 'mod_expire', [ 'mod_expire.c' ] ],
[ 'mod_extforward', [ 'mod_extforward.c' ] ],
[ 'mod_fastcgi', [ 'mod_fastcgi.c' ], libws2_32 ],
[ 'mod_fastcgi', [ 'mod_fastcgi.c' ], socket_libs ],
[ 'mod_indexfile', [ 'mod_indexfile.c' ] ],
[ 'mod_proxy', [ 'mod_proxy.c' ], libws2_32 ],
[ 'mod_proxy', [ 'mod_proxy.c' ], socket_libs ],
[ 'mod_redirect', [ 'mod_redirect.c' ] ],
[ 'mod_rewrite', [ 'mod_rewrite.c' ] ],
[ 'mod_rrdtool', [ 'mod_rrdtool.c' ] ],
[ 'mod_scgi', [ 'mod_scgi.c' ], libws2_32 ],
[ 'mod_scgi', [ 'mod_scgi.c' ], socket_libs ],
[ 'mod_secdownload', [ 'mod_secdownload.c', 'algo_hmac.c' ], libcrypto ],
[ 'mod_setenv', [ 'mod_setenv.c' ] ],
[ 'mod_simple_vhost', [ 'mod_simple_vhost.c' ] ],
[ 'mod_sockproxy', [ 'mod_sockproxy.c' ] ],
[ 'mod_ssi', [ 'mod_ssi.c' ], libws2_32 ],
[ 'mod_ssi', [ 'mod_ssi.c' ], socket_libs ],
[ 'mod_staticfile', [ 'mod_staticfile.c' ] ],
[ 'mod_status', [ 'mod_status.c' ] ],
[ 'mod_uploadprogress', [ 'mod_uploadprogress.c' ] ],

10
tests/CMakeLists.txt

@ -1,5 +1,15 @@
add_executable(fcgi-responder fcgi-responder.c)
add_executable(scgi-responder scgi-responder.c)
if(WIN32)
set(SOCKLIBS ws2_32)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
set(SOCKLIBS socket nsl)
endif()
if(SOCKLIBS)
target_link_libraries(fcgi-responder ${SOCKLIBS})
target_link_libraries(scgi-responder ${SOCKLIBS})
endif()
set(T_FILES
prepare.sh

15
tests/meson.build

@ -1,11 +1,22 @@
compiler = meson.get_compiler('c')
socket_libs = []
if target_machine.system() == 'windows'
socket_libs = [ compiler.find_library('ws2_32') ]
endif
if target_machine.system() == 'sunos'
socket_libs = [ compiler.find_library('socket')
, compiler.find_library('nsl')
]
endif
executable('fcgi-responder',
sources: 'fcgi-responder.c',
dependencies: common_flags,
dependencies: [ common_flags, socket_libs ]
)
executable('scgi-responder',
sources: 'scgi-responder.c',
dependencies: common_flags,
dependencies: [ common_flags, socket_libs ]
)
env = environment()

Loading…
Cancel
Save