[x264-devel] configure: correct use of RC variable and add --extra-rcflags

Alexander Prikhodko git at videolan.org
Wed Apr 25 00:17:09 CEST 2012


x264 | branch: master | Alexander Prikhodko <komisar666 at gmail.com> | Sat Mar 31 11:33:41 2012 +0300| [f87619768dba73c1effbcfb08875d096575e079e] | committer: Jason Garrett-Glaser

configure: correct use of RC variable and add --extra-rcflags

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=f87619768dba73c1effbcfb08875d096575e079e
---

 Makefile  |    4 ++--
 configure |   20 ++++++++++++++------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 5e39050..7a22c42 100644
--- a/Makefile
+++ b/Makefile
@@ -186,10 +186,10 @@ $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK): .depend
 	-@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile
 
 %.dll.o: %.rc x264.h
-	$(RC)$@ -DDLL $<
+	$(RC) $(RCFLAGS)$@ -DDLL $<
 
 %.o: %.rc x264.h
-	$(RC)$@ $<
+	$(RC) $(RCFLAGS)$@ $<
 
 .depend: config.mak
 	@rm -f .depend
diff --git a/configure b/configure
index d527e8f..e1476d1 100755
--- a/configure
+++ b/configure
@@ -18,6 +18,7 @@ Standard options:
   --extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS
   --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS
   --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS
+  --extra-rcflags=ERCFLAGS add ERCFLAGS to RCFLAGS
 
 Configuration options:
   --disable-cli            disable cli
@@ -204,9 +205,9 @@ rc_check() {
     log_check "whether $RC works"
     echo "$1" > conftest.rc
     if [ $compiler = ICL ]; then
-        rc_cmd="$RC -foconftest.o conftest.rc"
+        rc_cmd="$RC $RCFLAGS -foconftest.o conftest.rc"
     else
-        rc_cmd="$RC -o conftest.o conftest.rc"
+        rc_cmd="$RC $RCFLAGS -o conftest.o conftest.rc"
     fi
     if $rc_cmd >conftest.log 2>&1; then
         res=$?
@@ -277,6 +278,7 @@ CFLAGS="$CFLAGS -Wall -I. -I\$(SRCPATH)"
 LDFLAGS="$LDFLAGS"
 LDFLAGSCLI="$LDFLAGSCLI"
 ASFLAGS="$ASFLAGS"
+RCFLAGS="$RCFLAGS"
 HAVE_GETOPT_LONG=1
 cross_prefix=""
 
@@ -347,6 +349,9 @@ for opt do
         --extra-ldflags=*)
             LDFLAGS="$LDFLAGS $optarg"
             ;;
+        --extra-rcflags=*)
+            RCFLAGS="$RCFLAGS $optarg"
+            ;;
         --disable-thread)
             thread="no"
             ;;
@@ -495,12 +500,14 @@ case $host_os in
         else
             SYS="WINDOWS"
             DEVNULL="NUL"
+            RC="${RC-${cross_prefix}windres}"
         fi
         ;;
     mingw*)
         SYS="WINDOWS"
         EXE=".exe"
         DEVNULL="NUL"
+        [ $compiler = ICL ] && RC="${RC-rc}" || RC="${RC-${cross_prefix}windres}"
         ;;
     sunos*|solaris*)
         SYS="SunOS"
@@ -550,6 +557,7 @@ case $host_cpu in
         elif [ "$SYS" = WINDOWS -o "$SYS" = CYGWIN ]; then
             ASFLAGS="$ASFLAGS -f win32 -DPREFIX"
             LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
+            [ $compiler = GNU ] && RCFLAGS="--target=pe-i386 $RCFLAGS"
         else
             ASFLAGS="$ASFLAGS -f elf"
         fi
@@ -567,6 +575,7 @@ case $host_cpu in
             ASFLAGS="$ASFLAGS -f win32 -m amd64"
             # only the GNU toolchain is inconsistent in prefixing function names with _
             [ $compiler = GNU ] && cc_check "" "-S" && grep -q "_main:" conftest && ASFLAGS="$ASFLAGS -DPREFIX"
+            [ $compiler = GNU ] && RCFLAGS="--target=pe-x86-64 $RCFLAGS"
         else
             ASFLAGS="$ASFLAGS -f elf -m amd64"
         fi
@@ -634,9 +643,7 @@ case $host_cpu in
         ;;
 esac
 
-RC=""
 if [ $SYS = WINDOWS ]; then
-    [ $compiler = ICL ] && RC="rc" || RC="${cross_prefix}windres"
     if ! rc_check "0 RCDATA {0}" ; then
         RC=""
     fi
@@ -994,7 +1001,7 @@ if [ $compiler = ICL ]; then
     LDFLAGSCLI="$(icl_ldflags $LDFLAGSCLI)"
     LIBX264=libx264.lib
     RANLIB=
-    [ -n "$RC" ] && RC="$RC -I. -I\$(SRCPATH)/extras -fo"
+    [ -n "$RC" ] && RCFLAGS="$RCFLAGS -I. -I\$(SRCPATH)/extras -fo"
     STRIP=
     if [ $debug = yes ]; then
         LDFLAGS="-debug $LDFLAGS"
@@ -1008,7 +1015,7 @@ else
     DEPMT="-MT"
     LD="$CC -o "
     LIBX264=libx264.a
-    [ -n "$RC" ] && RC="$RC -I. -o "
+    [ -n "$RC" ] && RCFLAGS="$RCFLAGS -I. -o "
 fi
 if [ $compiler = GNU ]; then
     PROF_GEN_CC="-fprofile-generate"
@@ -1062,6 +1069,7 @@ STRIP=$STRIP
 AS=$AS
 ASFLAGS=$ASFLAGS
 RC=$RC
+RCFLAGS=$RCFLAGS
 EXE=$EXE
 HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
 DEVNULL=$DEVNULL



More information about the x264-devel mailing list