Bug 19114

Summary: working mmap not found by autoconf / getpagesize header problem
Product: [Retired] Red Hat Linux Reporter: Mark Cooke <mpc>
Component: autoconfAssignee: Jens Petersen <petersen>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: petersen
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-07-10 11:03:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mark Cooke 2000-10-14 20:03:13 UTC
Setup:

Compiling Livid/OMS from CVS - www.linuxvideo.org on RH 7.0

Steps to Repeat:

1. Checkout current cvs (3pm, 14th October)
2. Run autogen.sh from the oms tree.

Description:

configure fails to detect mmap as working.  tracing into the autoconf test
shows undefined references to getpagesize/read/write/open/umask/rand etc.
(See config.log)

The autoconf test in /usr/share/autoconf/acspecific.m4 does not appear to
contain the correct set of header includes for an error-free test of mmap
functionality.

RH7 appears to need at least stdlib.h (for rand) and sys/stat.h (for umask)
added to the headers used in the test.

The autoconf with RH7 also doesn't actually include unistd.h because as
part of the earlier OMS configure, HAVE_GETPAGESIZE is defined.  This
breaks the test in acspecific too - unistd.h is needed on RH7 for
write/read/close/etc.

Cheers,

Mark

Comment 1 Jens Petersen 2001-06-29 07:29:54 UTC
Thank you for the report and sorry for the slow response.

[This is already fixed in autoconf-2.50.]

The following patch seems to solve the problem in 2.13. Tested on oms-0.1.2.

--- autoconf-2.13/acspecific.m4.orig	Fri Jun 29 16:26:39 2001
+++ autoconf-2.13/acspecific.m4	Fri Jun 29 16:26:39 2001
@@ -1010,7 +1043,7 @@
 ])
 
 AC_DEFUN(AC_FUNC_MMAP,
-[AC_CHECK_HEADERS(unistd.h)
+[AC_CHECK_HEADERS(stdlib.h unistd.h sys/stat.h sys/types.h)
 AC_CHECK_FUNCS(getpagesize)
 AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
 [AC_TRY_RUN([
@@ -1039,11 +1072,24 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
 /* This mess was copied from the GNU getpagesize.h.  */
 #ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
-#  include <unistd.h>
-# endif
 
 /* Assume that all systems that can run configure have sys/param.h.  */
 # ifndef HAVE_SYS_PARAM_H