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.

1146 lines
27KB

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