2nd attempt at OS/X shared/mdynamicnopic fix by ("Steven M. Schultz" <sms at 2BSD...
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 3 Nov 2003 20:04:10 +0000 (20:04 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 3 Nov 2003 20:04:10 +0000 (20:04 +0000)
Originally committed as revision 2475 to svn://svn.ffmpeg.org/ffmpeg/trunk

configure
vhook/Makefile

index 3a24202..3adcc35 100755 (executable)
--- a/configure
+++ b/configure
@@ -424,6 +424,7 @@ if test $mmx = "default"; then
 fi
 
 #Darwin CC versions
+needmdynamicnopic="no"
 if test $targetos = Darwin; then
     if test -n "`$cc -v 2>&1 | grep xlc`"; then
        CFLAGS="-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
@@ -433,14 +434,17 @@ if test $targetos = Darwin; then
            *2.95*) 
                CFLAGS="-no-cpp-precomp -pipe -fomit-frame-pointer"
                ;;
-           *3.1*)
+           *3.*)
                CFLAGS="-no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
-               ;;
-           *3.3*)
-               CFLAGS="-no-cpp-precomp -pipe -fomit-frame-pointer -mdynamic-no-pic -force_cpusubtype_ALL -Wno-sign-compare"
+               if test "$lshared" = no; then
+                  needmdynamicnopic="yes"
+               fi
                ;;
            *)
-               CFLAGS="-no-cpp-precomp -pipe -fomit-frame-pointer -mdynamic-no-pic"
+               CFLAGS="-no-cpp-precomp -pipe -fomit-frame-pointer"
+               if test "$lshared" = no; then
+                  needmdynamicnopic="yes"
+               fi
                ;;
        esac
     fi
@@ -916,7 +920,16 @@ echo "CC=$cc" >> config.mak
 echo "AR=$ar" >> config.mak
 echo "RANLIB=$ranlib" >> config.mak
 echo "STRIP=$strip" >> config.mak
+
+# SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic.  Used when building 
+# shared modules on OS/X (vhook/Makefile).
+SHCFLAGS=$CFLAGS
+if test "$needmdynamicnopic" = yes; then
+   CFLAGS="$CFLAGS -mdynamic-no-pic"
+fi
+
 echo "OPTFLAGS=$CFLAGS" >> config.mak
+echo "SHCFLAGS=$SHCFLAGS">>config.mak
 echo "LDFLAGS=$LDFLAGS" >> config.mak
 echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
 echo "SHFLAGS=$SHFLAGS" >> config.mak
index f41aa61..3a89318 100644 (file)
@@ -2,10 +2,10 @@ include ../config.mak
 
 VPATH=$(SRC_PATH)/vhook
 
-CFLAGS=-fPIC $(OPTFLAGS) -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H
+CFLAGS=-fPIC $(SHCFLAGS) -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H
 
 ifeq ($(CONFIG_DARWIN),yes)
-SHFLAGS+=-bundle -flat_namespace -undefined suppress
+SHFLAGS+=-flat_namespace -undefined suppress
 endif
 HOOKS=null.so fish.so ppm.so
 
@@ -26,7 +26,7 @@ depend: $(SRCS)
        $(CC) -MM $(CFLAGS) $^ 1>.depend
 
 install:
-       install -s -m 755 $(HOOKS) $(INSTDIR)
+       install -m 755 $(HOOKS) $(INSTDIR)
 
 imlib2.so: imlib2.o
        $(CC) -g -o $@ $(SHFLAGS) $< -lImlib2