Remove reference to `scm_init_popen' when `fork' is unavailable.
authorLudovic Courtès <ludo@gnu.org>
Fri, 23 Nov 2012 22:37:29 +0000 (23:37 +0100)
committerLudovic Courtès <ludo@gnu.org>
Fri, 23 Nov 2012 22:37:29 +0000 (23:37 +0100)
Fixes <http://bugs.gnu.org/12477>.
Reported by lin ray <lin.wei.ray@gmail.com>.

* configure.ac: Define the `HAVE_FORK' Automake conditional.
* module/Makefile.am (ICE_9_SOURCES): Add `ice-9/popen.scm' only when
  HAVE_FORK.
* libguile/posix.c (scm_init_posix): Register `scm_init_popen' only when
  HAVE_FORK.

configure.ac
libguile/posix.c
module/Makefile.am

index 52fff69..36103df 100644 (file)
@@ -748,11 +748,14 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
 #   isblank - available as a GNU extension or in C99
 #   _NSGetEnviron - Darwin specific
 #   strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin
+#   fork - unavailable on Windows
 #   utimensat: posix.1-2008
 #   sched_getaffinity, sched_setaffinity: GNU extensions (glibc)
 #
 AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime ftruncate fchown fchmod getcwd geteuid getsid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe poll readdir_r readdir64_r readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron strcoll strcoll_l newlocale utimensat sched_getaffinity sched_setaffinity])
 
+AM_CONDITIONAL([HAVE_FORK], [test "x$ac_cv_func_fork" = "xyes"])
+
 # Reasons for testing:
 #   netdb.h - not in mingw
 #   sys/param.h - not in mingw
index 4f8b8ac..ce64256 100644 (file)
@@ -1,5 +1,6 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
- * 
+/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ *   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
  * as published by the Free Software Foundation; either version 3 of
@@ -2375,10 +2376,12 @@ scm_init_posix ()
 #include "libguile/cpp-SIG.c"
 #include "libguile/posix.x"
 
+#ifdef HAVE_FORK
   scm_c_register_extension ("libguile-" SCM_EFFECTIVE_VERSION,
                             "scm_init_popen",
                            (scm_t_extension_init_func) scm_init_popen,
                            NULL);
+#endif /* HAVE_FORK */
 }
 
 /*
index 44af07f..3d3eae3 100644 (file)
@@ -220,7 +220,6 @@ ICE_9_SOURCES = \
   ice-9/optargs.scm \
   ice-9/poe.scm \
   ice-9/poll.scm \
-  ice-9/popen.scm \
   ice-9/posix.scm \
   ice-9/q.scm \
   ice-9/rdelim.scm \
@@ -252,6 +251,13 @@ ICE_9_SOURCES = \
   ice-9/serialize.scm \
   ice-9/local-eval.scm
 
+if HAVE_FORK
+
+# This functionality is missing on systems without `fork'---i.e., Windows.
+ICE_9_SOURCES += ice-9/popen.scm
+
+endif HAVE_FORK
+
 SRFI_SOURCES = \
   srfi/srfi-2.scm \
   srfi/srfi-4.scm \