From: Loren Merritt Date: Sat, 11 Mar 2006 03:32:37 +0000 (+0000) Subject: configure: --enable-shared for libx264.so X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=926212b3f0ff67ffc8ea2e3a7b299c016a00404c;p=libx264 configure: --enable-shared for libx264.so git-svn-id: svn://svn.videolan.org/x264/trunk@467 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/Makefile b/Makefile index 208d4046..5a3e4595 100644 --- a/Makefile +++ b/Makefile @@ -67,6 +67,9 @@ libx264.a: .depend $(OBJS) $(OBJASM) ar rc libx264.a $(OBJS) $(OBJASM) ranlib libx264.a +$(SONAME): .depend $(OBJS) $(OBJASM) + $(CC) -shared -o $@ $(OBJS) $(OBJASM) -Wl,-soname,$(SONAME) + x264$(EXE): $(OBJCLI) libx264.a $(CC) -o $@ $+ $(LDFLAGS) @@ -120,7 +123,7 @@ fprofiled: endif clean: - rm -f $(OBJS) $(OBJASM) $(OBJCLI) *.a x264 x264.exe .depend TAGS + rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(SONAME) *.a x264 x264.exe .depend TAGS rm -f checkasm checkasm.exe tools/checkasm.o rm -f tools/avc2avi tools/avc2avi.exe tools/avc2avi.o rm -rf vfw/build/cygwin/bin @@ -130,7 +133,7 @@ clean: distclean: clean rm -f config.mak config.h vfw/build/cygwin/config.mak x264.pc -install: x264 +install: x264 $(SONAME) install -d $(DESTDIR)$(bindir) $(DESTDIR)$(includedir) install -d $(DESTDIR)$(libdir) $(DESTDIR)$(libdir)/pkgconfig install -m 644 x264.h $(DESTDIR)$(includedir) @@ -138,10 +141,13 @@ install: x264 install -m 644 x264.pc $(DESTDIR)$(libdir)/pkgconfig install x264 $(DESTDIR)$(bindir) ranlib $(DESTDIR)$(libdir)/libx264.a + $(if $(SONAME), ln -sf $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.so) + $(if $(SONAME), install -m 755 $(SONAME) $(DESTDIR)$(libdir)) uninstall: rm -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(libdir)/libx264.a rm -f $(DESTDIR)$(bindir)/x264 $(DESTDIR)$(libdir)/pkgconfig/x264.pc + $(if $(SONAME), rm -f $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.so) etags: TAGS diff --git a/configure b/configure index 954a81c0..35dbb24e 100755 --- a/configure +++ b/configure @@ -15,6 +15,7 @@ echo " --enable-debug adds -g, doesn't strip" echo " --enable-gprof adds -pg, doesn't strip" echo " --enable-visualize enables visualization (X11 only)" echo " --enable-pic build position-independent code" +echo " --enable-shared build libx264.so" echo " --extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS" echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS" echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS" @@ -51,6 +52,7 @@ gprof="no" pic="no" vfw="no" vis="no" +shared="no" CC="gcc" CFLAGS="-Wall -I. -O4 -ffast-math -D__X264__" @@ -92,13 +94,11 @@ case "$UNAMES" in LDFLAGS="$LDFLAGS -mno-cygwin" EXE=".exe" DEVNULL="NUL" - vfw="yes" ;; MINGW*) SYS="MINGW" EXE=".exe" DEVNULL="NUL" - vfw="yes" ;; SunOS) SYS="SunOS" @@ -242,8 +242,6 @@ for opt do gprof="yes" ;; --enable-pic) - CFLAGS="$CFLAGS -fPIC" - ASFLAGS="$ASFLAGS -D__PIC__" pic="yes" ;; --enable-vfw) @@ -252,6 +250,12 @@ for opt do --disable-vfw) vfw="no" ;; + --enable-shared) + shared="yes" + if [ $ARCH = "X86_64" -o $ARCH = "PPC" -o $ARCH = "ALPHA" ] ; then + pic="yes" + fi + ;; --enable-visualize) LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11" CFLAGS="$CFLAGS -DVISUALIZE=1" @@ -311,6 +315,11 @@ if [ "$avis_input" = "yes" ] ; then LDFLAGS="$LDFLAGS -lvfw32" fi +if [ "$pic" = "yes" ] ; then + CFLAGS="$CFLAGS -fPIC" + ASFLAGS="$ASFLAGS -D__PIC__" +fi + if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then CFLAGS="$CFLAGS -s -fomit-frame-pointer" LDFLAGS="$LDFLAGS -s" @@ -357,6 +366,12 @@ EOF echo "default: x264vfw.dll" >> config.mak fi +if [ "$shared" = "yes" ]; then + API=`grep '#define X264_BUILD' < x264.h | cut -f 3 -d ' '` + echo "SONAME=libx264.so.$API" >> config.mak + echo 'default: $(SONAME)' >> config.mak +fi + ./version.sh cat > x264.pc << EOF @@ -382,6 +397,7 @@ echo "vfw: $vfw" echo "debug: $debug" echo "gprof: $gprof" echo "PIC: $pic" +echo "shared: $shared" echo "visualize: $vis" echo echo "You can run 'make' or 'make fprofiled' now."