Browse code

configure: add cp_if_changed function and use for config.h

Originally committed as revision 21318 to svn://svn.ffmpeg.org/ffmpeg/trunk

Måns Rullgård authored on 2010/01/19 13:40:08
Showing 1 changed files
... ...
@@ -831,6 +831,12 @@ apply(){
831 831
     "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
832 832
 }
833 833
 
834
+cp_if_changed(){
835
+    cmp -s "$1" "$2" &&
836
+        echo "$2 is unchanged" ||
837
+        cp -f "$1" "$2"
838
+}
839
+
834 840
 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
835 841
 # system-dependent things.
836 842
 
... ...
@@ -2909,9 +2915,7 @@ echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
2909 2909
 echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
2910 2910
 
2911 2911
 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
2912
-cmp -s $TMPH config.h &&
2913
-    echo "config.h is unchanged" ||
2914
-    mv -f $TMPH config.h
2912
+cp_if_changed $TMPH config.h
2915 2913
 
2916 2914
 # build tree in object directory if source path is different from current one
2917 2915
 if enabled source_path_used; then