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.

1170 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. fi
  492. cc="${cross_prefix}${cc}"
  493. ar="${cross_prefix}${ar}"
  494. ranlib="${cross_prefix}${ranlib}"
  495. strip="${cross_prefix}${strip}"
  496. if test -z "$cross_prefix" ; then
  497. # ---
  498. # big/little endian test
  499. cat > $TMPC << EOF
  500. #include <inttypes.h>
  501. int main(int argc, char ** argv){
  502. volatile uint32_t i=0x01234567;
  503. return (*((uint8_t*)(&i))) == 0x67;
  504. }
  505. EOF
  506. if $cc -o $TMPE $TMPC 2>/dev/null ; then
  507. $TMPE && bigendian="yes"
  508. else
  509. echo big/little test failed
  510. fi
  511. else
  512. # if cross compiling, cannot launch a program, so make a static guess
  513. if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
  514. bigendian="yes"
  515. fi
  516. fi
  517. # ---
  518. # check availability of some header files
  519. cat > $TMPC << EOF
  520. #include <malloc.h>
  521. int main( void ) { return 0; }
  522. EOF
  523. _memalign=no
  524. _malloc_h=no
  525. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  526. _malloc_h=yes
  527. _memalign=yes
  528. # check for memalign - atmos
  529. cat > $TMPC << EOF
  530. #include <malloc.h>
  531. int main ( void ) {
  532. char *string = NULL;
  533. string = memalign(64, sizeof(char));
  534. return 0;
  535. }
  536. EOF
  537. $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
  538. fi
  539. cat > $TMPC << EOF
  540. #include <time.h>
  541. int main( void ) { localtime_r(NULL, NULL); }
  542. EOF
  543. localtime_r=no
  544. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  545. localtime_r=yes
  546. fi
  547. if test "$zlib" = "yes"; then
  548. # check for zlib - mmu_man
  549. cat > $TMPC << EOF
  550. #include <zlib.h>
  551. int main ( void ) {
  552. if (zlibVersion() != ZLIB_VERSION)
  553. puts("zlib version differs !!!");
  554. return 1;
  555. return 0;
  556. }
  557. EOF
  558. $cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
  559. # $TMPE 2> /dev/null > /dev/null || zlib="no"
  560. # XXX: more tests needed - runtime test
  561. fi
  562. if test "$zlib" = "yes"; then
  563. extralibs="$extralibs -lz"
  564. fi
  565. # test for lrintf in math.h
  566. cat > $TMPC << EOF
  567. #define _ISOC9X_SOURCE 1
  568. #include <math.h>
  569. int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
  570. EOF
  571. have_lrintf="no"
  572. if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
  573. have_lrintf="yes"
  574. $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
  575. fi
  576. _restrict=
  577. for restrict_keyword in restrict __restrict__ __restrict; do
  578. echo "void foo(char * $restrict_keyword p);" > $TMPC
  579. if $cc -c -o $TMPO $TMPC 2> /dev/null; then
  580. _restrict=$restrict_keyword
  581. break;
  582. fi
  583. done
  584. # test gcc version to see if vector builtins can be used
  585. # currently only used on i386 for MMX builtins
  586. cat > $TMPC << EOF
  587. int main(void) {
  588. #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
  589. return 0;
  590. #else
  591. #error no vector builtins
  592. #endif
  593. }
  594. EOF
  595. builtin_vector=no
  596. if $cc -o $TMPO $TMPC 2> /dev/null ; then
  597. builtin_vector=yes
  598. fi
  599. # dlopen/dlfcn.h probing
  600. cat > $TMPC << EOF
  601. #include <dlfcn.h>
  602. int main( void ) { return (int) dlopen("foo", 0); }
  603. EOF
  604. ldl=-ldl
  605. if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
  606. dlfcn=yes
  607. dlopen=yes
  608. fi
  609. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  610. dlfcn=yes
  611. dlopen=yes
  612. ldl=""
  613. fi
  614. cat > $TMPC << EOF
  615. int main( void ) { return (int) dlopen("foo", 0); }
  616. EOF
  617. if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
  618. dlopen=yes
  619. fi
  620. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  621. dlopen=yes
  622. ldl=""
  623. fi
  624. if test "$vhook" = "default" ; then
  625. vhook="$dlopen"
  626. fi
  627. ##########################################
  628. # imlib probe
  629. cat > $TMPC << EOF
  630. #include <X11/Xlib.h>
  631. #include <Imlib2.h>
  632. int main( void ) { return (int) imlib_load_font("foo"); }
  633. EOF
  634. imlib2=no
  635. if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null ; then
  636. imlib2=yes
  637. fi
  638. ##########################################
  639. # freetype probe
  640. cat > $TMPC << EOF
  641. #include <ft2build.h>
  642. int main( void ) { return (int) FT_Init_FreeType(0); }
  643. EOF
  644. freetype2=no
  645. if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
  646. if test "`which freetype-config`" != ""; then
  647. if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` 2> /dev/null ; then
  648. freetype2=yes
  649. fi
  650. fi
  651. fi
  652. ##########################################
  653. # SDL probe
  654. cat > $TMPC << EOF
  655. #include <SDL.h>
  656. #undef main /* We don't want SDL to override our main() */
  657. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  658. EOF
  659. sdl_too_old=no
  660. sdl=no
  661. if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` 2> /dev/null ; then
  662. _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
  663. if test "$_sdlversion" -lt 121 ; then
  664. sdl_too_old=yes
  665. else
  666. sdl=yes
  667. fi
  668. fi
  669. if test "$sdl" = "no" ; then
  670. ffplay=no
  671. fi
  672. if test "$debug" = "yes"; then
  673. CFLAGS="$CFLAGS -g"
  674. fi
  675. if test "$optimize" = "small"; then
  676. # CFLAGS=${CFLAGS//-O3/-Os}
  677. CFLAGS="$CFLAGS -Os"
  678. fi
  679. if test "$optimize" = "yes"; then
  680. CFLAGS="$CFLAGS -O3"
  681. fi
  682. if test x"$mandir" = x""; then
  683. mandir="${prefix}/man"
  684. fi
  685. if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
  686. cat << EOF
  687. Usage: configure [options]
  688. Options: [defaults in brackets after descriptions]
  689. EOF
  690. echo "Standard options:"
  691. echo " --help print this message"
  692. echo " --prefix=PREFIX install in PREFIX [$prefix]"
  693. echo " --mandir=DIR man documentation in DIR [PREFIX/man]"
  694. echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
  695. echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
  696. echo " --enable-faad enable faad support via libfaad [default=no]"
  697. echo " --enable-faadbin build faad support with runtime linking [default=no]"
  698. echo " --enable-mingw32 enable mingw32 native/cross windows compile"
  699. echo " --enable-a52 enable GPL'ed A52 support [default=no]"
  700. echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
  701. echo " --enable-pp enable GPL'ed post processing support [default=no]"
  702. echo " --enable-shared-pp use libpostproc.so [default=no]"
  703. echo " --enable-shared build shared libraries [default=no]"
  704. echo " --enable-amr_nb enable amr_nb float audio codec"
  705. echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
  706. echo " --enable-sunmlib use Sun medialib [default=no]"
  707. echo ""
  708. echo "Advanced options (experts only):"
  709. echo " --source-path=PATH path of source code [$source_path]"
  710. echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
  711. echo " --cc=CC use C compiler CC [$cc]"
  712. echo " --make=MAKE use specified make [$make]"
  713. echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
  714. echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
  715. echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
  716. echo " --cpu=CPU force cpu to CPU [$cpu]"
  717. echo " --tune=PROCESSOR tune code for a particular CPU (may fails or misperforms on other CPUs)"
  718. echo " --powerpc-perf-enable enable performance report on PPC (requires enabling PMC)"
  719. echo " --disable-mmx disable mmx usage"
  720. echo " --disable-altivec disable AltiVec usage"
  721. echo " --disable-audio-oss disable OSS audio support [default=no]"
  722. echo " --disable-audio-beos disable BeOS audio support [default=no]"
  723. echo " --disable-v4l disable video4linux grabbing [default=no]"
  724. echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
  725. echo " --disable-network disable network support [default=no]"
  726. echo " --disable-zlib disable zlib [default=no]"
  727. echo " --disable-simple_idct disable simple IDCT routines [default=no]"
  728. echo " --disable-vhook disable video hooking support"
  729. echo " --enable-gprof enable profiling with gprof [$gprof]"
  730. echo " --disable-debug disable debugging symbols"
  731. echo " --disable-opts disable compiler optimizations"
  732. echo " --disable-mpegaudio-hp faster (but less accurate)"
  733. echo " mpegaudio decoding [default=no]"
  734. echo " --disable-ffserver disable ffserver build"
  735. echo " --disable-ffplay disable ffplay build"
  736. echo " --disable-risky disables patent encumbered codecs"
  737. echo " --enable-small optimize for size instead of speed"
  738. echo ""
  739. echo "NOTE: The object files are build at the place where configure is launched"
  740. exit 1
  741. fi
  742. echo "Install prefix $prefix"
  743. echo "Source path $source_path"
  744. echo "C compiler $cc"
  745. echo "make $make"
  746. echo "CPU $cpu ($tune)"
  747. echo "Big Endian $bigendian"
  748. if test $cpu = "x86"; then
  749. echo "MMX enabled $mmx"
  750. echo "Vector Builtins $builtin_vector"
  751. fi
  752. if test $cpu = "mips"; then
  753. echo "MMI enabled $mmi"
  754. fi
  755. if test $cpu = "powerpc"; then
  756. echo "AltiVec enabled $altivec"
  757. fi
  758. echo "gprof enabled $gprof"
  759. echo "zlib enabled $zlib"
  760. echo "mp3lame enabled $mp3lame"
  761. echo "vorbis enabled $vorbis"
  762. echo "faad enabled $faad"
  763. echo "faadbin enabled $faadbin"
  764. echo "a52 support $a52"
  765. echo "a52 dlopened $a52bin"
  766. echo "pp support $pp"
  767. echo "debug symbols $debug"
  768. echo "optimize $optimize"
  769. echo "shared pp $shared_pp"
  770. echo "Video hooking $vhook"
  771. echo "SDL support $sdl"
  772. if test $sdl_too_old = "yes"; then
  773. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
  774. fi
  775. echo "risky / patent encumbered codecs $risky"
  776. if test "$vhook" = "yes" ; then
  777. echo "Imlib2 support $imlib2"
  778. echo "freetype support $freetype2"
  779. fi
  780. echo "Sun medialib support" $sunmlib
  781. echo "AMR-NB float support" $amr_nb
  782. echo "AMR-NB fixed support" $amr_nb_fixed
  783. echo "Creating config.mak and config.h"
  784. echo "# Automatically generated by configure - do not modify" > config.mak
  785. echo "/* Automatically generated by configure - do not modify */" > $TMPH
  786. echo "prefix=$prefix" >> config.mak
  787. echo "mandir=$mandir" >> config.mak
  788. echo "MAKE=$make" >> config.mak
  789. echo "CC=$cc" >> config.mak
  790. echo "AR=$ar" >> config.mak
  791. echo "RANLIB=$ranlib" >> config.mak
  792. echo "STRIP=$strip" >> config.mak
  793. echo "OPTFLAGS=$CFLAGS" >> config.mak
  794. echo "LDFLAGS=$LDFLAGS" >> config.mak
  795. echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
  796. echo "SHFLAGS=$SHFLAGS" >> config.mak
  797. echo "LIBPREF=$LIBPREF" >> config.mak
  798. echo "LIBSUF=$LIBSUF" >> config.mak
  799. echo "SLIBPREF=$SLIBPREF" >> config.mak
  800. echo "SLIBSUF=$SLIBSUF" >> config.mak
  801. echo "TARGET_OS=$TARGET_OS" >> config.mak
  802. if test "$cpu" = "x86" ; then
  803. echo "TARGET_ARCH_X86=yes" >> config.mak
  804. echo "#define ARCH_X86 1" >> $TMPH
  805. elif test "$cpu" = "armv4l" ; then
  806. echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
  807. echo "#define ARCH_ARMV4L 1" >> $TMPH
  808. elif test "$cpu" = "alpha" ; then
  809. echo "TARGET_ARCH_ALPHA=yes" >> config.mak
  810. echo "#define ARCH_ALPHA 1" >> $TMPH
  811. elif test "$cpu" = "sparc64" ; then
  812. echo "TARGET_ARCH_SPARC64=yes" >> config.mak
  813. echo "#define ARCH_SPARC64 1" >> $TMPH
  814. elif test "$cpu" = "powerpc" ; then
  815. echo "TARGET_ARCH_POWERPC=yes" >> config.mak
  816. echo "#define ARCH_POWERPC 1" >> $TMPH
  817. if test "$powerpc_perf" = "yes"; then
  818. echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
  819. fi
  820. elif test "$cpu" = "mips" ; then
  821. echo "TARGET_ARCH_MIPS=yes" >> config.mak
  822. echo "#define ARCH_MIPS 1" >> $TMPH
  823. elif test "$cpu" = "sh4" ; then
  824. echo "TARGET_ARCH_SH4=yes" >> config.mak
  825. echo "#define ARCH_SH4 1" >> $TMPH
  826. fi
  827. echo "#define TUNECPU $TUNECPU" >> $TMPH
  828. if test "$bigendian" = "yes" ; then
  829. echo "WORDS_BIGENDIAN=yes" >> config.mak
  830. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  831. fi
  832. if test "$mmx" = "yes" ; then
  833. echo "TARGET_MMX=yes" >> config.mak
  834. echo "#define HAVE_MMX 1" >> $TMPH
  835. echo "#define __CPU__ 586" >> $TMPH
  836. fi
  837. if test "$mingw32" = "yes" ; then
  838. echo "TARGET_MINGW32=yes" >> config.mak
  839. fi
  840. if test "$builtin_vector" = "yes" ; then
  841. echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
  842. echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
  843. fi
  844. if test "$mmi" = "yes" ; then
  845. echo "TARGET_MMI=yes" >> config.mak
  846. echo "#define HAVE_MMI 1" >> $TMPH
  847. fi
  848. if test "$altivec" = "yes" ; then
  849. echo "TARGET_ALTIVEC=yes" >> config.mak
  850. echo "#define HAVE_ALTIVEC 1" >> $TMPH
  851. echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
  852. echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
  853. if test "$_altivec_h" = "yes" ; then
  854. echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
  855. else
  856. echo "#undef HAVE_ALTIVEC_H" >> $TMPH
  857. fi
  858. fi
  859. if test "$gprof" = "yes" ; then
  860. echo "TARGET_GPROF=yes" >> config.mak
  861. echo "#define HAVE_GPROF 1" >> $TMPH
  862. fi
  863. if test "$localtime_r" = "yes" ; then
  864. echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
  865. fi
  866. if test "$imlib2" = "yes" ; then
  867. echo "HAVE_IMLIB2=yes" >> config.mak
  868. fi
  869. if test "$freetype2" = "yes" ; then
  870. echo "HAVE_FREETYPE2=yes" >> config.mak
  871. fi
  872. if test "$sunmlib" = "yes" ; then
  873. echo "HAVE_MLIB=yes" >> config.mak
  874. echo "#define HAVE_MLIB 1" >> $TMPH
  875. extralibs="$extralibs -lmlib"
  876. fi
  877. if test "$sdl" = "yes" ; then
  878. echo "CONFIG_SDL=yes" >> config.mak
  879. echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
  880. echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
  881. fi
  882. if test "$have_lrintf" = "yes" ; then
  883. echo "#define HAVE_LRINTF 1" >> $TMPH
  884. fi
  885. if test "$vhook" = "yes" ; then
  886. echo "BUILD_VHOOK=yes" >> config.mak
  887. echo "#define HAVE_VHOOK 1" >> $TMPH
  888. extralibs="$extralibs $ldl"
  889. fi
  890. if test "$lshared" = "yes" ; then
  891. echo "BUILD_SHARED=yes" >> config.mak
  892. echo "PIC=-fPIC" >> config.mak
  893. fi
  894. echo "EXTRALIBS=$extralibs" >> config.mak
  895. echo "VERSION=`head $source_path/VERSION`" >>config.mak
  896. echo "" >>config.mak
  897. # if you do not want to use encoders, disable that.
  898. echo "#define CONFIG_ENCODERS 1" >> $TMPH
  899. echo "CONFIG_ENCODERS=yes" >> config.mak
  900. # if you do not want to use decoders, disable that.
  901. echo "#define CONFIG_DECODERS 1" >> $TMPH
  902. echo "CONFIG_DECODERS=yes" >> config.mak
  903. # AC3
  904. if test "$a52" = "yes" ; then
  905. echo "#define CONFIG_AC3 1" >> $TMPH
  906. echo "CONFIG_AC3=yes" >> config.mak
  907. if test "$a52bin" = "yes" ; then
  908. echo "#define CONFIG_A52BIN 1" >> $TMPH
  909. echo "CONFIG_A52BIN=yes" >> config.mak
  910. fi
  911. fi
  912. # PP
  913. if test "$pp" = "yes" ; then
  914. echo "#define CONFIG_PP 1" >> $TMPH
  915. echo "CONFIG_PP=yes" >> config.mak
  916. if test "$shared_pp" = "yes" ; then
  917. echo "#define SHARED_PP 1" >> $TMPH
  918. echo "SHARED_PP=yes" >> config.mak
  919. fi
  920. fi
  921. # mpeg audio high precision mode
  922. if test "$mpegaudio_hp" = "yes" ; then
  923. echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
  924. fi
  925. if test "$v4l" = "yes" ; then
  926. echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
  927. echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
  928. fi
  929. if test "$dv1394" = "yes" ; then
  930. echo "#define CONFIG_DV1394 1" >> $TMPH
  931. echo "CONFIG_DV1394=yes" >> config.mak
  932. fi
  933. if test "$dlopen" = "yes" ; then
  934. echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
  935. fi
  936. if test "$dlfcn" = "yes" ; then
  937. echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
  938. fi
  939. if test "$audio_oss" = "yes" ; then
  940. echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
  941. echo "CONFIG_AUDIO_OSS=yes" >> config.mak
  942. fi
  943. if test "$audio_beos" = "yes" ; then
  944. echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
  945. echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
  946. fi
  947. if test "$network" = "yes" ; then
  948. echo "#define CONFIG_NETWORK 1" >> $TMPH
  949. echo "CONFIG_NETWORK=yes" >> config.mak
  950. fi
  951. if test "$zlib" = "yes" ; then
  952. echo "#define CONFIG_ZLIB 1" >> $TMPH
  953. echo "CONFIG_ZLIB=yes" >> config.mak
  954. fi
  955. if test "$mp3lame" = "yes" ; then
  956. echo "#define CONFIG_MP3LAME 1" >> $TMPH
  957. echo "CONFIG_MP3LAME=yes" >> config.mak
  958. fi
  959. if test "$vorbis" = "yes" ; then
  960. echo "#define CONFIG_VORBIS 1" >> $TMPH
  961. echo "CONFIG_VORBIS=yes" >> config.mak
  962. fi
  963. if test "$faad" = "yes" ; then
  964. echo "#define CONFIG_FAAD 1" >> $TMPH
  965. echo "CONFIG_FAAD=yes" >> config.mak
  966. fi
  967. if test "$faadbin" = "yes" ; then
  968. echo "#define CONFIG_FAADBIN 1" >> $TMPH
  969. echo "CONFIG_FAADBIN=yes" >> config.mak
  970. fi
  971. if test "$mingw32" = "yes" ; then
  972. echo "#define CONFIG_WIN32 1" >> $TMPH
  973. echo "CONFIG_WIN32=yes" >> config.mak
  974. echo "#ifndef __MINGW32__" >> $TMPH
  975. echo "#define __MINGW32__ 1" >> $TMPH
  976. echo "#endif" >> $TMPH
  977. echo "__MINGW32__=1" >> config.mak
  978. fi
  979. if test "$cygwin" = "yes" ; then
  980. # setup correct exesuffix
  981. echo "CONFIG_WIN32=yes" >> config.mak
  982. fi
  983. if test "$os2" = "yes" ; then
  984. echo "#define CONFIG_OS2 1" >> $TMPH
  985. echo "CONFIG_OS2=yes" >> config.mak
  986. fi
  987. if test "$TARGET_OS" = "SunOS" ; then
  988. echo "#define CONFIG_SUNOS 1" >> $TMPH
  989. fi
  990. if test "$darwin" = "yes"; then
  991. echo "#define CONFIG_DARWIN 1" >> $TMPH
  992. echo "CONFIG_DARWIN=yes" >> config.mak
  993. fi
  994. if test "$_malloc_h" = "yes" ; then
  995. echo "#define HAVE_MALLOC_H 1" >> $TMPH
  996. else
  997. echo "#undef HAVE_MALLOC_H" >> $TMPH
  998. fi
  999. if test "$_memalign" = "yes" ; then
  1000. echo "#define HAVE_MEMALIGN 1" >> $TMPH
  1001. else
  1002. echo "#undef HAVE_MEMALIGN" >> $TMPH
  1003. fi
  1004. if test "$netserver" = "yes" ; then
  1005. echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
  1006. echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
  1007. fi
  1008. if test "$need_inet_aton" = "yes" ; then
  1009. echo "NEED_INET_ATON=yes" >> config.mak
  1010. fi
  1011. if test "$simpleidct" = "yes" ; then
  1012. echo "#define SIMPLE_IDCT 1" >> $TMPH
  1013. fi
  1014. if test "$ffserver" = "yes" ; then
  1015. echo "#define CONFIG_FFSERVER 1" >> $TMPH
  1016. echo "CONFIG_FFSERVER=yes" >> config.mak
  1017. fi
  1018. if test "$ffplay" = "yes" ; then
  1019. echo "CONFIG_FFPLAY=yes" >> config.mak
  1020. fi
  1021. if test "$risky" = "yes" ; then
  1022. echo "#define CONFIG_RISKY 1" >> $TMPH
  1023. echo "CONFIG_RISKY=yes" >> config.mak
  1024. fi
  1025. echo "#define restrict $_restrict" >> $TMPH
  1026. # build tree in object directory if source path is different from current one
  1027. if test "$source_path_used" = "yes" ; then
  1028. DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
  1029. libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
  1030. FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
  1031. for dir in $DIRS ; do
  1032. mkdir -p $dir
  1033. done
  1034. for f in $FILES ; do
  1035. ln -sf $source_path/$f $f
  1036. done
  1037. fi
  1038. echo "SRC_PATH=$source_path" >> config.mak
  1039. if test "$amr_nb" = "yes" ; then
  1040. echo "#define AMR_NB 1" >> $TMPH
  1041. echo "AMR_NB=yes" >> config.mak
  1042. echo
  1043. if test "$amr_nb_fixed" = "yes" ; then
  1044. echo "AMR_NB_FIXED=yes" >> config.mak
  1045. echo "#define AMR_NB_FIXED 1" >> $TMPH
  1046. echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
  1047. echo "REL-5 version 5.1.0 from "
  1048. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-510.zip"
  1049. echo "and extracted src to libavcodec/amr"
  1050. echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
  1051. echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
  1052. echo
  1053. else
  1054. echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
  1055. echo "REL-5 V5.1.0 from "
  1056. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-510.zip"
  1057. echo "and extracted the source to libavcodec/amr_float"
  1058. echo
  1059. fi
  1060. fi
  1061. diff $TMPH config.h >/dev/null 2>&1
  1062. if test $? -ne 0 ; then
  1063. mv -f $TMPH config.h
  1064. else
  1065. echo "config.h is unchanged"
  1066. fi
  1067. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH