Include sys/select.h if needed.
authorWerner Koch <wk@gnupg.org>
Fri, 27 Jan 2012 18:55:22 +0000 (19:55 +0100)
committerWerner Koch <wk@gnupg.org>
Fri, 27 Jan 2012 18:55:22 +0000 (19:55 +0100)
* src/npth.h: Rename to npth.h.in.  Include sys/select.h if
available. Add usual read-only comments.
* configure.ac: Create npth.h.
(INSERT_SYS_SELECT_N): New
(emacs_local_vars_read_only): New vars to support read-only switching.

configure.ac
src/npth.h.in [moved from src/npth.h with 98% similarity]

index 6314476..910548b 100644 (file)
@@ -67,7 +67,7 @@ BUILD_REVISION=m4_if(git_revision,[],[svn_revision],[git_brevis])
 PACKAGE=$PACKAGE_NAME
 VERSION=$PACKAGE_VERSION
 
-AC_CONFIG_SRCDIR([src/npth.h])
+AC_CONFIG_SRCDIR([src/npth.c])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
@@ -178,7 +178,14 @@ AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
 #
 # Checks for header files.
 #
-AC_CHECK_HEADERS([sys/socket.h])
+# fixme: For what do we need the sys/socket test?
+AC_CHECK_HEADERS([sys/socket.h sys/select.h])
+INSERT_SYS_SELECT_H=
+if test x"$ac_cv_header_sys_select_h" = xyes; then
+  INSERT_SYS_SELECT_H="include <sys/select.h>"
+fi
+AC_SUBST(INSERT_SYS_SELECT_H)
+
 
 #
 # Checks for typedefs, structures, and compiler characteristics.
@@ -232,6 +239,14 @@ fi
 
 
 #
+# Substitutions to set generated files in a Emacs buffer to read-only.
+#
+AC_SUBST(emacs_local_vars_begin, ['Local Variables:'])
+AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t'])
+AC_SUBST(emacs_local_vars_end, ['End:'])
+
+
+#
 # Substitution used for npth-config
 #
 NPTH_CONFIG_LIBS="$config_libs"
@@ -269,7 +284,11 @@ fi
 #
 # Write output
 #
-AC_CONFIG_FILES([Makefile src/Makefile w32/Makefile tests/Makefile])
+AC_CONFIG_FILES([Makefile
+src/npth.h
+src/Makefile
+w32/Makefile
+tests/Makefile])
 AC_CONFIG_FILES(src/npth-config, chmod +x src/npth-config)
 AC_CONFIG_FILES(w32/npth-config, chmod +x w32/npth-config)
 AC_OUTPUT
similarity index 98%
rename from src/npth.h
rename to src/npth.h.in
index 1519c88..9fdaa55 100644 (file)
@@ -1,5 +1,5 @@
 /* npth.h - a lightweight implementation of pth over pthread.
-   Copyright (C) 2011 g10 Code GmbH
+   Copyright (C) 2011, 2012 g10 Code GmbH
 
    This file is part of NPTH.
 
@@ -52,6 +52,7 @@
 #include <sys/wait.h>
 #include <time.h>
 #include <sys/socket.h>
+#@INSERT_SYS_SELECT_H@
 
 #include <pthread.h>
 
@@ -400,3 +401,8 @@ int npth_sigev_get_pending (int *r_signum);
 }
 #endif
 #endif /*_NPTH_H*/
+/*
+@emacs_local_vars_begin@
+@emacs_local_vars_read_only@
+@emacs_local_vars_end@
+*/