From 949dc5e05d3004ebb5c7adbdc0a5cf3942ba8c4c Mon Sep 17 00:00:00 2001
From: MikeG <michael.gevaert@epfl.ch>
Date: Thu, 25 Apr 2024 11:21:20 +0200
Subject: [PATCH] Remove checks that were making defines that weren't used.
 (#51)

* For instance `HAVE_FCNTL_H` is never checked for in the code
* This speeds up cmake configuration on my machine by ~25% to ~30%

  Before:
    1.76user 0.61system 0:02.35elapsed 100%CPU (0avgtext+0avgdata 22996maxresident)k
  After:
    1.14user 0.34system 0:01.45elapsed 102%CPU (0avgtext+0avgdata 23056maxresident)k
---
 CMakeLists.txt | 19 ----------------
 config.h.in    | 60 --------------------------------------------------
 2 files changed, 79 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 34498e4..e513ddb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -110,37 +110,18 @@ endif()
 # =============================================================================
 set(CMAKE_REQUIRED_QUIET TRUE)
 message(STATUS "Checking for include files")
-check_include_files(fcntl.h HAVE_FCNTL_H)
-check_include_files(malloc.h HAVE_MALLOC_H)
-check_include_files(memory.h HAVE_MEMORY_H)
 check_include_files(osfcn.h HAVE_OSFCN_H)
-check_include_files(socket.h HAVE_SOCKET_H)
-check_include_files(stdint.h HAVE_STDINT_H)
 check_include_files(stdlib.h HAVE_STDLIB_H)
 check_include_files(string.h HAVE_STRING_H)
 check_include_files(strings.h HAVE_STRINGS_H)
 check_include_files(stropts.h HAVE_STROPTS_H)
-check_include_files(stream.h HAVE_STREAM_H)
 check_include_files(sys/conf.h HAVE_SYS_CONF_H)
-check_include_files(sys/file.h HAVE_SYS_FILE_H)
-check_include_files(sys/ioctl.h HAVE_SYS_IOCTL_H)
 check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
-check_include_files(sys/param.h HAVE_SYS_PARAM_H)
 check_include_files(sys/stat.h HAVE_SYS_STAT_H)
-check_include_files(sys/time.h HAVE_SYS_TIME_H)
 check_include_files(unistd.h HAVE_UNISTD_H)
 
 message(STATUS "Checking for functions")
-check_function_exists(getcwd HAVE_GETCWD)
-check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
-check_function_exists(mmap HAVE_MMAP)
 check_function_exists(sigprocmask HAVE_POSIX_SIGNALS)
-check_function_exists(socket HAVE_SOCKET)
-check_function_exists(strcspn HAVE_STRCSPN)
-check_function_exists(strerror HAVE_STRERROR)
-check_function_exists(strtod HAVE_STRTOD)
-check_function_exists(strtol HAVE_STRTOL)
-check_function_exists(uname HAVE_UNAME)
 
 message(STATUS "Checking for include directories")
 iv_check_dir_exists(dirent.h HAVE_DIRENT_H)
diff --git a/config.h.in b/config.h.in
index 2da9e25..4e8944a 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,6 +1,3 @@
-/* config.h.in.  Generated from configure.in by autoheader.  */
-
-
 #ifndef H_config_included
 #define H_config_included 1
 
@@ -15,24 +12,6 @@
    */
 #cmakedefine HAVE_DIRENT_H 1
 
-/* Define to 1 if you have the <fcntl.h> header file. */
-#cmakedefine HAVE_FCNTL_H 1
-
-/* Define to 1 if you have the `getcwd' function. */
-#cmakedefine HAVE_GETCWD 1
-
-/* Define to 1 if you have the `gettimeofday' function. */
-#cmakedefine HAVE_GETTIMEOFDAY 1
-
-/* Define to 1 if you have the <malloc.h> header file. */
-#cmakedefine HAVE_MALLOC_H 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#cmakedefine HAVE_MEMORY_H 1
-
-/* Define to 1 if you have a working `mmap' system call. */
-#cmakedefine HAVE_MMAP 1
-
 /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
 #cmakedefine HAVE_NDIR_H 1
 
@@ -42,27 +21,9 @@
 /* use sigprocmask */
 #cmakedefine HAVE_POSIX_SIGNALS 1
 
-/* Define to 1 if you have the <socket.h> header file. */
-#cmakedefine HAVE_SOCKET_H 1
-
-/* Define to 1 if you have the `socket' function. */
-#cmakedefine HAVE_SOCKET 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#cmakedefine HAVE_STDINT_H 1
-
 /* Define to 1 if you have the <stdlib.h> header file. */
 #cmakedefine HAVE_STDLIB_H 1
 
-/* Define to 1 if you have the `strcspn' function. */
-#cmakedefine HAVE_STRCSPN 1
-
-/* Define to 1 if you have the <stream.h> header file. */
-#cmakedefine HAVE_STREAM_H 1
-
-/* Define to 1 if you have the `strerror' function. */
-#cmakedefine HAVE_STRERROR 1
-
 /* Define to 1 if you have the <strings.h> header file. */
 #cmakedefine HAVE_STRINGS_H 1
 
@@ -72,12 +33,6 @@
 /* Define to 1 if you have the <stropts.h> header file. */
 #cmakedefine HAVE_STROPTS_H 1
 
-/* Define to 1 if you have the `strtod' function. */
-#cmakedefine HAVE_STRTOD 1
-
-/* Define to 1 if you have the `strtol' function. */
-#cmakedefine HAVE_STRTOL 1
-
 /* Define to 1 if you have the <sys/conf.h> header file. */
 #cmakedefine HAVE_SYS_CONF_H 1
 
@@ -85,12 +40,6 @@
    */
 #cmakedefine HAVE_SYS_DIR_H 1
 
-/* Define to 1 if you have the <sys/file.h> header file. */
-#cmakedefine HAVE_SYS_FILE_H 1
-
-/* Define to 1 if you have the <sys/ioctl.h> header file. */
-#cmakedefine HAVE_SYS_IOCTL_H 1
-
 /* Define to 1 if you have the <sys/mman.h> header file. */
 #cmakedefine HAVE_SYS_MMAN_H 1
 
@@ -98,24 +47,15 @@
    */
 #cmakedefine HAVE_SYS_NDIR_H 1
 
-/* Define to 1 if you have the <sys/param.h> header file. */
-#cmakedefine HAVE_SYS_PARAM_H 1
-
 /* Define to 1 if you have the <sys/select.h> header file. */
 #cmakedefine HAVE_SYS_SELECT_H 1
 
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #cmakedefine HAVE_SYS_STAT_H 1
 
-/* Define to 1 if you have the <sys/time.h> header file. */
-#cmakedefine HAVE_SYS_TIME_H 1
-
 /* Define to 1 if you have the <sys/types.h> header file. */
 #cmakedefine HAVE_SYS_TYPES_H 1
 
-/* Define to 1 if you have the `uname' function. */
-#cmakedefine HAVE_UNAME 1
-
 /* Define to 1 if you have the <unistd.h> header file. */
 #cmakedefine HAVE_UNISTD_H 1