diff --git a/setter/src/unix/darwin/CMakeLists.txt b/setter/src/unix/darwin/CMakeLists.txt index d8836a4..3124620 100644 --- a/setter/src/unix/darwin/CMakeLists.txt +++ b/setter/src/unix/darwin/CMakeLists.txt @@ -26,8 +26,15 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") return() endif() +include(CheckSymbolExists) find_library(CARBON_LIBRARY NAMES Carbon) +CHECK_SYMBOL_EXISTS(dlsym dlfcn.h HAVE_DLSYM) + +if(HAVE_DLSYM) + add_sub_definitions(HAVE_DLSYM) +endif() + add_sources(os.c darwin.h volume.c volume.h attr.c attr.h rsrcfork.c rsrcfork.h sparse.c xattr.c xattr.h) if(CARBON_LIBRARY) diff --git a/setter/src/unix/darwin/xattr.c b/setter/src/unix/darwin/xattr.c index 1a1b85f..582fb87 100644 --- a/setter/src/unix/darwin/xattr.c +++ b/setter/src/unix/darwin/xattr.c @@ -22,7 +22,11 @@ Aaru Data Preservation Suite Copyright (C) 2011-2021 Natalia Portillo *****************************************************************************/ +// TODO: old dyld interface +#if HAVE_DLSYM #include +#endif // HAVE_DLSYM + #include #include #include @@ -33,13 +37,15 @@ Copyright (C) 2011-2021 Natalia Portillo void DarwinExtendedAttributes(const char* path) { +// TODO: old dyld interface +#if HAVE_DLSYM int ret; FILE* file; int rc; int cRc; _darwin_setxattr darwin_setxattr; - darwin_setxattr = (_darwin_setxattr)dlsym(RTLD_DEFAULT, "setxattr"); + darwin_setxattr = (_darwin_setxattr)dlsym(RTLD_DEFAULT, "setxattr"); if(!darwin_setxattr) { @@ -100,4 +106,8 @@ void DarwinExtendedAttributes(const char* path) if(ret) cRc = errno; } log_write("\tFile with an extended attribute called \"com.ibm.os2.icon\", rc = %d, cRc = %d\n", rc, cRc); +#else // HAVE_DLSYM + printf("This version is not compiled to try extended attributes. This version MUST NOT be used in Mac OS X 10.4 " + "(Darwin 8.0) or higher\n"); +#endif // HAVE_DLSYM }