changeset 21855:936209c39ed1

Move #ifdef directives around complete files into the build system.
author diego
date Wed, 10 Jan 2007 19:07:42 +0000
parents 752d1c70aa67
children e268886eb13d
files configure osdep/Makefile osdep/gettimeofday.c osdep/glob-win.c osdep/mmap_anon.c osdep/scandir.c osdep/setenv.c osdep/shmem.c osdep/strsep.c osdep/swab.c osdep/vsscanf.c
diffstat 11 files changed, 35 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Wed Jan 10 18:54:44 2007 +0000
+++ b/configure	Wed Jan 10 19:07:42 2007 +0000
@@ -3378,8 +3378,10 @@
 cc_check && _scandir=yes
 if test "$_scandir" = yes ; then
  _def_scandir='#define HAVE_SCANDIR 1'
+ _need_scandir=no
 else
  _def_scandir='#undef HAVE_SCANDIR'
+ _need_scandir=yes
 fi
 echores "$_scandir"
 
@@ -3393,8 +3395,10 @@
 cc_check && _strsep=yes
 if test "$_strsep" = yes ; then
  _def_strsep='#define HAVE_STRSEP 1'
+ _need_strsep=no
 else
  _def_strsep='#undef HAVE_STRSEP'
+ _need_strsep=yes
 fi
 echores "$_strsep"
 
@@ -3463,8 +3467,10 @@
 cc_check && _vsscanf=yes
 if test "$_vsscanf" = yes ; then
   _def_vsscanf='#define HAVE_VSSCANF 1'
+  _need_vsscanf=no
 else
   _def_vsscanf='#undef HAVE_VSSCANF'
+  _need_vsscanf=yes
 fi
 echores "$_vsscanf"
 
@@ -3478,8 +3484,10 @@
 cc_check && _swab=yes
 if test "$_swab" = yes ; then
   _def_swab='#define HAVE_SWAB 1'
+  _need_swab=no
 else
   _def_swab='#undef HAVE_SWAB'
+  _need_swab=yes
 fi
 echores "$_swab"
 
@@ -3529,8 +3537,10 @@
 cc_check && _glob=yes
 if test "$_glob" = yes ; then
   _def_glob='#define HAVE_GLOB 1'
+  _need_glob=no
 else
   _def_glob='#undef HAVE_GLOB'
+  _need_glob=yes
 fi
 echores "$_glob"
 
@@ -3544,8 +3554,10 @@
 cc_check && _setenv=yes
 if test "$_setenv" = yes ; then
   _def_setenv='#define HAVE_SETENV 1'
+  _need_setenv=no
 else
   _def_setenv='#undef HAVE_SETENV'
+  _need_setenv=yes
 fi
 echores "$_setenv"
 
@@ -7465,6 +7477,15 @@
 
 HAVE_XVMC_ACCEL = $_xvmc
 
+HAVE_SYS_MMAN_H = _mman
+
+NEED_GLOB    = $_need_glob
+NEED_SCANDIR = $_need_scandir
+NEED_SETENV  = $_need_setenv
+NEED_STRSEP  = $_need_strsep
+NEED_SWAB    = $_need_swab
+NEED_VSSCANF = $_need_vsscanf
+
 # for FFmpeg
 SRC_PATH=..
 BUILD_ROOT=..
--- a/osdep/Makefile	Wed Jan 10 18:54:44 2007 +0000
+++ b/osdep/Makefile	Wed Jan 10 19:07:42 2007 +0000
@@ -3,18 +3,21 @@
 
 LIBNAME = libosdep.a
 
-SRCS= shmem.c \
-      strsep.c \
-      strl.c \
-      vsscanf.c \
-      scandir.c \
-      gettimeofday.c \
+SRCS= strl.c \
       fseeko.c \
-      swab.c \
-      setenv.c \
-      mmap_anon.c \
+
+SRCS-$(HAVE_SYS_MMAN_H)       += mmap_anon.c
+SRCS-$(MACOSX_FINDER_SUPPORT) += macosx_finder_args.c
+ifneq ($(TARGET_OS),MINGW32)
+SRCS-$(STREAM_CACHE)          += shmem.c
+endif
 
-SRCS-$(MACOSX_FINDER_SUPPORT) += macosx_finder_args.c
+SRCS-$(NEED_GETTIMEOFDAY)     += gettimeofday.c
+SRCS-$(NEED_SCANDIR)          += scandir.c
+SRCS-$(NEED_SETENV)           += setenv.c
+SRCS-$(NEED_STRSEP)           += strsep.c
+SRCS-$(NEED_SWAB)             += swab.c
+SRCS-$(NEED_VSSCANF)          += vsscanf.c
 
 getch = getch2.c
 timer = timer-lx.c
@@ -26,7 +29,7 @@
 endif
 ifeq ($(TARGET_OS),MINGW32)
 getch = getch2-win.c
-SRCS += glob-win.c
+SRCS-$(NEED_GLOB)             += glob-win.c
 endif
 SRCS += $(timer)
 SRCS += $(getch)
--- a/osdep/gettimeofday.c	Wed Jan 10 18:54:44 2007 +0000
+++ b/osdep/gettimeofday.c	Wed Jan 10 19:07:42 2007 +0000
@@ -1,6 +1,5 @@
 #include "config.h"
 
-#ifndef HAVE_GETTIMEOFDAY
 #include <sys/time.h>
 #include <sys/timeb.h>
 void gettimeofday(struct timeval* t,void* timezone)
@@ -9,4 +8,3 @@
         t->tv_sec=timebuffer.time;
         t->tv_usec=1000*timebuffer.millitm;
 }
-#endif
--- a/osdep/glob-win.c	Wed Jan 10 18:54:44 2007 +0000
+++ b/osdep/glob-win.c	Wed Jan 10 19:07:42 2007 +0000
@@ -3,7 +3,6 @@
 
 #include "config.h"
 
-#ifndef HAVE_GLOB
 #include <windows.h>
 #include "glob.h"
 
@@ -85,4 +84,3 @@
    
    return 0;
 }
-#endif
--- a/osdep/mmap_anon.c	Wed Jan 10 18:54:44 2007 +0000
+++ b/osdep/mmap_anon.c	Wed Jan 10 19:07:42 2007 +0000
@@ -3,7 +3,6 @@
  * \brief Provide a compatible anonymous space mapping function
  */
 #include "config.h"
-#ifdef HAVE_SYS_MMAN_H
 
 #include <stdio.h>
 #include <unistd.h>
@@ -63,5 +62,3 @@
 
     return result;
 }
-
-#endif /* HAVE_SYS_MMAN_H */
--- a/osdep/scandir.c	Wed Jan 10 18:54:44 2007 +0000
+++ b/osdep/scandir.c	Wed Jan 10 19:07:42 2007 +0000
@@ -6,8 +6,6 @@
 
 #include "config.h"
 
-#ifndef	HAVE_SCANDIR
-
 #include <sys/types.h>
 #include <dirent.h>
 #include <stdlib.h>
@@ -118,7 +116,6 @@
     }
     return -1;
 }
-#endif
 
 
 #if	STANDALONE_MAIN
--- a/osdep/setenv.c	Wed Jan 10 18:54:44 2007 +0000
+++ b/osdep/setenv.c	Wed Jan 10 19:07:42 2007 +0000
@@ -2,8 +2,6 @@
 
 #include "config.h"
 
-#ifndef HAVE_SETENV
-
 #include <stdlib.h>
 #include <string.h>
 #ifndef MP_DEBUG
@@ -26,4 +24,3 @@
 
   return 0;
 }
-#endif
--- a/osdep/shmem.c	Wed Jan 10 18:54:44 2007 +0000
+++ b/osdep/shmem.c	Wed Jan 10 19:07:42 2007 +0000
@@ -8,8 +8,6 @@
 
 #include "config.h"
 
-#if defined(USE_STREAM_CACHE) && !defined(WIN32)
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -116,5 +114,3 @@
       break;
   }
 }
-
-#endif
--- a/osdep/strsep.c	Wed Jan 10 18:54:44 2007 +0000
+++ b/osdep/strsep.c	Wed Jan 10 19:07:42 2007 +0000
@@ -5,7 +5,6 @@
 
 #include "config.h"
 
-#ifndef HAVE_STRSEP
 char *strsep(char **stringp, const char *delim) {
   char *begin, *end;
 
@@ -39,4 +38,3 @@
  
   return begin;
 }
-#endif
--- a/osdep/swab.c	Wed Jan 10 18:54:44 2007 +0000
+++ b/osdep/swab.c	Wed Jan 10 19:07:42 2007 +0000
@@ -1,6 +1,5 @@
 #include "config.h"
 
-#ifndef	HAVE_SWAB
 /* system has no swab.  emulate via bswap */
 #include "mpbswap.h"
 #include <unistd.h>
@@ -14,4 +13,3 @@
     out[i] = bswap_16(in[i]);
   }
 }
-#endif
--- a/osdep/vsscanf.c	Wed Jan 10 18:54:44 2007 +0000
+++ b/osdep/vsscanf.c	Wed Jan 10 19:07:42 2007 +0000
@@ -1,6 +1,5 @@
 #include "config.h"
 
-#ifndef	HAVE_VSSCANF
 /* system has no vsscanf.  try to provide one */
 
 #include <stdio.h>
@@ -17,4 +16,3 @@
     long p5 = va_arg(ap, long);
     return sscanf(str, format, p1, p2, p3, p4, p5);
 }
-#endif