You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1172 lines
28KB

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