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.

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