aboutsummaryrefslogtreecommitdiffstats
path: root/ConfigureChecks.cmake
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-07-26 17:22:36 +0100
committerJoão Valverde <j@v6e.pt>2021-09-17 00:43:54 +0100
commit8df2a73594fbcc812f4ea22a72ab7a79bfb63dc3 (patch)
tree7d30bc5be8e85c52c0dd295cb15cd717d5770dcb /ConfigureChecks.cmake
parent7462e76884942258bae110ead925f25ffa54e2a8 (diff)
Use the musl in-tree getopt_long() everywhere
Besides the obvious limitation of being unavailable on Windows, the standard is vague about getopt() and getopt_long() has many non-portable pitfalls and buggy implementations, that increase the maintainance cost a lot. Also the GNU libc code currently in the tree is not suited for embedding and is unmaintainable. Own maintainership for getopt_long() and use the musl implementation everywhere. This way we don't need to worry if optreset is available, or if the $OPERATING_SYSTEM version behaves in subtly different ways. The API is under the Wireshark namespace to avoid conflicts with system headers. Side-note, the Mingw-w64 9.0 getopt_long() implementation is buggy with opterr and known to crash. In my experience it's a headache to use the embedded getopt implementation if the system provides one.
Diffstat (limited to 'ConfigureChecks.cmake')
-rw-r--r--ConfigureChecks.cmake23
1 files changed, 0 insertions, 23 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index a118c77859..58f3e5f6dd 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -93,29 +93,6 @@ if (NOT WIN32)
check_function_exists("clock_gettime" HAVE_CLOCK_GETTIME)
endif (NOT WIN32)
-check_function_exists("getopt_long" HAVE_GETOPT_LONG)
-if(HAVE_GETOPT_LONG)
- check_include_file("getopt.h" HAVE_GETOPT_H)
- #
- # The OS has getopt_long(), so it might have optreset.
- # Do we have it?
- #
- if(HAVE_GETOPT_H)
- check_symbol_exists("optreset" "getopt.h" HAVE_OPTRESET)
- else()
- check_symbol_exists("optreset" HAVE_OPTRESET)
- endif()
-else()
- #
- # The OS doesn't have getopt_long(), so we're using the GNU libc
- # version that we have in wsutil. It doesn't have optreset, so we
- # don't need to check for it.
- #
- # However, it uses alloca(), so we may need to include alloca.h;
- # check for it.
- #
- check_include_file("alloca.h" HAVE_ALLOCA_H)
-endif()
check_function_exists("getifaddrs" HAVE_GETIFADDRS)
check_function_exists("issetugid" HAVE_ISSETUGID)
check_function_exists("setresgid" HAVE_SETRESGID)