diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dc5bbab..71ef31a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -481,6 +481,11 @@ if (HAVE_STRPTIME) check_c_source_runs("${STRPTIME_TEST_SOURCE}" STRPTIME_WORKS) endif () +try_compile(HAVE___FUNC__ + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests/test___func__.c +) + # TCP Fast Open. if (NOT ENABLE_TCP_FAST_OPEN) message(WARNING "TCP Fast Open disabled.") diff --git a/cmake/include/cmakeconfig.h.in b/cmake/include/cmakeconfig.h.in index 0a3ee804..d3635633 100644 --- a/cmake/include/cmakeconfig.h.in +++ b/cmake/include/cmakeconfig.h.in @@ -213,6 +213,8 @@ #cmakedefine HAVE_TARGET_ENDIANNESS #cmakedefine TARGET_IS_BIG_ENDIAN +#cmakedefine HAVE___FUNC__ 1 + #ifdef HAVE___FUNC__ #define __FUNC__ __func__ #else diff --git a/cmake/tests/test___func__.c b/cmake/tests/test___func__.c new file mode 100644 index 00000000..6613c98b --- /dev/null +++ b/cmake/tests/test___func__.c @@ -0,0 +1,4 @@ +int main (int ac, char *av[]) +{ + char *s = __func__; +}