Commit c597172e authored by Måns Rullgård's avatar Måns Rullgård

add --target-os option, and move OS specific settings after command line

processing

Originally committed as revision 8006 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 20da7744
......@@ -733,13 +733,14 @@ case "$arch" in
esac
# OS
targetos=`uname -s`
beos_netserver="no"
mingw32="no"
os2="no"
wince="no"
# non-library system interfaces
audio_beos="no"
audio_beos="default"
audio_oss="yes"
bktr="yes"
dv1394="yes"
......@@ -803,7 +804,6 @@ w32threads="no"
thread_type="no"
# build settings
extralibs="-lm"
SHFLAGS='-shared -Wl,-soname,$@'
VHOOKSHFLAGS='$(SHFLAGS)'
LIBOBJFLAGS=""
......@@ -823,8 +823,121 @@ EXESUF=""
BUILDSUF=""
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
# find source path
source_path="`dirname \"$0\"`"
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
source_path="`pwd`"
source_path_used="no"
else
source_path="`cd \"$source_path\"; pwd`"
echo "$source_path" | grep -q '[[:blank:]]' &&
die "Out of tree builds are impossible with whitespace in source path."
fi
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
show_help
fi
FFMPEG_CONFIGURATION="$@"
ENCODER_LIST=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"`
DECODER_LIST=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"`
PARSER_LIST=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"`
MUXER_LIST=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"`
DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"`
enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST
die_unknown(){
echo "Unknown option \"$1\"."
echo "See $0 --help for available options."
exit 1
}
for opt do
optval="${opt#*=}"
case "$opt" in
--log)
;;
--log=*) logging="$optval"
;;
--prefix=*) PREFIX="$optval"
;;
--libdir=*) libdir="$optval"
;;
--shlibdir=*) shlibdir="$optval"
;;
--incdir=*) incdir="$optval"
;;
--mandir=*) mandir="$optval"
;;
--source-path=*) source_path="$optval"
;;
--cross-prefix=*) cross_prefix="$optval"
;;
--cross-compile) cross_compile="yes"
;;
--target-os=*) targetos="$optval"
;;
--cc=*) cc="$optval"
;;
--make=*) make="$optval"
;;
--extra-cflags=*) add_cflags "$optval"
;;
--extra-ldflags=*) add_ldflags "$optval"
;;
--extra-libs=*) add_extralibs "$optval"
;;
--build-suffix=*) BUILDSUF="$optval"
;;
--arch=*) arch="$optval"
;;
--cpu=*) cpu="$optval"
;;
--enable-mingwce) wince="yes"
;;
--disable-opts) optimize="no"
;;
--enable-small) optimize="small"
;;
--enable-sunmlib) mlib="yes"
;;
--disable-strip) dostrip="no"
;;
--disable-encoders) disable $ENCODER_LIST
;;
--disable-decoders) disable $DECODER_LIST
;;
--disable-muxers) disable $MUXER_LIST
;;
--disable-demuxers) disable $DEMUXER_LIST
;;
--disable-parsers) disable $PARSER_LIST
;;
--enable-*=*|--disable-*=*)
eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
case "$thing" in
encoder|decoder|muxer|demuxer|parser) $action ${optval}_${thing} ;;
*) die_unknown "$opt" ;;
esac
;;
--enable-?*|--disable-?*)
eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
echo "$CMDLINE_SELECT" | grep -q "^ *$option\$" || die_unknown $opt
$action $option
;;
--help) show_help
;;
*)
die_unknown $opt
;;
esac
done
# OS specific
targetos=`uname -s`
osextralibs="-lm"
case $targetos in
BeOS|Haiku|Zeta)
PREFIX="$HOME/config"
......@@ -845,15 +958,15 @@ case $targetos in
# disable Linux things
dv1394="no"
# enable BeOS things
audio_beos="yes"
disabled audio_beos || enable_audio_beos
# no need for libm, but the inet stuff
# Check for BONE
# XXX: actually should check for NOT net_server
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
extralibs="-lbind -lsocket"
osextralibs="-lbind -lsocket"
else
beos_netserver="yes"
extralibs="-lnet"
osextralibs="-lnet"
fi ;;
SunOS)
dv1394="no"
......@@ -888,7 +1001,7 @@ case $targetos in
;;
BSD/OS)
dv1394="no"
extralibs="-lpoll -lgnugetopt -lm"
osextralibs="-lpoll -lgnugetopt -lm"
strip="strip -d"
;;
Darwin)
......@@ -897,7 +1010,7 @@ case $targetos in
need_memalign="no"
SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(shlibdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION) -Wl,-read_only_relocs,suppress"
VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(shlibdir)/vhook/$@'
extralibs=""
osextralibs=""
strip="strip -x"
FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
SLIBSUF=".dylib"
......@@ -916,7 +1029,7 @@ case $targetos in
dv1394="no"
VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
extralibs=""
osextralibs=""
EXESUF=".exe"
SLIBPREF="cyg"
SLIBSUF=".dll"
......@@ -945,7 +1058,7 @@ case $targetos in
SLIBPREF=""
SLIBSUF=".dll"
EXESUF=".exe"
extralibs=""
osextralibs=""
pkg_requires=""
dv1394="no"
ffserver="no"
......@@ -957,116 +1070,7 @@ case $targetos in
;;
esac
# find source path
source_path="`dirname \"$0\"`"
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
source_path="`pwd`"
source_path_used="no"
else
source_path="`cd \"$source_path\"; pwd`"
echo "$source_path" | grep -q '[[:blank:]]' &&
die "Out of tree builds are impossible with whitespace in source path."
fi
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
show_help
fi
FFMPEG_CONFIGURATION="$@"
ENCODER_LIST=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"`
DECODER_LIST=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"`
PARSER_LIST=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"`
MUXER_LIST=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"`
DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"`
enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST
die_unknown(){
echo "Unknown option \"$1\"."
echo "See $0 --help for available options."
exit 1
}
for opt do
optval="${opt#*=}"
case "$opt" in
--log)
;;
--log=*) logging="$optval"
;;
--prefix=*) PREFIX="$optval"
;;
--libdir=*) libdir="$optval"
;;
--shlibdir=*) shlibdir="$optval"
;;
--incdir=*) incdir="$optval"
;;
--mandir=*) mandir="$optval"
;;
--source-path=*) source_path="$optval"
;;
--cross-prefix=*) cross_prefix="$optval"
;;
--cross-compile) cross_compile="yes"
;;
--cc=*) cc="$optval"
;;
--make=*) make="$optval"
;;
--extra-cflags=*) add_cflags "$optval"
;;
--extra-ldflags=*) add_ldflags "$optval"
;;
--extra-libs=*) add_extralibs "$optval"
;;
--build-suffix=*) BUILDSUF="$optval"
;;
--arch=*) arch="$optval"
;;
--cpu=*) cpu="$optval"
;;
--enable-mingwce) wince="yes"
;;
--disable-opts) optimize="no"
;;
--enable-small) optimize="small"
;;
--enable-sunmlib) mlib="yes"
;;
--disable-strip) dostrip="no"
;;
--disable-encoders) disable $ENCODER_LIST
;;
--disable-decoders) disable $DECODER_LIST
;;
--disable-muxers) disable $MUXER_LIST
;;
--disable-demuxers) disable $DEMUXER_LIST
;;
--disable-parsers) disable $PARSER_LIST
;;
--enable-*=*|--disable-*=*)
eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
case "$thing" in
encoder|decoder|muxer|demuxer|parser) $action ${optval}_${thing} ;;
*) die_unknown "$opt" ;;
esac
;;
--enable-?*|--disable-?*)
eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
echo "$CMDLINE_SELECT" | grep -q "^ *$option\$" || die_unknown $opt
$action $option
;;
--help) show_help
;;
*)
die_unknown $opt
;;
esac
done
add_extralibs $osextralibs
if ! disabled logging ; then
enabled logging || logfile="$logging"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment