Explicitly test for libproc.h (#1916)

This change adds support for ancient macOS lacking libproc. It also
eliminates a bug where exiv2 could not be built on case-sensitive
file systems (the header file is properly TargetConditionals.h).
main
Evan Miller 4 years ago committed by GitHub
parent 66b40d8823
commit 04f4624718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -41,6 +41,9 @@
// Define if you have the munmap function. // Define if you have the munmap function.
#cmakedefine EXV_HAVE_MUNMAP #cmakedefine EXV_HAVE_MUNMAP
/* Define if you have the <libproc.h> header file. */
#cmakedefine EXV_HAVE_LIBPROC_H
/* Define if you have the <unistd.h> header file. */ /* Define if you have the <unistd.h> header file. */
#cmakedefine EXV_HAVE_UNISTD_H #cmakedefine EXV_HAVE_UNISTD_H

@ -36,6 +36,7 @@ int main() {
return 0; return 0;
}" EXV_STRERROR_R_CHAR_P ) }" EXV_STRERROR_R_CHAR_P )
check_include_file_cxx( "libproc.h" EXV_HAVE_LIBPROC_H )
check_include_file_cxx( "unistd.h" EXV_HAVE_UNISTD_H ) check_include_file_cxx( "unistd.h" EXV_HAVE_UNISTD_H )
check_include_file_cxx( "sys/mman.h" EXV_HAVE_SYS_MMAN_H ) check_include_file_cxx( "sys/mman.h" EXV_HAVE_SYS_MMAN_H )

@ -48,8 +48,7 @@
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#elif defined(__APPLE__) #elif defined(__APPLE__)
#include <Targetconditionals.h> #if defined(EXV_HAVE_LIBPROC_H)
#ifndef TARGET_OS_IPHONE
#include <libproc.h> #include <libproc.h>
#endif #endif
#endif #endif
@ -458,7 +457,7 @@ namespace Exiv2 {
CloseHandle(processHandle); CloseHandle(processHandle);
} }
#elif defined(__APPLE__) #elif defined(__APPLE__)
#ifndef TARGET_OS_IPHONE #ifdef EXV_HAVE_LIBPROC_H
const int pid = getpid(); const int pid = getpid();
char pathbuf[PROC_PIDPATHINFO_MAXSIZE]; char pathbuf[PROC_PIDPATHINFO_MAXSIZE];
if (proc_pidpath (pid, pathbuf, sizeof(pathbuf)) > 0) { if (proc_pidpath (pid, pathbuf, sizeof(pathbuf)) > 0) {

Loading…
Cancel
Save