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.

1256 lines
30KB

  1. #!/bin/sh
  2. #
  3. # ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
  4. #
  5. if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
  6. cat << EOF
  7. Usage: configure [options]
  8. Options: [defaults in brackets after descriptions]
  9. EOF
  10. echo "Standard options:"
  11. echo " --help print this message"
  12. echo " --prefix=PREFIX install in PREFIX [$prefix]"
  13. echo " --mandir=DIR man documentation in DIR [PREFIX/man]"
  14. echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
  15. echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
  16. echo " --enable-faad enable faad support via libfaad [default=no]"
  17. echo " --enable-faadbin build faad support with runtime linking [default=no]"
  18. echo " --enable-faac enable faac support via libfaac [default=no]"
  19. echo " --enable-mingw32 enable mingw32 native/cross windows compile"
  20. echo " --enable-a52 enable GPL'ed A52 support [default=no]"
  21. echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
  22. echo " --enable-pp enable GPL'ed post processing support [default=no]"
  23. echo " --enable-shared-pp use libpostproc.so [default=no]"
  24. echo " --enable-shared build shared libraries [default=no]"
  25. echo " --enable-amr_nb enable amr_nb float audio codec"
  26. echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
  27. echo " --enable-sunmlib use Sun medialib [default=no]"
  28. echo ""
  29. echo "Advanced options (experts only):"
  30. echo " --source-path=PATH path of source code [$source_path]"
  31. echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
  32. echo " --cc=CC use C compiler CC [$cc]"
  33. echo " --make=MAKE use specified make [$make]"
  34. echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
  35. echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
  36. echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
  37. echo " --cpu=CPU force cpu to CPU [$cpu]"
  38. echo " --tune=PROCESSOR tune code for a particular CPU (may fails or misperforms on other CPUs)"
  39. echo " --powerpc-perf-enable enable performance report on PPC (requires enabling PMC)"
  40. echo " --disable-mmx disable mmx usage"
  41. echo " --disable-altivec disable AltiVec usage"
  42. echo " --disable-audio-oss disable OSS audio support [default=no]"
  43. echo " --disable-audio-beos disable BeOS audio support [default=no]"
  44. echo " --disable-v4l disable video4linux grabbing [default=no]"
  45. echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
  46. echo " --disable-network disable network support [default=no]"
  47. echo " --disable-zlib disable zlib [default=no]"
  48. echo " --disable-simple_idct disable simple IDCT routines [default=no]"
  49. echo " --disable-vhook disable video hooking support"
  50. echo " --enable-gprof enable profiling with gprof [$gprof]"
  51. echo " --disable-debug disable debugging symbols"
  52. echo " --disable-opts disable compiler optimizations"
  53. echo " --disable-mpegaudio-hp faster (but less accurate)"
  54. echo " mpegaudio decoding [default=no]"
  55. echo " --disable-ffserver disable ffserver build"
  56. echo " --disable-ffplay disable ffplay build"
  57. echo " --disable-risky disables patent encumbered codecs"
  58. echo " --enable-small optimize for size instead of speed"
  59. echo ""
  60. echo "NOTE: The object files are build at the place where configure is launched"
  61. exit 1
  62. fi
  63. # set temporary file name
  64. if test ! -z "$TMPDIR" ; then
  65. TMPDIR1="${TMPDIR}"
  66. elif test ! -z "$TEMPDIR" ; then
  67. TMPDIR1="${TEMPDIR}"
  68. else
  69. TMPDIR1="/tmp"
  70. fi
  71. TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
  72. TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
  73. TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
  74. TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
  75. TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
  76. # default parameters
  77. prefix="/usr/local"
  78. mandir=""
  79. bindir=""
  80. cross_prefix=""
  81. cc="gcc"
  82. ar="ar"
  83. ranlib="ranlib"
  84. make="make"
  85. strip="strip"
  86. cpu=`uname -m`
  87. tune="generic"
  88. powerpc_perf="no"
  89. mmx="default"
  90. altivec="default"
  91. mmi="default"
  92. case "$cpu" in
  93. i386|i486|i586|i686|i86pc|BePC)
  94. cpu="x86"
  95. ;;
  96. # armv4l is a subset of armv5tel
  97. armv4l|armv5tel)
  98. cpu="armv4l"
  99. ;;
  100. alpha)
  101. cpu="alpha"
  102. ;;
  103. "Power Macintosh"|ppc)
  104. cpu="powerpc"
  105. ;;
  106. mips)
  107. cpu="mips"
  108. ;;
  109. sun4u)
  110. cpu="sparc64"
  111. ;;
  112. sh4)
  113. cpu="sh4"
  114. ;;
  115. *)
  116. cpu="unknown"
  117. ;;
  118. esac
  119. gprof="no"
  120. v4l="yes"
  121. audio_oss="yes"
  122. audio_beos="no"
  123. dv1394="yes"
  124. network="yes"
  125. zlib="yes"
  126. mp3lame="no"
  127. vorbis="no"
  128. faad="no"
  129. faadbin="no"
  130. faac="no"
  131. a52="no"
  132. a52bin="no"
  133. pp="no"
  134. shared_pp="no"
  135. mingw32="no"
  136. cygwin="no"
  137. os2="no"
  138. lshared="no"
  139. optimize="yes"
  140. debug="yes"
  141. extralibs="-lm"
  142. simpleidct="yes"
  143. bigendian="no"
  144. emu_fast_int="no"
  145. vhook="default"
  146. dlfcn="no"
  147. dlopen="no"
  148. mpegaudio_hp="yes"
  149. SHFLAGS=-shared
  150. netserver="no"
  151. need_inet_aton="no"
  152. ffserver="yes"
  153. ffplay="yes"
  154. LDFLAGS=-Wl,--warn-common
  155. FFSLDFLAGS=-Wl,-E
  156. LIBPREF="lib"
  157. LIBSUF=".a"
  158. SLIBPREF="lib"
  159. SLIBSUF=".so"
  160. EXESUF=""
  161. risky="yes"
  162. amr_nb="no"
  163. amr_wb="no"
  164. amr_nb_fixed="no"
  165. sunmlib="no"
  166. # OS specific
  167. targetos=`uname -s`
  168. case $targetos in
  169. BeOS)
  170. prefix="/boot/home/config"
  171. # helps building libavcodec
  172. CFLAGS="-DPIC -fomit-frame-pointer"
  173. # 3 gcc releases known for BeOS, each with ugly bugs
  174. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  175. case "$gcc_version" in
  176. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  177. mmx="no"
  178. ;;
  179. *20010315*) echo "BeBits gcc"
  180. CFLAGS="$CFLAGS -fno-expensive-optimizations"
  181. ;;
  182. esac
  183. SHFLAGS=-nostart
  184. # disable linux things
  185. audio_oss="no"
  186. v4l="no"
  187. dv1394="no"
  188. # enable beos things
  189. audio_beos="yes"
  190. # no need for libm, but the inet stuff
  191. # Check for BONE
  192. if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
  193. extralibs="-lbind -lsocket"
  194. else
  195. netserver="yes"
  196. need_inet_aton="yes"
  197. extralibs="-lnet"
  198. fi ;;
  199. SunOS)
  200. v4l="no"
  201. audio_oss="no"
  202. dv1394="no"
  203. make="gmake"
  204. LDFLAGS=""
  205. FFSLDFLAGS=""
  206. need_inet_aton="yes"
  207. extralibs="$extralibs -lsocket -lnsl"
  208. ;;
  209. FreeBSD)
  210. v4l="no"
  211. audio_oss="yes"
  212. dv1394="no"
  213. make="gmake"
  214. LDFLAGS="$LDFLAGS -export-dynamic"
  215. ;;
  216. BSD/OS)
  217. v4l="no"
  218. audio_oss="yes"
  219. dv1394="no"
  220. extralibs="-lpoll -lgnugetopt -lm"
  221. make="gmake"
  222. ;;
  223. Darwin)
  224. cc="cc"
  225. v4l="no"
  226. audio_oss="no"
  227. dv1394="no"
  228. ffserver="no"
  229. SHFLAGS="-dynamiclib"
  230. extralibs=""
  231. darwin="yes"
  232. strip="strip -x"
  233. LDFLAGS="-d"
  234. FFSLDFLAGS=-Wl,-bind_at_load
  235. ;;
  236. MINGW32*)
  237. # Note: the rest of the mingw32 config is done afterwards as mingw32
  238. # can be forced on command line for linux cross compilation
  239. mingw32="yes"
  240. ;;
  241. CYGWIN*)
  242. v4l="no"
  243. audio_oss="yes"
  244. dv1394="no"
  245. extralibs=""
  246. cygwin="yes"
  247. test -f /usr/include/inttypes.h || \
  248. test -f /usr/local/include/inttypes.h || \
  249. echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
  250. "/usr/include/inttypes.h !!!"
  251. ;;
  252. Linux)
  253. LDFLAGS="$LDFLAGS -rdynamic"
  254. ;;
  255. IRIX*)
  256. ranlib="echo ignoring ranlib"
  257. v4l="no"
  258. audio_oss="no"
  259. make="gmake"
  260. ;;
  261. OS/2)
  262. TMPE=$TMPE".exe"
  263. ar="emxomfar -p64"
  264. ranlib="echo ignoring ranlib"
  265. strip="echo ignoring strip"
  266. CFLAGS="-Zomf"
  267. LDFLAGS="-Zomf -Zstack 16384 -s"
  268. SHFLAGS=""
  269. FFSLDFLAGS=""
  270. LIBPREF=""
  271. LIBSUF=".lib"
  272. SLIBPREF=""
  273. SLIBSUF=".dll"
  274. EXESUF=".exe"
  275. extralibs=""
  276. v4l="no"
  277. audio_oss="no"
  278. dv1394="no"
  279. network="no"
  280. ffserver="no"
  281. os2="yes"
  282. ;;
  283. *) ;;
  284. esac
  285. # From mplayer configure. We need TARGET_OS available
  286. # to the Makefile, so it can distinguish between flavors
  287. # of AltiVec on PowerPC
  288. TARGET_OS=`( uname -s ) 2>&1`
  289. case "$TARGET_OS" in
  290. Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
  291. ;;
  292. IRIX*)
  293. TARGET_OS=IRIX
  294. ;;
  295. HP-UX*)
  296. TARGET_OS=HP-UX
  297. ;;
  298. [cC][yY][gG][wW][iI][nN]*)
  299. TARGET_OS=CYGWIN
  300. ;;
  301. *)
  302. TARGET_OS="$TARGET_OS-UNKNOWN"
  303. ;;
  304. esac
  305. # find source path
  306. # XXX: we assume an absolute path is given when launching configure,
  307. # except in './configure' case.
  308. source_path="`echo $0 | sed -e 's#/configure##'`"
  309. source_path_used="yes"
  310. if test -z "$source_path" -o "$source_path" = "." ; then
  311. source_path=`pwd`
  312. source_path_used="no"
  313. fi
  314. for opt do
  315. case "$opt" in
  316. --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
  317. ;;
  318. --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
  319. ;;
  320. --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  321. ;;
  322. --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  323. ;;
  324. --cc=*) cc=`echo $opt | cut -d '=' -f 2`
  325. ;;
  326. --make=*) make=`echo $opt | cut -d '=' -f 2`
  327. ;;
  328. --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
  329. ;;
  330. --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
  331. ;;
  332. --extra-libs=*) extralibs=${opt#--extra-libs=}
  333. ;;
  334. --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  335. ;;
  336. --tune=*) tune=`echo $opt | cut -d '=' -f 2`
  337. ;;
  338. --powerpc-perf-enable) powerpc_perf="yes"
  339. ;;
  340. --disable-mmx) mmx="no"
  341. ;;
  342. --disable-altivec) altivec="no"
  343. ;;
  344. --enable-gprof) gprof="yes"
  345. ;;
  346. --disable-v4l) v4l="no"
  347. ;;
  348. --disable-audio-oss) audio_oss="no"
  349. ;;
  350. --disable-audio-beos) audio_beos="no"
  351. ;;
  352. --disable-dv1394) dv1394="no"
  353. ;;
  354. --disable-network) network="no"
  355. ;;
  356. --disable-zlib) zlib="no"
  357. ;;
  358. --enable-a52) a52="yes"
  359. ;;
  360. --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
  361. ;;
  362. --enable-pp) pp="yes"
  363. ;;
  364. --enable-shared-pp) shared_pp="yes"
  365. ;;
  366. --enable-mp3lame) mp3lame="yes"
  367. ;;
  368. --enable-vorbis) vorbis="yes"
  369. ;;
  370. --enable-faad) faad="yes"
  371. ;;
  372. --enable-faadbin) faadbin="yes"
  373. ;;
  374. --enable-faac) faac="yes"
  375. ;;
  376. --disable-vhook) vhook="no"
  377. ;;
  378. --disable-simple_idct) simpleidct="no"
  379. ;;
  380. --enable-mingw32) mingw32="yes"
  381. ;;
  382. --enable-shared) lshared="yes"
  383. ;;
  384. --disable-debug) debug="no"
  385. ;;
  386. --disable-opts) optimize="no"
  387. ;;
  388. --disable-mpegaudio-hp) mpegaudio_hp="no"
  389. ;;
  390. --disable-ffserver) ffserver="no"
  391. ;;
  392. --disable-ffplay) ffplay="no"
  393. ;;
  394. --disable-risky) risky="no"
  395. ;;
  396. --enable-small) optimize="small"
  397. ;;
  398. --enable-amr_nb) amr_nb="yes"
  399. ;;
  400. --enable-amr_nb-fixed) amr_nb_fixed="yes"
  401. ;;
  402. --enable-sunmlib) sunmlib="yes"
  403. ;;
  404. esac
  405. done
  406. # compute mmx state
  407. if test $mmx = "default"; then
  408. if test $cpu = "x86"; then
  409. mmx="yes"
  410. else
  411. mmx="no"
  412. fi
  413. fi
  414. #Darwin CC versions
  415. needmdynamicnopic="no"
  416. if test $targetos = Darwin; then
  417. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  418. CFLAGS="-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
  419. else
  420. gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
  421. case "$gcc_version" in
  422. *2.95*)
  423. CFLAGS="-no-cpp-precomp -pipe -fomit-frame-pointer"
  424. ;;
  425. *3.*)
  426. CFLAGS="-no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
  427. if test "$lshared" = no; then
  428. needmdynamicnopic="yes"
  429. fi
  430. ;;
  431. *)
  432. CFLAGS="-no-cpp-precomp -pipe -fomit-frame-pointer"
  433. if test "$lshared" = no; then
  434. needmdynamicnopic="yes"
  435. fi
  436. ;;
  437. esac
  438. fi
  439. fi
  440. # Can only do AltiVec on PowerPC
  441. if test $altivec = "default"; then
  442. if test $cpu = "powerpc"; then
  443. altivec="yes"
  444. else
  445. altivec="no"
  446. fi
  447. fi
  448. # Add processor-specific flags
  449. TUNECPU="generic"
  450. if test $tune != "generic"; then
  451. case $tune in
  452. 601|ppc601|PowerPC601)
  453. CFLAGS="$CFLAGS -mcpu=601"
  454. if test $altivec = "yes"; then
  455. echo "WARNING: tuning for PPC601 but altivec enabled !";
  456. fi
  457. TUNECPU=ppc601
  458. ;;
  459. 603*|ppc603*|PowerPC603*)
  460. CFLAGS="$CFLAGS -mcpu=603"
  461. if test $altivec = "yes"; then
  462. echo "WARNING: tuning for PPC603 but altivec enabled !";
  463. fi
  464. TUNECPU=ppc603
  465. ;;
  466. 604*|ppc604*|PowerPC604*)
  467. CFLAGS="$CFLAGS -mcpu=604"
  468. if test $altivec = "yes"; then
  469. echo "WARNING: tuning for PPC604 but altivec enabled !";
  470. fi
  471. TUNECPU=ppc604
  472. ;;
  473. G3|g3|75*|ppc75*|PowerPC75*)
  474. CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
  475. if test $altivec = "yes"; then
  476. echo "WARNING: tuning for PPC75x but altivec enabled !";
  477. fi
  478. TUNECPU=ppc750
  479. ;;
  480. G4|g4|745*|ppc745*|PowerPC745*)
  481. CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
  482. if test $altivec = "no"; then
  483. echo "WARNING: tuning for PPC745x but altivec disabled !";
  484. fi
  485. TUNECPU=ppc7450
  486. ;;
  487. 74*|ppc74*|PowerPC74*)
  488. CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
  489. if test $altivec = "no"; then
  490. echo "WARNING: tuning for PPC74xx but altivec disabled !";
  491. fi
  492. TUNECPU=ppc7400
  493. ;;
  494. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  495. CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc64 -force_cpusubtype_ALL "
  496. if test $altivec = "no"; then
  497. echo "WARNING: tuning for PPC970 but altivec disabled !";
  498. fi
  499. TUNECPU=ppc970
  500. ;;
  501. *)
  502. echo "WARNING: unknown CPU "$tune", ignored"
  503. ;;
  504. esac
  505. fi
  506. # AltiVec flags: The FSF version of GCC differs from the Apple version
  507. if test $cpu = "powerpc"; then
  508. if test $altivec = "yes"; then
  509. if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
  510. CFLAGS="$CFLAGS -faltivec"
  511. else
  512. CFLAGS="$CFLAGS -maltivec -mabi=altivec"
  513. fi
  514. fi
  515. fi
  516. # See if we have <altivec.h>
  517. cat > $TMPC << EOF
  518. #include <altivec.h>
  519. int main( void ) { return 0; }
  520. EOF
  521. _altivec_h="no"
  522. if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
  523. _altivec_h="yes"
  524. fi
  525. # See does our compiler support Motorola AltiVec C API
  526. if test $altivec = "yes"; then
  527. if test $_altivec_h = "yes"; then
  528. cat > $TMPC << EOF
  529. #include <altivec.h>
  530. int main(void) {
  531. vector signed int v1, v2, v3;
  532. v1 = vec_add(v2,v3);
  533. return 0;
  534. }
  535. EOF
  536. else
  537. cat > $TMPC << EOF
  538. int main(void) {
  539. vector signed int v1, v2, v3;
  540. v1 = vec_add(v2,v3);
  541. return 0;
  542. }
  543. EOF
  544. fi
  545. $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
  546. fi
  547. # Can only do mmi on mips
  548. if test $mmi = "default"; then
  549. if test $cpu = "mips"; then
  550. mmi="yes"
  551. else
  552. mmi="no"
  553. fi
  554. fi
  555. # See does our compiler support mmi
  556. if test $mmi = "yes"; then
  557. cat > $TMPC << EOF
  558. int main(void) {
  559. __asm__ ("lq \$2, 0(\$2)");
  560. return 0;
  561. }
  562. EOF
  563. $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
  564. fi
  565. if test "$mingw32" = "yes" ; then
  566. v4l="no"
  567. audio_oss="no"
  568. dv1394="no"
  569. ffserver="no"
  570. network="no"
  571. LIBPREF=""
  572. LIBSUF=".lib"
  573. SLIBPREF=""
  574. SLIBSUF=".dll"
  575. EXESUF=".exe"
  576. prefix="/c/Program Files/FFmpeg"
  577. bindir="$prefix"
  578. fi
  579. cc="${cross_prefix}${cc}"
  580. ar="${cross_prefix}${ar}"
  581. ranlib="${cross_prefix}${ranlib}"
  582. strip="${cross_prefix}${strip}"
  583. if test -z "$cross_prefix" ; then
  584. # ---
  585. # big/little endian test
  586. cat > $TMPC << EOF
  587. #include <inttypes.h>
  588. int main(int argc, char ** argv){
  589. volatile uint32_t i=0x01234567;
  590. return (*((uint8_t*)(&i))) == 0x67;
  591. }
  592. EOF
  593. if $cc -o $TMPE $TMPC 2>/dev/null ; then
  594. $TMPE && bigendian="yes"
  595. else
  596. echo big/little test failed
  597. fi
  598. else
  599. # if cross compiling, cannot launch a program, so make a static guess
  600. if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
  601. bigendian="yes"
  602. fi
  603. fi
  604. # ---
  605. # *int_fast* test
  606. cat > $TMPC << EOF
  607. #include <inttypes.h>
  608. int main(int argc, char ** argv){
  609. volatile uint_fast64_t i=0x01234567;
  610. return 0;
  611. }
  612. EOF
  613. $cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
  614. # ---
  615. # check availability of some header files
  616. cat > $TMPC << EOF
  617. #include <malloc.h>
  618. int main( void ) { return 0; }
  619. EOF
  620. _memalign=no
  621. _malloc_h=no
  622. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  623. _malloc_h=yes
  624. _memalign=yes
  625. # check for memalign - atmos
  626. cat > $TMPC << EOF
  627. #include <malloc.h>
  628. int main ( void ) {
  629. char *string = NULL;
  630. string = memalign(64, sizeof(char));
  631. return 0;
  632. }
  633. EOF
  634. $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
  635. fi
  636. cat > $TMPC << EOF
  637. #include <time.h>
  638. int main( void ) { localtime_r(NULL, NULL); }
  639. EOF
  640. localtime_r=no
  641. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  642. localtime_r=yes
  643. fi
  644. if test "$zlib" = "yes"; then
  645. # check for zlib - mmu_man
  646. cat > $TMPC << EOF
  647. #include <zlib.h>
  648. int main ( void ) {
  649. if (zlibVersion() != ZLIB_VERSION)
  650. puts("zlib version differs !!!");
  651. return 1;
  652. return 0;
  653. }
  654. EOF
  655. $cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
  656. # $TMPE 2> /dev/null > /dev/null || zlib="no"
  657. # XXX: more tests needed - runtime test
  658. fi
  659. if test "$zlib" = "yes"; then
  660. extralibs="$extralibs -lz"
  661. fi
  662. # test for lrintf in math.h
  663. cat > $TMPC << EOF
  664. #define _ISOC9X_SOURCE 1
  665. #include <math.h>
  666. int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
  667. EOF
  668. have_lrintf="no"
  669. if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
  670. have_lrintf="yes"
  671. $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
  672. fi
  673. _restrict=
  674. for restrict_keyword in restrict __restrict__ __restrict; do
  675. echo "void foo(char * $restrict_keyword p);" > $TMPC
  676. if $cc -c -o $TMPO $TMPC 2> /dev/null; then
  677. _restrict=$restrict_keyword
  678. break;
  679. fi
  680. done
  681. # test gcc version to see if vector builtins can be used
  682. # currently only used on i386 for MMX builtins
  683. cat > $TMPC << EOF
  684. int main(void) {
  685. #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
  686. return 0;
  687. #else
  688. #error no vector builtins
  689. #endif
  690. }
  691. EOF
  692. builtin_vector=no
  693. if $cc -o $TMPO $TMPC 2> /dev/null ; then
  694. builtin_vector=yes
  695. fi
  696. # dlopen/dlfcn.h probing
  697. cat > $TMPC << EOF
  698. #include <dlfcn.h>
  699. int main( void ) { return (int) dlopen("foo", 0); }
  700. EOF
  701. ldl=-ldl
  702. if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
  703. dlfcn=yes
  704. dlopen=yes
  705. fi
  706. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  707. dlfcn=yes
  708. dlopen=yes
  709. ldl=""
  710. fi
  711. cat > $TMPC << EOF
  712. int main( void ) { return (int) dlopen("foo", 0); }
  713. EOF
  714. if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
  715. dlopen=yes
  716. fi
  717. if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
  718. dlopen=yes
  719. ldl=""
  720. fi
  721. if test "$vhook" = "default" ; then
  722. vhook="$dlopen"
  723. fi
  724. ##########################################
  725. # imlib probe
  726. cat > $TMPC << EOF
  727. #include <X11/Xlib.h>
  728. #include <Imlib2.h>
  729. int main( void ) { return (int) imlib_load_font("foo"); }
  730. EOF
  731. imlib2=no
  732. if $cc -o $TMPE $TMPC -lImlib2 > /dev/null 2>&1 ; then
  733. imlib2=yes
  734. fi
  735. ##########################################
  736. # freetype probe
  737. cat > $TMPC << EOF
  738. #include <ft2build.h>
  739. int main( void ) { return (int) FT_Init_FreeType(0); }
  740. EOF
  741. freetype2=no
  742. if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
  743. if test "`which freetype-config`" != ""; then
  744. if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` > /dev/null 2>&1 ; then
  745. freetype2=yes
  746. fi
  747. fi
  748. fi
  749. ##########################################
  750. # SDL probe
  751. cat > $TMPC << EOF
  752. #include <SDL.h>
  753. #undef main /* We don't want SDL to override our main() */
  754. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  755. EOF
  756. sdl_too_old=no
  757. sdl=no
  758. if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` > /dev/null 2>&1 ; then
  759. _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
  760. if test "$_sdlversion" -lt 121 ; then
  761. sdl_too_old=yes
  762. else
  763. sdl=yes
  764. fi
  765. fi
  766. case "`$cc -v 2>&1 | grep version`" in
  767. *gcc*)
  768. CFLAGS="-Wall $CFLAGS"
  769. ;;
  770. *)
  771. ;;
  772. esac
  773. if test "$sdl" = "no" ; then
  774. ffplay=no
  775. fi
  776. if test "$debug" = "yes"; then
  777. CFLAGS="$CFLAGS -g"
  778. fi
  779. if test "$optimize" = "small"; then
  780. # CFLAGS=${CFLAGS//-O3/-Os}
  781. CFLAGS="$CFLAGS -Os"
  782. fi
  783. if test "$optimize" = "yes"; then
  784. if test -n "`$cc -v 2>&1 | grep xlc`"; then
  785. CFLAGS="$CFLAGS -O5"
  786. LDFLAGS="$LDFLAGS -O5"
  787. else
  788. CFLAGS="$CFLAGS -O3"
  789. fi
  790. fi
  791. if test x"$bindir" = x""; then
  792. bindir="${prefix}/bin"
  793. fi
  794. if test x"$mandir" = x""; then
  795. mandir="${prefix}/man"
  796. fi
  797. echo "Install prefix $prefix"
  798. echo "Source path $source_path"
  799. echo "C compiler $cc"
  800. echo "make $make"
  801. echo "CPU $cpu ($tune)"
  802. echo "Big Endian $bigendian"
  803. echo "broken inttypes.h $emu_fast_int"
  804. if test $cpu = "x86"; then
  805. echo "MMX enabled $mmx"
  806. echo "Vector Builtins $builtin_vector"
  807. fi
  808. if test $cpu = "mips"; then
  809. echo "MMI enabled $mmi"
  810. fi
  811. if test $cpu = "powerpc"; then
  812. echo "AltiVec enabled $altivec"
  813. fi
  814. echo "gprof enabled $gprof"
  815. echo "zlib enabled $zlib"
  816. echo "mp3lame enabled $mp3lame"
  817. echo "vorbis enabled $vorbis"
  818. echo "faad enabled $faad"
  819. echo "faadbin enabled $faadbin"
  820. echo "faac enabled $faac"
  821. echo "a52 support $a52"
  822. echo "a52 dlopened $a52bin"
  823. echo "pp support $pp"
  824. echo "debug symbols $debug"
  825. echo "optimize $optimize"
  826. echo "shared pp $shared_pp"
  827. echo "Video hooking $vhook"
  828. echo "SDL support $sdl"
  829. if test $sdl_too_old = "yes"; then
  830. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
  831. fi
  832. echo "risky / patent encumbered codecs $risky"
  833. if test "$vhook" = "yes" ; then
  834. echo "Imlib2 support $imlib2"
  835. echo "freetype support $freetype2"
  836. fi
  837. echo "Sun medialib support" $sunmlib
  838. echo "AMR-NB float support" $amr_nb
  839. echo "AMR-NB fixed support" $amr_nb_fixed
  840. echo "AMR-WB float support" $amr_wb
  841. echo "Creating config.mak and config.h"
  842. echo "# Automatically generated by configure - do not modify" > config.mak
  843. echo "/* Automatically generated by configure - do not modify */" > $TMPH
  844. echo "prefix=$prefix" >> config.mak
  845. echo "bindir=$bindir" >> config.mak
  846. echo "mandir=$mandir" >> config.mak
  847. echo "MAKE=$make" >> config.mak
  848. echo "CC=$cc" >> config.mak
  849. echo "AR=$ar" >> config.mak
  850. echo "RANLIB=$ranlib" >> config.mak
  851. echo "STRIP=$strip" >> config.mak
  852. # SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic. Used when building
  853. # shared modules on OS/X (vhook/Makefile).
  854. SHCFLAGS=$CFLAGS
  855. if test "$needmdynamicnopic" = yes; then
  856. CFLAGS="$CFLAGS -mdynamic-no-pic"
  857. fi
  858. echo "OPTFLAGS=$CFLAGS" >> config.mak
  859. echo "SHCFLAGS=$SHCFLAGS">>config.mak
  860. echo "LDFLAGS=$LDFLAGS" >> config.mak
  861. echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
  862. echo "SHFLAGS=$SHFLAGS" >> config.mak
  863. echo "LIBPREF=$LIBPREF" >> config.mak
  864. echo "LIBSUF=$LIBSUF" >> config.mak
  865. echo "SLIBPREF=$SLIBPREF" >> config.mak
  866. echo "SLIBSUF=$SLIBSUF" >> config.mak
  867. echo "EXESUF=$EXESUF" >> config.mak
  868. echo "TARGET_OS=$TARGET_OS" >> config.mak
  869. if test "$cpu" = "x86" ; then
  870. echo "TARGET_ARCH_X86=yes" >> config.mak
  871. echo "#define ARCH_X86 1" >> $TMPH
  872. elif test "$cpu" = "armv4l" ; then
  873. echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
  874. echo "#define ARCH_ARMV4L 1" >> $TMPH
  875. elif test "$cpu" = "alpha" ; then
  876. echo "TARGET_ARCH_ALPHA=yes" >> config.mak
  877. echo "#define ARCH_ALPHA 1" >> $TMPH
  878. elif test "$cpu" = "sparc64" ; then
  879. echo "TARGET_ARCH_SPARC64=yes" >> config.mak
  880. echo "#define ARCH_SPARC64 1" >> $TMPH
  881. elif test "$cpu" = "powerpc" ; then
  882. echo "TARGET_ARCH_POWERPC=yes" >> config.mak
  883. echo "#define ARCH_POWERPC 1" >> $TMPH
  884. if test "$powerpc_perf" = "yes"; then
  885. echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
  886. fi
  887. elif test "$cpu" = "mips" ; then
  888. echo "TARGET_ARCH_MIPS=yes" >> config.mak
  889. echo "#define ARCH_MIPS 1" >> $TMPH
  890. elif test "$cpu" = "sh4" ; then
  891. echo "TARGET_ARCH_SH4=yes" >> config.mak
  892. echo "#define ARCH_SH4 1" >> $TMPH
  893. fi
  894. echo "#define TUNECPU $TUNECPU" >> $TMPH
  895. if test "$bigendian" = "yes" ; then
  896. echo "WORDS_BIGENDIAN=yes" >> config.mak
  897. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  898. fi
  899. if test "$emu_fast_int" = "yes" ; then
  900. echo "#define EMULATE_FAST_INT 1" >> $TMPH
  901. fi
  902. if test "$mmx" = "yes" ; then
  903. echo "TARGET_MMX=yes" >> config.mak
  904. echo "#define HAVE_MMX 1" >> $TMPH
  905. echo "#define __CPU__ 586" >> $TMPH
  906. fi
  907. if test "$builtin_vector" = "yes" ; then
  908. echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
  909. echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
  910. fi
  911. if test "$mmi" = "yes" ; then
  912. echo "TARGET_MMI=yes" >> config.mak
  913. echo "#define HAVE_MMI 1" >> $TMPH
  914. fi
  915. if test "$altivec" = "yes" ; then
  916. echo "TARGET_ALTIVEC=yes" >> config.mak
  917. echo "#define HAVE_ALTIVEC 1" >> $TMPH
  918. echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
  919. echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
  920. if test "$_altivec_h" = "yes" ; then
  921. echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
  922. else
  923. echo "#undef HAVE_ALTIVEC_H" >> $TMPH
  924. fi
  925. fi
  926. if test "$gprof" = "yes" ; then
  927. echo "TARGET_GPROF=yes" >> config.mak
  928. echo "#define HAVE_GPROF 1" >> $TMPH
  929. fi
  930. if test "$localtime_r" = "yes" ; then
  931. echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
  932. fi
  933. if test "$imlib2" = "yes" ; then
  934. echo "HAVE_IMLIB2=yes" >> config.mak
  935. fi
  936. if test "$freetype2" = "yes" ; then
  937. echo "HAVE_FREETYPE2=yes" >> config.mak
  938. fi
  939. if test "$sunmlib" = "yes" ; then
  940. echo "HAVE_MLIB=yes" >> config.mak
  941. echo "#define HAVE_MLIB 1" >> $TMPH
  942. extralibs="$extralibs -lmlib"
  943. fi
  944. if test "$sdl" = "yes" ; then
  945. echo "CONFIG_SDL=yes" >> config.mak
  946. echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
  947. echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
  948. fi
  949. if test "$have_lrintf" = "yes" ; then
  950. echo "#define HAVE_LRINTF 1" >> $TMPH
  951. fi
  952. if test "$vhook" = "yes" ; then
  953. echo "BUILD_VHOOK=yes" >> config.mak
  954. echo "#define HAVE_VHOOK 1" >> $TMPH
  955. extralibs="$extralibs $ldl"
  956. fi
  957. if test "$lshared" = "yes" ; then
  958. echo "BUILD_SHARED=yes" >> config.mak
  959. echo "PIC=-fPIC" >> config.mak
  960. fi
  961. echo "EXTRALIBS=$extralibs" >> config.mak
  962. version=`grep '#define FFMPEG_VERSION ' $source_path/libavcodec/avcodec.h |
  963. cut -d '"' -f 2`
  964. echo "VERSION=$version" >>config.mak
  965. # if you do not want to use encoders, disable that.
  966. echo "#define CONFIG_ENCODERS 1" >> $TMPH
  967. echo "CONFIG_ENCODERS=yes" >> config.mak
  968. # if you do not want to use decoders, disable that.
  969. echo "#define CONFIG_DECODERS 1" >> $TMPH
  970. echo "CONFIG_DECODERS=yes" >> config.mak
  971. # AC3
  972. if test "$a52" = "yes" ; then
  973. echo "#define CONFIG_AC3 1" >> $TMPH
  974. echo "CONFIG_AC3=yes" >> config.mak
  975. if test "$a52bin" = "yes" ; then
  976. echo "#define CONFIG_A52BIN 1" >> $TMPH
  977. echo "CONFIG_A52BIN=yes" >> config.mak
  978. fi
  979. fi
  980. # PP
  981. if test "$pp" = "yes" ; then
  982. echo "#define CONFIG_PP 1" >> $TMPH
  983. echo "CONFIG_PP=yes" >> config.mak
  984. if test "$shared_pp" = "yes" ; then
  985. echo "#define SHARED_PP 1" >> $TMPH
  986. echo "SHARED_PP=yes" >> config.mak
  987. fi
  988. fi
  989. # mpeg audio high precision mode
  990. if test "$mpegaudio_hp" = "yes" ; then
  991. echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
  992. fi
  993. if test "$v4l" = "yes" ; then
  994. echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
  995. echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
  996. fi
  997. if test "$dv1394" = "yes" ; then
  998. echo "#define CONFIG_DV1394 1" >> $TMPH
  999. echo "CONFIG_DV1394=yes" >> config.mak
  1000. fi
  1001. if test "$dlopen" = "yes" ; then
  1002. echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
  1003. fi
  1004. if test "$dlfcn" = "yes" ; then
  1005. echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
  1006. fi
  1007. if test "$audio_oss" = "yes" ; then
  1008. echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
  1009. echo "CONFIG_AUDIO_OSS=yes" >> config.mak
  1010. fi
  1011. if test "$audio_beos" = "yes" ; then
  1012. echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
  1013. echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
  1014. fi
  1015. if test "$network" = "yes" ; then
  1016. echo "#define CONFIG_NETWORK 1" >> $TMPH
  1017. echo "CONFIG_NETWORK=yes" >> config.mak
  1018. fi
  1019. if test "$zlib" = "yes" ; then
  1020. echo "#define CONFIG_ZLIB 1" >> $TMPH
  1021. echo "CONFIG_ZLIB=yes" >> config.mak
  1022. fi
  1023. if test "$mp3lame" = "yes" ; then
  1024. echo "#define CONFIG_MP3LAME 1" >> $TMPH
  1025. echo "CONFIG_MP3LAME=yes" >> config.mak
  1026. fi
  1027. if test "$vorbis" = "yes" ; then
  1028. echo "#define CONFIG_VORBIS 1" >> $TMPH
  1029. echo "CONFIG_VORBIS=yes" >> config.mak
  1030. fi
  1031. if test "$faad" = "yes" ; then
  1032. echo "#define CONFIG_FAAD 1" >> $TMPH
  1033. echo "CONFIG_FAAD=yes" >> config.mak
  1034. fi
  1035. if test "$faadbin" = "yes" ; then
  1036. echo "#define CONFIG_FAADBIN 1" >> $TMPH
  1037. echo "CONFIG_FAADBIN=yes" >> config.mak
  1038. fi
  1039. if test "$faac" = "yes" ; then
  1040. echo "#define CONFIG_FAAC 1" >> $TMPH
  1041. echo "CONFIG_FAAC=yes" >> config.mak
  1042. fi
  1043. if test "$mingw32" = "yes" ; then
  1044. echo "#define CONFIG_WIN32 1" >> $TMPH
  1045. echo "CONFIG_WIN32=yes" >> config.mak
  1046. echo "#ifndef __MINGW32__" >> $TMPH
  1047. echo "#define __MINGW32__ 1" >> $TMPH
  1048. echo "#endif" >> $TMPH
  1049. fi
  1050. if test "$os2" = "yes" ; then
  1051. echo "#define CONFIG_OS2 1" >> $TMPH
  1052. echo "CONFIG_OS2=yes" >> config.mak
  1053. fi
  1054. if test "$TARGET_OS" = "SunOS" ; then
  1055. echo "#define CONFIG_SUNOS 1" >> $TMPH
  1056. fi
  1057. if test "$darwin" = "yes"; then
  1058. echo "#define CONFIG_DARWIN 1" >> $TMPH
  1059. echo "CONFIG_DARWIN=yes" >> config.mak
  1060. fi
  1061. if test "$_malloc_h" = "yes" ; then
  1062. echo "#define HAVE_MALLOC_H 1" >> $TMPH
  1063. else
  1064. echo "#undef HAVE_MALLOC_H" >> $TMPH
  1065. fi
  1066. if test "$_memalign" = "yes" ; then
  1067. echo "#define HAVE_MEMALIGN 1" >> $TMPH
  1068. else
  1069. echo "#undef HAVE_MEMALIGN" >> $TMPH
  1070. fi
  1071. if test "$netserver" = "yes" ; then
  1072. echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
  1073. echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
  1074. fi
  1075. if test "$need_inet_aton" = "yes" ; then
  1076. echo "NEED_INET_ATON=yes" >> config.mak
  1077. fi
  1078. if test "$simpleidct" = "yes" ; then
  1079. echo "#define SIMPLE_IDCT 1" >> $TMPH
  1080. fi
  1081. if test "$ffserver" = "yes" ; then
  1082. echo "#define CONFIG_FFSERVER 1" >> $TMPH
  1083. echo "CONFIG_FFSERVER=yes" >> config.mak
  1084. fi
  1085. if test "$ffplay" = "yes" ; then
  1086. echo "CONFIG_FFPLAY=yes" >> config.mak
  1087. fi
  1088. if test "$risky" = "yes" ; then
  1089. echo "#define CONFIG_RISKY 1" >> $TMPH
  1090. echo "CONFIG_RISKY=yes" >> config.mak
  1091. fi
  1092. echo "#define restrict $_restrict" >> $TMPH
  1093. # build tree in object directory if source path is different from current one
  1094. if test "$source_path_used" = "yes" ; then
  1095. DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
  1096. libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
  1097. FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
  1098. for dir in $DIRS ; do
  1099. mkdir -p $dir
  1100. done
  1101. for f in $FILES ; do
  1102. ln -sf $source_path/$f $f
  1103. done
  1104. fi
  1105. echo "SRC_PATH=$source_path" >> config.mak
  1106. if test "$amr_wb" = "yes" ; then
  1107. echo "#define AMR_WB 1" >> $TMPH
  1108. echo "AMR_WB=yes" >> config.mak
  1109. echo
  1110. echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
  1111. echo "V5.1.0 from "
  1112. echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
  1113. echo "and extracted the source to libavcodec/amrwb_float"
  1114. echo
  1115. fi
  1116. if test "$amr_nb" = "yes" ; then
  1117. echo "#define AMR_NB 1" >> $TMPH
  1118. echo "AMR_NB=yes" >> config.mak
  1119. echo
  1120. if test "$amr_nb_fixed" = "yes" ; then
  1121. echo "AMR_NB_FIXED=yes" >> config.mak
  1122. echo "#define AMR_NB_FIXED 1" >> $TMPH
  1123. echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
  1124. echo "REL-5 version 5.1.0 from "
  1125. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-510.zip"
  1126. echo "and extracted src to libavcodec/amr"
  1127. echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
  1128. echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
  1129. echo
  1130. else
  1131. echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
  1132. echo "REL-5 V5.1.0 from "
  1133. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-510.zip"
  1134. echo "and extracted the source to libavcodec/amr_float"
  1135. echo
  1136. fi
  1137. fi
  1138. diff $TMPH config.h >/dev/null 2>&1
  1139. if test $? -ne 0 ; then
  1140. mv -f $TMPH config.h
  1141. else
  1142. echo "config.h is unchanged"
  1143. fi
  1144. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH