[MPlayer-dev-eng] [PATCH] configure test for MAP_FAILED define

Ian Lindsay iml04 at hampshire.edu
Mon Jan 17 17:16:55 CET 2005


Only #define MAP_FAILED where necessary. Since "config.h" is usually
included before <sys/mman.h> it doesn't work to use #ifndef there.
-------------- next part --------------
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.953
diff -u -r1.953 configure
--- configure	16 Jan 2005 22:01:52 -0000	1.953
+++ configure	17 Jan 2005 16:11:26 -0000
@@ -2641,6 +2641,19 @@
 fi
 echores "$_mman"
 
+cat > $TMPC << EOF
+#include <sys/types.h>
+#include <sys/mman.h>
+int main(void) { void *p = MAP_FAILED; return 0; }
+EOF
+_mman_has_map_failed=no
+cc_check && _mman_has_map_failed=yes
+if test "$_mman_has_map_failed" = yes ; then
+  _def_mman_has_map_failed=''
+else
+  _def_mman_has_map_failed='#define MAP_FAILED ((void *) -1)'
+fi
+
 echocheck "dynamic loader"
 cat > $TMPC << EOF
 #include <dlfcn.h>
@@ -6829,11 +6842,6 @@
 /* use GNU internationalization */
 $_def_i18n
 
-/* missing mmap function on libc5 systems */
-#ifndef MAP_FAILED
-# define MAP_FAILED     ((void *) -1)
-#endif
-
 /* use setlocale() function */
 $_def_setlocale
 
@@ -7003,6 +7011,7 @@
 
 /* Define this if your system has the "sys/mman.h" header file */
 $_def_mman
+$_def_mman_has_map_failed
 
 /* Define this if you have the elf dynamic linker -ldl library */
 $_def_dl


More information about the MPlayer-dev-eng mailing list