|
1 | 1 | option(ZLIB_CRC32VX "Enable building S390-CRC32VX implementation" ON)
|
| 2 | +option(ZLIB_DFLTCC "Enable building S390-DFLTCC deflate/inflate accelerator implementation" OFF) |
2 | 3 |
|
3 | 4 | set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
|
4 | 5 |
|
@@ -62,7 +63,47 @@ if(ZLIB_CRC32VX AND HAS_S390X_SUPPORT)
|
62 | 63 | set_source_files_properties(
|
63 | 64 | crc32-vx.c
|
64 | 65 | PROPERTIES COMPILE_OPTIONS "${VGFMAFLAG}")
|
65 |
| - target_compile_definitions( |
66 |
| - zlib_crc32_vx PUBLIC HAVE_S390X_VX=1) |
| 66 | + target_compile_definitions(zlib_crc32_vx PUBLIC HAVE_S390X_VX=1) |
| 67 | + target_compile_definitions(zlib_s390x_functable PUBLIC HAVE_S390X_VX=1) |
67 | 68 | endif(HAS_S390X_VX_SUPPORT OR HAS_Z13_S390X_VX_SUPPORT)
|
68 | 69 | endif(ZLIB_CRC32VX AND HAS_S390X_SUPPORT)
|
| 70 | + |
| 71 | +# |
| 72 | +# Check for IBM S390X - DFLTCC extensions |
| 73 | +# |
| 74 | +if(ZLIB_DFLTCC AND HAS_S390X_SUPPORT) |
| 75 | + # check if we have static_assert |
| 76 | + check_c_source_compiles(" |
| 77 | + #include <assert.h> |
| 78 | + static_assert(1==1,\"true\"); |
| 79 | + " HAS_STATIC_ASSERT) |
| 80 | + |
| 81 | + # check if we have secure_getenv |
| 82 | + set(CMAKE_REQUIRED_FLAGS -D_GNU_SOURCE=1) |
| 83 | + check_c_source_compiles(" |
| 84 | + #include <stdlib.h> |
| 85 | + int main() { char* _foo = secure_getenv(\"PWD\");return 0; } |
| 86 | + " HAS_SECURE_GETENV) |
| 87 | + unset(CMAKE_REQUIRED_FLAGS) |
| 88 | + |
| 89 | + # check for specific headers |
| 90 | + check_include_file(sys/sdt.h HAS_SYS_SDT_H) |
| 91 | + |
| 92 | + # prepare compiling for s390x |
| 93 | + add_library(zlib_dfltcc OBJECT |
| 94 | + dfltcc.c |
| 95 | + ../functable/hooks.h) |
| 96 | + target_link_libraries(zlib_dfltcc PUBLIC $<TARGET_OBJECTS:zlib_s390x_functable>) |
| 97 | + target_compile_definitions(zlib_dfltcc PUBLIC HAVE_S390X_DFLTCC=1) |
| 98 | + target_compile_definitions(zlib_s390x_functable PUBLIC HAVE_S390X_DFLTCC=1) |
| 99 | + if(HAS_STATIC_ASSERT) |
| 100 | + target_compile_definitions(zlib_dfltcc PRIVATE HAVE_STATIC_ASSERT=1) |
| 101 | + endif() |
| 102 | + if(HAS_SECURE_GETENV) |
| 103 | + target_compile_definitions(zlib_dfltcc PRIVATE |
| 104 | + HAVE_SECURE_GETENV=1 _GNU_SOURCE=1) |
| 105 | + endif() |
| 106 | + if(HAS_SYS_SDT_H) |
| 107 | + target_compile_definitions(zlib_dfltcc PRIVATE HAVE_SYS_SDT_H=1) |
| 108 | + endif() |
| 109 | +endif(ZLIB_DFLTCC AND HAS_S390X_SUPPORT) |
0 commit comments