all: prefer using utimensat()
This commit is contained in:
+28
-1
@@ -169,6 +169,28 @@ endif()
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckStructHasMember)
|
||||
include(CheckSymbolExists)
|
||||
|
||||
if(NOT DEFINED HAVE_UNISTD_H)
|
||||
check_include_file("unistd.h" HAVE_UNISTD_H)
|
||||
endif()
|
||||
if(NOT DEFINED HAVE_UTIMENSAT)
|
||||
check_function_exists(utimensat HAVE_UTIMENSAT_FUNCTION__)
|
||||
if(HAVE_UTIMENSAT_FUNCTION__)
|
||||
check_symbol_exists(utimensat "sys/types.h;fcntl.h;sys/stat.h" HAVE_UTIMENSAT_SYMBOL__)
|
||||
if(HAVE_UTIMENSAT_SYMBOL__)
|
||||
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec "sys/types.h;fcntl.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
|
||||
if (NOT HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
|
||||
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec "sys/types.h;fcntl.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC)
|
||||
endif()
|
||||
if (HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC OR HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC)
|
||||
set(HAVE_UTIMENSAT 1)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UPX_CONFIG_DISABLE_WSTRICT)
|
||||
# enable all basic warnings
|
||||
@@ -382,7 +404,6 @@ set(t upx_vendor_zlib)
|
||||
upx_compile_target_debug_with_O2(${t})
|
||||
upx_sanitize_target(${t})
|
||||
target_compile_definitions(${t} PRIVATE HAVE_VSNPRINTF=1)
|
||||
check_include_file("unistd.h" HAVE_UNISTD_H)
|
||||
if(HAVE_UNISTD_H)
|
||||
target_compile_definitions(${t} PRIVATE HAVE_UNISTD_H=1)
|
||||
endif()
|
||||
@@ -429,6 +450,12 @@ endif()
|
||||
if(NOT UPX_CONFIG_DISABLE_ZSTD)
|
||||
target_compile_definitions(${t} PRIVATE WITH_ZSTD=1)
|
||||
endif()
|
||||
if(HAVE_UTIMENSAT)
|
||||
target_compile_definitions(${t} PRIVATE USE_UTIMENSAT=1)
|
||||
if (HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC)
|
||||
target_compile_definitions(${t} PRIVATE HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC=1)
|
||||
endif()
|
||||
endif()
|
||||
#upx_compile_target_debug_with_O2(${t})
|
||||
upx_sanitize_target(${t})
|
||||
if(MSVC_FRONTEND)
|
||||
|
||||
Reference in New Issue
Block a user