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.

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