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.

1185 lines
28KB

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