]> git.armaanb.net Git - opendoas.git/blobdiff - configure
Add closefrom(2) from openssh-portable
[opendoas.git] / configure
index c5a4c397450539fe98c041b2db37f12434ea2f0e..44879d42e612e9f8d95fa9d612ec452200fb2c51 100755 (executable)
--- a/configure
+++ b/configure
@@ -350,6 +350,115 @@ check_func "pledge" "$src" || {
        printf 'OPENBSD  +=     pledge-noop.o\n' >>$CONFIG_MK
 }
 
+#
+# Check for closefrom().
+#
+src='
+#include <unistd.h>
+int main(void) {
+       closefrom(0);
+       return 0;
+}'
+check_func "closefrom" "$src" || {
+       printf 'OPENBSD  +=     closefrom.o\n' >>$CONFIG_MK
+}
+
+#
+# Check for sysconf().
+#
+src='
+#include <unistd.h>
+int main(void) {
+       (void)sysconf(0);
+       return 0;
+}'
+check_func "sysconf" "$src"
+
+#
+# Check for /proc/$PID.
+#
+printf 'Checking for %-14s\t\t' "/proc/\$PID ..." >&2
+if test -d /proc/$$; then
+       printf 'yes.\n' >&2
+       printf 'CFLAGS   +=     -DHAVE_%s\n' "PROC_PID" >>$CONFIG_MK
+else
+       printf 'no.\n' >&2
+fi
+
+#
+# Check for dirfd().
+#
+src='
+#include <dirent.h>
+int main(void) {
+       (void)dirfd(0);
+       return 0;
+}'
+check_func "dirfd" "$src"
+
+#
+# Check for fcntl.h.
+#
+src='
+#include <fcntl.h>
+int main(void) {
+       return 0;
+}'
+check_func "fcntl_h" "$src"
+
+#
+# Check for F_CLOSEM.
+#
+src='
+#include <fcntl.h>
+#ifndef F_CLOSEM
+#error no F_CLOSEM
+#endif
+int main(void) {
+       return 0;
+}'
+check_func "F_CLOSEM" "$src"
+
+#
+# Check for dirent.h.
+#
+src='
+#include <dirent.h>
+int main(void) {
+       return 0;
+}'
+check_func "dirent_h" "$src"
+
+#
+# Check for sys/ndir.h.
+#
+src='
+#include <sys/ndir.h>
+int main(void) {
+       return 0;
+}'
+check_func "sys_ndir_h" "$src"
+
+#
+# Check for sys/dir.h.
+#
+src='
+#include <sys/dir.h>
+int main(void) {
+       return 0;
+}'
+check_func "sys_dir_h" "$src"
+
+#
+# Check for ndir.h.
+#
+src='
+#include <ndir.h>
+int main(void) {
+       return 0;
+}'
+check_func "ndir_h" "$src"
+
 #
 #
 #