You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

366 lines
9.1KB

  1. #!/bin/sh
  2. #
  3. # ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
  4. #
  5. # set temporary file name
  6. if test ! -z "$TMPDIR" ; then
  7. TMPDIR1="${TMPDIR}"
  8. elif test ! -z "$TEMPDIR" ; then
  9. TMPDIR1="${TEMPDIR}"
  10. else
  11. TMPDIR1="/tmp"
  12. fi
  13. TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  14. TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  15. TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  16. TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  17. # default parameters
  18. prefix="/usr/local"
  19. cross_prefix=""
  20. cc="gcc"
  21. ar="ar"
  22. make="make"
  23. strip="strip"
  24. cpu=`uname -m`
  25. mmx="default"
  26. case "$cpu" in
  27. i386|i486|i586|i686|i86pc|BePC)
  28. cpu="x86"
  29. ;;
  30. armv4l)
  31. cpu="armv4l"
  32. ;;
  33. alpha)
  34. cpu="alpha"
  35. ;;
  36. *)
  37. cpu="unknown"
  38. ;;
  39. esac
  40. gprof="no"
  41. v4l="yes"
  42. audio_oss="yes"
  43. network="yes"
  44. mp3lame="no"
  45. a52="yes"
  46. a52bin="no"
  47. win32="no"
  48. lshared="no"
  49. extralibs="-lm"
  50. simpleidct="yes"
  51. bigendian="no"
  52. # OS specific
  53. targetos=`uname -s`
  54. case $targetos in
  55. BeOS)
  56. prefix="/boot/home/config"
  57. # helps building libavcodec
  58. CFLAGS="-O2 -DPIC"
  59. v4l="no"
  60. # no need for libm, but the inet stuff
  61. # Check for BONE
  62. if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
  63. extralibs="-lbind -lsocket"
  64. else
  65. echo "Not sure building for net_server will succeed... good luck."
  66. extralibs="-lsocket"
  67. fi ;;
  68. BSD/OS)
  69. v4l="no"
  70. audio_oss="yes"
  71. extralibs="-lpoll -lgnugetopt -lm"
  72. make="gmake"
  73. ;;
  74. *) ;;
  75. esac
  76. # find source path
  77. # XXX: we assume an absolute path is given when launching configure,
  78. # except in './configure' case.
  79. source_path=${0%configure}
  80. source_path=${source_path%/}
  81. source_path_used="yes"
  82. if test -z "$source_path" -o "$source_path" = "." ; then
  83. source_path=`pwd`
  84. source_path_used="no"
  85. fi
  86. for opt do
  87. case "$opt" in
  88. --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
  89. ;;
  90. --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  91. ;;
  92. --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  93. ;;
  94. --cc=*) cc=`echo $opt | cut -d '=' -f 2`
  95. ;;
  96. --make=*) make=`echo $opt | cut -d '=' -f 2`
  97. ;;
  98. --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
  99. ;;
  100. --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
  101. ;;
  102. --extra-libs=*) extralibs=${opt#--extra-libs=}
  103. ;;
  104. --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  105. ;;
  106. --disable-mmx) mmx="no"
  107. ;;
  108. --enable-gprof) gprof="yes"
  109. ;;
  110. --disable-v4l) v4l="no"
  111. ;;
  112. --disable-audio-oss) audio_oss="no"
  113. ;;
  114. --disable-network) network="no"
  115. ;;
  116. --disable-a52) a52="no"
  117. ;;
  118. --enable-a52bin) a52bin="yes" ; extralibs="-ldl $extralibs"
  119. ;;
  120. --enable-mp3lame) mp3lame="yes"
  121. ;;
  122. --disable-simple_idct) simpleidct="no"
  123. ;;
  124. --enable-win32) win32="yes"
  125. ;;
  126. --enable-shared) lshared="yes"
  127. ;;
  128. esac
  129. done
  130. # compute mmx state
  131. if test $mmx = "default"; then
  132. if test $cpu = "x86"; then
  133. mmx="yes"
  134. else
  135. mmx="no"
  136. fi
  137. fi
  138. # Checking for CFLAGS
  139. if test -z "$CFLAGS"; then
  140. CFLAGS="-O2"
  141. fi
  142. if test "$win32" = "yes" ; then
  143. cross_prefix="i386-mingw32msvc-"
  144. v4l="no"
  145. audio_oss="no"
  146. network="no"
  147. fi
  148. # endianness : guess with cpu type. Should also use prefix
  149. if test "$cpu" = "powerpc"; then
  150. bigendian="yes"
  151. fi
  152. cc="${cross_prefix}${cc}"
  153. ar="${cross_prefix}${ar}"
  154. strip="${cross_prefix}${strip}"
  155. # ---
  156. # check availability of some header files
  157. cat > $TMPC << EOF
  158. #include <malloc.h>
  159. int main( void ) { return 0; }
  160. EOF
  161. _memalign=no
  162. _malloc_h=no
  163. if $cc -o $TMPO $TMPC 2> /dev/null ; then
  164. _malloc_h=yes
  165. _memalign=yes
  166. # check for memalign - atmos
  167. cat > $TMPC << EOF
  168. #include <malloc.h>
  169. int main ( void ) {
  170. char *string = NULL;
  171. string = memalign(64, sizeof(char));
  172. return 0;
  173. }
  174. EOF
  175. $cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
  176. fi
  177. if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
  178. cat << EOF
  179. Usage: configure [options]
  180. Options: [defaults in brackets after descriptions]
  181. EOF
  182. echo "Standard options:"
  183. echo " --help print this message"
  184. echo " --prefix=PREFIX install in PREFIX [$prefix]"
  185. echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
  186. echo " --enable-win32 enable win32 cross compile"
  187. echo " --disable-a52 disable GPL'ed A52 support [default=no]"
  188. echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
  189. echo " --enable-shared build shared libraries [default=no]"
  190. echo ""
  191. echo "Advanced options (experts only):"
  192. echo " --source-path=PATH path of source code [$source_path]"
  193. echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
  194. echo " --cc=CC use C compiler CC [$cc]"
  195. echo " --make=MAKE use specified make [$make]"
  196. echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
  197. echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
  198. echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
  199. echo " --cpu=CPU force cpu to CPU [$cpu]"
  200. echo " --disable-mmx disable mmx usage"
  201. echo " --disable-audio-oss disable OSS audio support [default=no]"
  202. echo " --disable-v4l disable video4linux grabbing [default=no]"
  203. echo " --disable-network disable network support [default=no]"
  204. echo " --disable-simple_idct disable simple IDCT routines [default=no]"
  205. echo " --enable-gprof enable profiling with gprof [$gprof]"
  206. echo ""
  207. echo "NOTE: The object files are build at the place where configure is launched"
  208. exit 1
  209. fi
  210. echo "Install prefix $prefix"
  211. echo "Source path $source_path"
  212. echo "C compiler $cc"
  213. echo "make $make"
  214. echo "CPU $cpu"
  215. echo "Big Endian $bigendian"
  216. echo "MMX enabled $mmx"
  217. echo "gprof enabled $gprof"
  218. echo "mp3lame enabled $mp3lame"
  219. echo "a52 support $a52"
  220. echo "a52 dlopened $a52bin"
  221. echo "Creating config.mak and config.h"
  222. echo "# Automatically generated by configure - do not modify" > config.mak
  223. echo "/* Automatically generated by configure - do not modify */" > $TMPH
  224. echo "prefix=$prefix" >> config.mak
  225. echo "MAKE=$make" >> config.mak
  226. echo "CC=$cc" >> config.mak
  227. echo "AR=$ar" >> config.mak
  228. echo "STRIP=$strip" >> config.mak
  229. echo "OPTFLAGS=$CFLAGS" >> config.mak
  230. echo "LDFLAGS=$LDFLAGS" >> config.mak
  231. if test "$cpu" = "x86" ; then
  232. echo "TARGET_ARCH_X86=yes" >> config.mak
  233. echo "#define ARCH_X86 1" >> $TMPH
  234. elif test "$cpu" = "armv4l" ; then
  235. echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
  236. echo "#define ARCH_ARMV4L 1" >> $TMPH
  237. elif test "$cpu" = "alpha" ; then
  238. echo "TARGET_ARCH_ALPHA=yes" >> config.mak
  239. echo "#define ARCH_ALPHA 1" >> $TMPH
  240. elif test "$cpu" = "powerpc" ; then
  241. echo "TARGET_ARCH_POWERPC=yes" >> config.mak
  242. echo "#define ARCH_POWERPC 1" >> $TMPH
  243. fi
  244. if test "$bigendian" = "yes" ; then
  245. echo "WORDS_BIGENDIAN=yes" >> config.mak
  246. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  247. fi
  248. if test "$mmx" = "yes" ; then
  249. echo "TARGET_MMX=yes" >> config.mak
  250. echo "#define HAVE_MMX 1" >> $TMPH
  251. fi
  252. if test "$gprof" = "yes" ; then
  253. echo "TARGET_GPROF=yes" >> config.mak
  254. echo "#define HAVE_GPROF 1" >> $TMPH
  255. fi
  256. if test "$lshared" = "yes" ; then
  257. echo "BUILD_SHARED=yes" >> config.mak
  258. echo "PIC=-fPIC" >> config.mak
  259. fi
  260. echo "EXTRALIBS=$extralibs" >> config.mak
  261. echo -n "VERSION=" >>config.mak
  262. head $source_path/VERSION >>config.mak
  263. echo "" >>config.mak
  264. # if you do not want to use encoders, disable that.
  265. echo "#define CONFIG_ENCODERS 1" >> $TMPH
  266. echo "CONFIG_ENCODERS=yes" >> config.mak
  267. # if you do not want to use decoders, disable that.
  268. echo "#define CONFIG_DECODERS 1" >> $TMPH
  269. echo "CONFIG_DECODERS=yes" >> config.mak
  270. # AC3
  271. if test "$a52" = "yes" ; then
  272. echo "#define CONFIG_AC3 1" >> $TMPH
  273. echo "CONFIG_AC3=yes" >> config.mak
  274. if test "$a52bin" = "yes" ; then
  275. echo "#define CONFIG_A52BIN 1" >> $TMPH
  276. echo "CONFIG_A52BIN=yes" >> config.mak
  277. fi
  278. fi
  279. if test "$v4l" = "yes" ; then
  280. echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
  281. echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
  282. fi
  283. if test "$audio_oss" = "yes" ; then
  284. echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
  285. echo "CONFIG_AUDIO_OSS=yes" >> config.mak
  286. fi
  287. if test "$network" = "yes" ; then
  288. echo "#define CONFIG_NETWORK 1" >> $TMPH
  289. echo "CONFIG_NETWORK=yes" >> config.mak
  290. fi
  291. if test "$mp3lame" = "yes" ; then
  292. echo "#define CONFIG_MP3LAME 1" >> $TMPH
  293. echo "CONFIG_MP3LAME=yes" >> config.mak
  294. fi
  295. if test "$win32" = "yes" ; then
  296. echo "#define CONFIG_WIN32 1" >> $TMPH
  297. echo "CONFIG_WIN32=yes" >> config.mak
  298. fi
  299. if test "$_malloc_h" = "yes" ; then
  300. echo "#define HAVE_MALLOC_H 1" >> $TMPH
  301. else
  302. echo "#undef HAVE_MALLOC_H" >> $TMPH
  303. fi
  304. if test "$_memalign" = "yes" ; then
  305. echo "#define HAVE_MEMALIGN 1" >> $TMPH
  306. else
  307. echo "#undef HAVE_MEMALIGN" >> $TMPH
  308. fi
  309. if test "$simpleidct" = "yes" ; then
  310. echo "#define SIMPLE_IDCT 1" >> $TMPH
  311. fi
  312. # build tree in object directory if source path is different from current one
  313. if test "$source_path_used" = "yes" ; then
  314. DIRS="libav libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
  315. libavcodec/liba52 libavcodec/mlib tests"
  316. FILES="Makefile libav/Makefile libavcodec/Makefile tests/Makefile"
  317. for dir in $DIRS ; do
  318. mkdir -p $dir
  319. done
  320. for f in $FILES ; do
  321. ln -sf $source_path/$f $f
  322. done
  323. fi
  324. echo "SRC_PATH=$source_path" >> config.mak
  325. diff $TMPH config.h >/dev/null 2>&1
  326. if test $? -ne 0 ; then
  327. mv -f $TMPH config.h
  328. else
  329. echo "config.h is unchanged"
  330. fi
  331. rm -f $TMPO $TMPC $TMPS $TMPH