aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2006-01-30 00:22:41 +0000
committerDiego Biurrun <diego@biurrun.de>2006-01-30 00:22:41 +0000
commit320d060ae94eea9018ee4292cd18b506c333d377 (patch)
treecc5f4cb5a457f7781b3b3a30038ebeea6dbb173c
parent53862e0fa6be8a0a0d750f9e8897934068dbe6d0 (diff)
downloadffmpeg-320d060ae94eea9018ee4292cd18b506c333d377.tar.gz
On MinGW it is not possible to build shared and static libraries at once.
Add means to disable building the static libraries and fix a few issues with the MinGW build. All the hard work done by Alexander Strasser, minor changes by myself. Originally committed as revision 4909 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rwxr-xr-xconfigure36
-rw-r--r--libavcodec/Makefile3
-rw-r--r--libavformat/Makefile5
-rw-r--r--libavutil/Makefile7
-rw-r--r--libavutil/common.h11
5 files changed, 53 insertions, 9 deletions
diff --git a/configure b/configure
index a41e149b8e..db058bd678 100755
--- a/configure
+++ b/configure
@@ -31,7 +31,10 @@ echo " --enable-a52 enable GPLed A52 support [default=no]"
echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
echo " --enable-dts enable GPLed DTS support [default=no]"
echo " --enable-pp enable GPLed postprocessing support [default=no]"
+echo " --enable-static build static libraries [default=yes]"
+echo " --disable-static do not build static libraries [default=no]"
echo " --enable-shared build shared libraries [default=no]"
+echo " --disable-shared do not build shared libraries [default=yes]"
echo " --enable-amr_nb enable amr_nb float audio codec"
echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
echo " --enable-amr_wb enable amr_wb float audio codec"
@@ -206,6 +209,7 @@ mingw32="no"
mingwce="no"
cygwin="no"
os2="no"
+lstatic="yes"
lshared="no"
optimize="yes"
debug="yes"
@@ -549,8 +553,14 @@ for opt do
;;
--enable-mingwce) mingwce="yes"
;;
+ --enable-static) lstatic="yes"
+ ;;
+ --disable-static) lstatic="no"
+ ;;
--enable-shared) lshared="yes"
;;
+ --disable-shared) lshared="no"
+ ;;
--disable-debug) debug="no"
;;
--disable-opts) optimize="no"
@@ -607,6 +617,17 @@ for opt do
esac
done
+# we need to build at least one lib type
+if test "$lstatic" = "no" && test "$lshared" = "no" ; then
+ cat <<EOF
+At least one library type must be built.
+Specify --enable-static to build the static libraries or --enable-shared to
+build the shared libraries as well. To only build the shared libraries specify
+--disable-static in addition to --enable-shared.
+EOF
+ exit 1;
+fi
+
if test "$theora" = "yes" ; then
if test "$libogg" = "no"; then
echo "libogg must be enabled to enable Theora."
@@ -869,6 +890,15 @@ $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
fi
if test "$mingw32" = "yes" -o "$mingwce" = "yes"; then
+ if test "$lshared" = "yes" && test "$lstatic" = "yes" ; then
+ cat <<EOF
+You can only build one library type at once on MinGW.
+Specify --disable-static --enable-shared to only build
+the shared libraries. To build only the static libraries
+you don't need to pass additional options.
+EOF
+ exit 1
+ fi
v4l="no"
bktr="no"
audio_oss="no"
@@ -1296,6 +1326,7 @@ echo "pp support $pp"
echo "debug symbols $debug"
echo "strip symbols $dostrip"
echo "optimize $optimize"
+echo "static $lstatic"
echo "shared $lshared"
echo "video hooking $vhook"
echo "SDL support $sdl"
@@ -1364,7 +1395,9 @@ echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
echo "BUILDSUF=$BUILDSUF" >> config.mak
echo "LIBPREF=$LIBPREF" >> config.mak
echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
-echo "LIB=$LIB" >> config.mak
+if test "$lstatic" = "yes" ; then
+ echo "LIB=$LIB" >> config.mak
+fi
echo "SLIBPREF=$SLIBPREF" >> config.mak
echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
@@ -1508,6 +1541,7 @@ lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h
if test "$lshared" = "yes" ; then
+ echo "#define BUILD_SHARED_AV 1" >> $TMPH
echo "BUILD_SHARED=yes" >> config.mak
echo "PIC=-fPIC -DPIC" >> config.mak
echo "SPPMAJOR=${lavc_version%%.*}" >> config.mak
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index b12dff0327..794d3c826a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -11,7 +11,7 @@ CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -I$(SRC_PATH)/libavutil -D_FILE_OFFSE
#FIXME: This should be in configure/config.mak
ifeq ($(CONFIG_WIN32),yes)
- LDFLAGS=-Wl,--output-def,$(@:.dll=.def)
+ LDFLAGS=-Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
endif
OBJS= bitstream.o utils.o mem.o allcodecs.o \
@@ -449,6 +449,7 @@ dep: depend
clean: $(CLEANAMR)
rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
+ *.dll.a *.def *.exp \
i386/*.o i386/*~ \
armv4l/*.o armv4l/*~ \
mlib/*.o mlib/*~ \
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 92a1e686e8..55abd2be2b 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -10,7 +10,7 @@ CFLAGS=$(OPTFLAGS) -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavutil -I$(SRC_PATH)/liba
#FIXME: This should be in configure/config.mak
ifeq ($(CONFIG_WIN32),yes)
- LDFLAGS=-Wl,--output-def,$(@:.dll=.def)
+ LDFLAGS=-Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
endif
OBJS= utils.o cutils.o os_support.o allformats.o
@@ -157,7 +157,8 @@ install-headers:
g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
clean:
- rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll
+ rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
+ *.lib *.def *.dll.a *.exp
distclean: clean
rm -f .depend
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 9d02aab4ef..4dcb7e3b19 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -6,11 +6,11 @@ include ../config.mak
VPATH=$(SRC_PATH)/libavutil
# NOTE: -I.. is needed to include config.h
-CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -DBUILD_AVUTIL -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
#FIXME: This should be in configure/config.mak
ifeq ($(CONFIG_WIN32),yes)
- LDFLAGS=-Wl,--output-def,$(@:.dll=.def)
+ LDFLAGS=-Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
endif
OBJS= mathematics.o \
@@ -53,7 +53,8 @@ depend: $(SRCS)
dep: depend
clean:
- rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll
+ rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
+ *.lib *.def *.dll.a *.exp
distclean: clean
rm -f .depend
diff --git a/libavutil/common.h b/libavutil/common.h
index 09638c39e7..f4dcf310b0 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -247,6 +247,13 @@ static inline float floorf(float f) {
#ifdef HAVE_AV_CONFIG_H
+#if defined(__MINGW32__) && !defined(BUILD_AVUTIL) && defined(BUILD_SHARED_AV)
+# define FF_IMPORT_ATTR __declspec(dllimport)
+#else
+# define FF_IMPORT_ATTR
+#endif
+
+
# include "bswap.h"
// Use rip-relative addressing if compiling PIC code on x86-64.
@@ -345,7 +352,7 @@ void print_stats(void);
#endif
/* misc math functions */
-extern const uint8_t ff_log2_tab[256];
+extern FF_IMPORT_ATTR const uint8_t ff_log2_tab[256];
static inline int av_log2(unsigned int v)
{
@@ -423,7 +430,7 @@ static inline int clip_uint8(int a)
}
/* math */
-extern const uint8_t ff_sqrt_tab[128];
+extern FF_IMPORT_ATTR const uint8_t ff_sqrt_tab[128];
int64_t ff_gcd(int64_t a, int64_t b);