Build: add FreeBSD & libc++ compilation support (#288)

* build: add FreeBSD compilation support

* build: unbreak compilation with clang libc++

unary_function is obsolete with C++11 and removed in C++17.
gnu-gcc-libstdc++ still has the class, but llvm-clang-libc++ does
not, and there is a compile error.

vmime should have just stopped using unary_function with commit
v0.9.2-48-g8564b2f8.

	$ cat x.cpp
	$ clang++ -std=c++17 -stdlib=libc++ -c x.cpp
	In file included from x.cpp:1:
	In file included from /usr/local/include/vmime/net/transport.hpp:34:
	In file included from /usr/local/include/vmime/net/service.hpp:36:
	In file included from /usr/local/include/vmime/net/session.hpp:40:
	In file included from /usr/local/include/vmime/utility/url.hpp:30:
	/usr/local/include/vmime/propertySet.hpp:339:33: error: no template named
	/'unary_function' in namespace 'std'; did you mean '__unary_function'?
		class propFinder : public std::unary_function <shared_ptr <property>, bool> {
					  ~~~~~^~~~~~~~~~~~~~
					       __unary_function
This commit is contained in:
Jan Engelhardt 2023-12-31 15:22:36 +01:00 committed by GitHub
parent 6e11c9c9f8
commit 82377e0342
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 1 deletions

View File

@ -845,6 +845,7 @@ CHECK_FUNCTION_EXISTS(gettid VMIME_HAVE_GETTID)
CHECK_FUNCTION_EXISTS(syscall VMIME_HAVE_SYSCALL)
CHECK_SYMBOL_EXISTS(SYS_gettid sys/syscall.h VMIME_HAVE_SYSCALL_GETTID)
CHECK_SYMBOL_EXISTS(getthrid unistd.h VMIME_HAVE_GETTHRID)
CHECK_SYMBOL_EXISTS(thr_self sys/thr.h VMIME_HAVE_THR_SELF)
CHECK_SYMBOL_EXISTS(_lwp_self sys/lwp.h VMIME_HAVE_LWP_SELF)
CHECK_SYMBOL_EXISTS(SO_KEEPALIVE sys/socket.h VMIME_HAVE_SO_KEEPALIVE)

View File

@ -77,6 +77,7 @@ typedef unsigned @VMIME_64BIT_TYPE@ vmime_uint64;
#cmakedefine01 VMIME_HAVE_SYSCALL
#cmakedefine01 VMIME_HAVE_SYSCALL_GETTID
#cmakedefine01 VMIME_HAVE_GETTHRID
#cmakedefine01 VMIME_HAVE_THR_SELF
#cmakedefine01 VMIME_HAVE_LWP_SELF
#cmakedefine01 VMIME_HAVE_GMTIME_S
#cmakedefine01 VMIME_HAVE_GMTIME_R

View File

@ -48,6 +48,9 @@
#if VMIME_HAVE_SYSCALL
# include <sys/syscall.h>
#endif
#if VMIME_HAVE_THR_SELF
# include <sys/thr.h>
#endif
#if VMIME_HAVE_LWP_SELF
# include <sys/lwp.h>
#endif
@ -230,6 +233,10 @@ unsigned int posixHandler::getThreadId() const {
return static_cast <unsigned int>(::syscall(SYS_gettid));
#elif VMIME_HAVE_GETTHRID // OpenBSD
return static_cast <unsigned int>(::getthrid());
#elif VMIME_HAVE_THR_SELF // FreeBSD
long id = 0;
::thr_self(&id);
return static_cast <unsigned int>(id);
#elif VMIME_HAVE_LWP_SELF // Solaris
return static_cast <unsigned int>(::_lwp_self());
#else

View File

@ -336,7 +336,7 @@ private:
void parse(const string& props);
class propFinder : public std::unary_function <shared_ptr <property>, bool> {
class propFinder {
public: