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.

1162 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. cross_prefix=""
  21. cc="gcc"
  22. ar="ar"
  23. ranlib="ranlib"
  24. make="make"
  25. strip="strip"
  26. cpu=`uname -m`
  27. tune="generic"
  28. powerpc_perf="no"
  29. mmx="default"
  30. altivec="default"
  31. mmi="default"
  32. case "$cpu" in
  33. i386|i486|i586|i686|i86pc|BePC)
  34. cpu="x86"
  35. ;;
  36. # armv4l is a subset of armv5tel
  37. armv4l|armv5tel)
  38. cpu="armv4l"
  39. ;;
  40. alpha)
  41. cpu="alpha"
  42. ;;
  43. "Power Macintosh"|ppc)
  44. cpu="powerpc"
  45. ;;
  46. mips)
  47. cpu="mips"
  48. ;;
  49. sun4u)
  50. cpu="sparc64"
  51. ;;
  52. sh4)
  53. cpu="sh4"
  54. ;;
  55. *)
  56. cpu="unknown"
  57. ;;
  58. esac
  59. gprof="no"
  60. v4l="yes"
  61. audio_oss="yes"
  62. audio_beos="no"
  63. dv1394="yes"
  64. network="yes"
  65. zlib="yes"
  66. mp3lame="no"
  67. vorbis="no"
  68. faad="no"
  69. faadbin="no"
  70. a52="yes"
  71. a52bin="no"
  72. pp="yes"
  73. shared_pp="no"
  74. win32="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. ;;
  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 -O3"
  212. LDFLAGS="-Zomf -Zstack 16384 -s"
  213. SHFLAGS=""
  214. FFSLDFLAGS=""
  215. LIBPREF=""
  216. LIBSUF=".lib"
  217. SLIBPREF=""
  218. SLIBSUF=".dll"
  219. extralibs=""
  220. v4l="no"
  221. audio_oss="no"
  222. dv1394="no"
  223. network="no"
  224. ffserver="no"
  225. os2="yes"
  226. ;;
  227. *) ;;
  228. esac
  229. # From mplayer configure. We need TARGET_OS available
  230. # to the Makefile, so it can distinguish between flavors
  231. # of AltiVec on PowerPC
  232. TARGET_OS=`( uname -s ) 2>&1`
  233. case "$TARGET_OS" in
  234. Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
  235. ;;
  236. IRIX*)
  237. TARGET_OS=IRIX
  238. ;;
  239. HP-UX*)
  240. TARGET_OS=HP-UX
  241. ;;
  242. [cC][yY][gG][wW][iI][nN]*)
  243. TARGET_OS=CYGWIN
  244. ;;
  245. *)
  246. TARGET_OS="$TARGET_OS-UNKNOWN"
  247. ;;
  248. esac
  249. # find source path
  250. # XXX: we assume an absolute path is given when launching configure,
  251. # except in './configure' case.
  252. source_path="`echo $0 | sed -e 's#/configure##'`"
  253. source_path_used="yes"
  254. if test -z "$source_path" -o "$source_path" = "." ; then
  255. source_path=`pwd`
  256. source_path_used="no"
  257. fi
  258. for opt do
  259. case "$opt" in
  260. --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
  261. ;;
  262. --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  263. ;;
  264. --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  265. ;;
  266. --cc=*) cc=`echo $opt | cut -d '=' -f 2`
  267. ;;
  268. --make=*) make=`echo $opt | cut -d '=' -f 2`
  269. ;;
  270. --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
  271. ;;
  272. --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
  273. ;;
  274. --extra-libs=*) extralibs=${opt#--extra-libs=}
  275. ;;
  276. --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  277. ;;
  278. --tune=*) tune=`echo $opt | cut -d '=' -f 2`
  279. ;;
  280. --powerpc-perf-enable) powerpc_perf="yes"
  281. ;;
  282. --disable-mmx) mmx="no"
  283. ;;
  284. --disable-altivec) altivec="no"
  285. ;;
  286. --enable-gprof) gprof="yes"
  287. ;;
  288. --disable-v4l) v4l="no"
  289. ;;
  290. --disable-audio-oss) audio_oss="no"
  291. ;;
  292. --disable-audio-beos) audio_beos="no"
  293. ;;
  294. --disable-dv1394) dv1394="no"
  295. ;;
  296. --disable-network) network="no"
  297. ;;
  298. --disable-zlib) zlib="no"
  299. ;;
  300. --disable-a52) a52="no"
  301. ;;
  302. --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
  303. ;;
  304. --disable-pp) pp="no"
  305. ;;
  306. --enable-shared-pp) shared_pp="yes"
  307. ;;
  308. --enable-mp3lame) mp3lame="yes"
  309. ;;
  310. --enable-vorbis) vorbis="yes"
  311. ;;
  312. --enable-faad) faad="yes"
  313. ;;
  314. --enable-faadbin) faadbin="yes"
  315. ;;
  316. --disable-vhook) vhook="no"
  317. ;;
  318. --disable-simple_idct) simpleidct="no"
  319. ;;
  320. --enable-win32) win32="yes"
  321. ;;
  322. --enable-mingw32) mingw32="yes"
  323. ;;
  324. --enable-shared) lshared="yes"
  325. ;;
  326. --disable-mpegaudio-hp) mpegaudio_hp="no"
  327. ;;
  328. --disable-ffserver) ffserver="no"
  329. ;;
  330. --disable-ffplay) ffplay="no"
  331. ;;
  332. --disable-risky) risky="no"
  333. ;;
  334. --enable-small) small="yes"
  335. ;;
  336. --enable-amr_nb) amr_nb="yes"
  337. ;;
  338. --enable-amr_nb-fixed) amr_nb_fixed="yes"
  339. ;;
  340. --enable-sunmlib) sunmlib="yes"
  341. ;;
  342. esac
  343. done
  344. # compute mmx state
  345. if test $mmx = "default"; then
  346. if test $cpu = "x86"; then
  347. mmx="yes"
  348. else
  349. mmx="no"
  350. fi
  351. fi
  352. # Can only do AltiVec on PowerPC
  353. if test $altivec = "default"; then
  354. if test $cpu = "powerpc"; then
  355. altivec="yes"
  356. else
  357. altivec="no"
  358. fi
  359. fi
  360. # Add processor-specific flags
  361. TUNECPU="generic"
  362. if test $tune != "generic"; then
  363. case $tune in
  364. 601|ppc601|PowerPC601)
  365. CFLAGS="$CFLAGS -mcpu=601"
  366. if test $altivec = "yes"; then
  367. echo "WARNING: tuning for PPC601 but altivec enabled !";
  368. fi
  369. TUNECPU=ppc601
  370. ;;
  371. 603*|ppc603*|PowerPC603*)
  372. CFLAGS="$CFLAGS -mcpu=603"
  373. if test $altivec = "yes"; then
  374. echo "WARNING: tuning for PPC603 but altivec enabled !";
  375. fi
  376. TUNECPU=ppc603
  377. ;;
  378. 604*|ppc604*|PowerPC604*)
  379. CFLAGS="$CFLAGS -mcpu=604"
  380. if test $altivec = "yes"; then
  381. echo "WARNING: tuning for PPC604 but altivec enabled !";
  382. fi
  383. TUNECPU=ppc604
  384. ;;
  385. G3|g3|75*|ppc75*|PowerPC75*)
  386. CFLAGS="$CFLAGS -mcpu=750 -mtune=750"
  387. if test $altivec = "yes"; then
  388. echo "WARNING: tuning for PPC75x but altivec enabled !";
  389. fi
  390. TUNECPU=ppc750
  391. ;;
  392. G4|g4|745*|ppc745*|PowerPC745*)
  393. CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450"
  394. if test $altivec = "no"; then
  395. echo "WARNING: tuning for PPC745x but altivec disabled !";
  396. fi
  397. TUNECPU=ppc7450
  398. ;;
  399. 74*|ppc74*|PowerPC74*)
  400. CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400"
  401. if test $altivec = "no"; then
  402. echo "WARNING: tuning for PPC74xx but altivec disabled !";
  403. fi
  404. TUNECPU=ppc7400
  405. ;;
  406. G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
  407. CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc64 -force_cpusubtype_ALL "
  408. if test $altivec = "no"; then
  409. echo "WARNING: tuning for PPC970 but altivec disabled !";
  410. fi
  411. TUNECPU=ppc970
  412. ;;
  413. *)
  414. echo "WARNING: unknown CPU "$tune", ignored"
  415. ;;
  416. esac
  417. fi
  418. # AltiVec flags: The FSF version of GCC differs from the Darwin version
  419. if test $cpu = "powerpc"; then
  420. if test $altivec = "yes"; then
  421. if test "$darwin" = "yes"; then
  422. CFLAGS="$CFLAGS -faltivec"
  423. else
  424. CFLAGS="$CFLAGS -maltivec -mabi=altivec"
  425. fi
  426. fi
  427. fi
  428. # See if we have <altivec.h>
  429. cat > $TMPC << EOF
  430. #include <altivec.h>
  431. int main( void ) { return 0; }
  432. EOF
  433. _altivec_h="no"
  434. if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
  435. _altivec_h="yes"
  436. fi
  437. # See does our compiler support Motorola AltiVec C API
  438. if test $altivec = "yes"; then
  439. if test $_altivec_h = "yes"; then
  440. cat > $TMPC << EOF
  441. #include <altivec.h>
  442. int main(void) {
  443. vector signed int v1, v2, v3;
  444. v1 = vec_add(v2,v3);
  445. return 0;
  446. }
  447. EOF
  448. else
  449. cat > $TMPC << EOF
  450. int main(void) {
  451. vector signed int v1, v2, v3;
  452. v1 = vec_add(v2,v3);
  453. return 0;
  454. }
  455. EOF
  456. fi
  457. $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
  458. fi
  459. # Can only do mmi on mips
  460. if test $mmi = "default"; then
  461. if test $cpu = "mips"; then
  462. mmi="yes"
  463. else
  464. mmi="no"
  465. fi
  466. fi
  467. # See does our compiler support mmi
  468. if test $mmi = "yes"; then
  469. cat > $TMPC << EOF
  470. int main(void) {
  471. __asm__ ("lq \$2, 0(\$2)");
  472. return 0;
  473. }
  474. EOF
  475. $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
  476. fi
  477. # Checking for CFLAGS
  478. if test -z "$CFLAGS"; then
  479. CFLAGS="-O3"
  480. fi
  481. if test "$win32" = "yes" ; then
  482. cross_prefix="i386-mingw32msvc-"
  483. v4l="no"
  484. audio_oss="no"
  485. dv1394="no"
  486. network="no"
  487. fi
  488. if test "$mingw32" = "yes" ; then
  489. cross_prefix=""
  490. v4l="no"
  491. audio_oss="no"
  492. dv1394="no"
  493. network="no"
  494. fi
  495. cc="${cross_prefix}${cc}"
  496. ar="${cross_prefix}${ar}"
  497. ranlib="${cross_prefix}${ranlib}"
  498. strip="${cross_prefix}${strip}"
  499. if test -z "$cross_prefix" ; then
  500. # ---
  501. # big/little endian test
  502. cat > $TMPC << EOF
  503. #include <inttypes.h>
  504. int main(int argc, char ** argv){
  505. volatile uint32_t i=0x01234567;
  506. return (*((uint8_t*)(&i))) == 0x67;
  507. }
  508. EOF
  509. if $cc -o $TMPE $TMPC 2>/dev/null ; then
  510. $TMPE && bigendian="yes"
  511. else
  512. echo big/little test failed
  513. fi
  514. else
  515. # if cross compiling, cannot launch a program, so make a static guess
  516. if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
  517. bigendian="yes"
  518. fi
  519. fi
  520. # ---
  521. # check availability of some header files
  522. cat > $TMPC << EOF
  523. #include <malloc.h>
  524. int main( void ) { return 0; }
  525. EOF
  526. _memalign=no
  527. _malloc_h=no
  528. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  529. _malloc_h=yes
  530. _memalign=yes
  531. # check for memalign - atmos
  532. cat > $TMPC << EOF
  533. #include <malloc.h>
  534. int main ( void ) {
  535. char *string = NULL;
  536. string = memalign(64, sizeof(char));
  537. return 0;
  538. }
  539. EOF
  540. $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
  541. fi
  542. cat > $TMPC << EOF
  543. #define _GNU_SOURCE
  544. #include <time.h>
  545. int main( void ) { return *strptime("", "", 0); }
  546. EOF
  547. strptime=no
  548. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  549. strptime=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 "$small" = "yes"; then
  677. # CFLAGS=${CFLAGS//-O3/-Os}
  678. CFLAGS="$CFLAGS -Os"
  679. fi
  680. if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
  681. cat << EOF
  682. Usage: configure [options]
  683. Options: [defaults in brackets after descriptions]
  684. EOF
  685. echo "Standard options:"
  686. echo " --help print this message"
  687. echo " --prefix=PREFIX install in PREFIX [$prefix]"
  688. echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
  689. echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
  690. echo " --enable-faad enable faad support via libfaad [default=no]"
  691. echo " --enable-faadbin build faad support with runtime linking [default=no]"
  692. echo " --enable-win32 enable win32 cross compile"
  693. echo " --enable-mingw32 enable mingw32 native windows compile"
  694. echo " --disable-a52 disable GPL'ed A52 support [default=no]"
  695. echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
  696. echo " --disable-pp disable GPL'ed post processing support [default=no]"
  697. echo " --enable-shared-pp use libpostproc.so [default=no]"
  698. echo " --enable-shared build shared libraries [default=no]"
  699. echo " --enable-amr_nb enable amr_nb float audio codec"
  700. echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
  701. echo " --enable-sunmlib use Sun medialib [default=no]"
  702. echo ""
  703. echo "Advanced options (experts only):"
  704. echo " --source-path=PATH path of source code [$source_path]"
  705. echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
  706. echo " --cc=CC use C compiler CC [$cc]"
  707. echo " --make=MAKE use specified make [$make]"
  708. echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
  709. echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
  710. echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
  711. echo " --cpu=CPU force cpu to CPU [$cpu]"
  712. echo " --tune=PROCESSOR tune code for a particular CPU (may fails or misperforms on other CPUs)"
  713. echo " --powerpc-perf-enable enable performance report on PPC (requires enabling PMC)"
  714. echo " --disable-mmx disable mmx usage"
  715. echo " --disable-altivec disable AltiVec usage"
  716. echo " --disable-audio-oss disable OSS audio support [default=no]"
  717. echo " --disable-audio-beos disable BeOS audio support [default=no]"
  718. echo " --disable-v4l disable video4linux grabbing [default=no]"
  719. echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
  720. echo " --disable-network disable network support [default=no]"
  721. echo " --disable-zlib disable zlib [default=no]"
  722. echo " --disable-simple_idct disable simple IDCT routines [default=no]"
  723. echo " --disable-vhook disable video hooking support"
  724. echo " --enable-gprof enable profiling with gprof [$gprof]"
  725. echo " --disable-mpegaudio-hp faster (but less accurate)"
  726. echo " mpegaudio decoding [default=no]"
  727. echo " --disable-ffserver disable ffserver build"
  728. echo " --disable-ffplay disable ffplay build"
  729. echo " --disable-risky disables patent encumbered codecs"
  730. echo " --enable-small optimize for size instead of speed"
  731. echo ""
  732. echo "NOTE: The object files are build at the place where configure is launched"
  733. exit 1
  734. fi
  735. echo "Install prefix $prefix"
  736. echo "Source path $source_path"
  737. echo "C compiler $cc"
  738. echo "make $make"
  739. echo "CPU $cpu ($tune)"
  740. echo "Big Endian $bigendian"
  741. if test $cpu = "x86"; then
  742. echo "MMX enabled $mmx"
  743. echo "Vector Builtins $builtin_vector"
  744. fi
  745. if test $cpu = "mips"; then
  746. echo "MMI enabled $mmi"
  747. fi
  748. if test $cpu = "powerpc"; then
  749. echo "AltiVec enabled $altivec"
  750. fi
  751. echo "gprof enabled $gprof"
  752. echo "zlib enabled $zlib"
  753. echo "mp3lame enabled $mp3lame"
  754. echo "vorbis enabled $vorbis"
  755. echo "faad enabled $faad"
  756. echo "faadbin enabled $faadbin"
  757. echo "a52 support $a52"
  758. echo "a52 dlopened $a52bin"
  759. echo "pp support $pp"
  760. echo "shared pp $shared_pp"
  761. echo "Video hooking $vhook"
  762. echo "SDL support $sdl"
  763. if test $sdl_too_old = "yes"; then
  764. echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
  765. fi
  766. echo "risky / patent encumbered codecs $risky"
  767. echo "optimize for size $small"
  768. if test "$vhook" = "yes" ; then
  769. echo "Imlib2 support $imlib2"
  770. echo "freetype support $freetype2"
  771. fi
  772. echo "Sun medialib support" $sunmlib
  773. echo "AMR-NB float support" $amr_nb
  774. echo "AMR-NB fixed support" $amr_nb_fixed
  775. echo "Creating config.mak and config.h"
  776. echo "# Automatically generated by configure - do not modify" > config.mak
  777. echo "/* Automatically generated by configure - do not modify */" > $TMPH
  778. echo "prefix=$prefix" >> config.mak
  779. echo "MAKE=$make" >> config.mak
  780. echo "CC=$cc" >> config.mak
  781. echo "AR=$ar" >> config.mak
  782. echo "RANLIB=$ranlib" >> config.mak
  783. echo "STRIP=$strip" >> config.mak
  784. echo "OPTFLAGS=$CFLAGS" >> config.mak
  785. echo "LDFLAGS=$LDFLAGS" >> config.mak
  786. echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
  787. echo "SHFLAGS=$SHFLAGS" >> config.mak
  788. echo "LIBPREF=$LIBPREF" >> config.mak
  789. echo "LIBSUF=$LIBSUF" >> config.mak
  790. echo "SLIBPREF=$SLIBPREF" >> config.mak
  791. echo "SLIBSUF=$SLIBSUF" >> config.mak
  792. echo "TARGET_OS=$TARGET_OS" >> config.mak
  793. if test "$cpu" = "x86" ; then
  794. echo "TARGET_ARCH_X86=yes" >> config.mak
  795. echo "#define ARCH_X86 1" >> $TMPH
  796. elif test "$cpu" = "armv4l" ; then
  797. echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
  798. echo "#define ARCH_ARMV4L 1" >> $TMPH
  799. elif test "$cpu" = "alpha" ; then
  800. echo "TARGET_ARCH_ALPHA=yes" >> config.mak
  801. echo "#define ARCH_ALPHA 1" >> $TMPH
  802. elif test "$cpu" = "sparc64" ; then
  803. echo "TARGET_ARCH_SPARC64=yes" >> config.mak
  804. echo "#define ARCH_SPARC64 1" >> $TMPH
  805. elif test "$cpu" = "powerpc" ; then
  806. echo "TARGET_ARCH_POWERPC=yes" >> config.mak
  807. echo "#define ARCH_POWERPC 1" >> $TMPH
  808. if test "$powerpc_perf" = "yes"; then
  809. echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
  810. fi
  811. elif test "$cpu" = "mips" ; then
  812. echo "TARGET_ARCH_MIPS=yes" >> config.mak
  813. echo "#define ARCH_MIPS 1" >> $TMPH
  814. elif test "$cpu" = "sh4" ; then
  815. echo "TARGET_ARCH_SH4=yes" >> config.mak
  816. echo "#define ARCH_SH4 1" >> $TMPH
  817. fi
  818. echo "#define TUNECPU $TUNECPU" >> $TMPH
  819. if test "$bigendian" = "yes" ; then
  820. echo "WORDS_BIGENDIAN=yes" >> config.mak
  821. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  822. fi
  823. if test "$mmx" = "yes" ; then
  824. echo "TARGET_MMX=yes" >> config.mak
  825. echo "#define HAVE_MMX 1" >> $TMPH
  826. echo "#define __CPU__ 586" >> $TMPH
  827. fi
  828. if test "$builtin_vector" = "yes" ; then
  829. echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
  830. echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
  831. fi
  832. if test "$mmi" = "yes" ; then
  833. echo "TARGET_MMI=yes" >> config.mak
  834. echo "#define HAVE_MMI 1" >> $TMPH
  835. fi
  836. if test "$altivec" = "yes" ; then
  837. echo "TARGET_ALTIVEC=yes" >> config.mak
  838. echo "#define HAVE_ALTIVEC 1" >> $TMPH
  839. echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
  840. echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
  841. if test "$_altivec_h" = "yes" ; then
  842. echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
  843. else
  844. echo "#undef HAVE_ALTIVEC_H" >> $TMPH
  845. fi
  846. fi
  847. if test "$gprof" = "yes" ; then
  848. echo "TARGET_GPROF=yes" >> config.mak
  849. echo "#define HAVE_GPROF 1" >> $TMPH
  850. fi
  851. if test "$strptime" = "yes" ; then
  852. echo "#define HAVE_STRPTIME 1" >> $TMPH
  853. else
  854. echo "BUILD_STRPTIME=yes" >> config.mak
  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 "$win32" = "yes" ; then
  962. echo "#define CONFIG_WIN32 1" >> $TMPH
  963. echo "CONFIG_WIN32=yes" >> config.mak
  964. fi
  965. if test "$mingw32" = "yes" ; then
  966. echo "#define CONFIG_WIN32 1" >> $TMPH
  967. echo "CONFIG_WIN32=yes" >> config.mak
  968. echo "#define __MINGW32__ 1" >> $TMPH
  969. echo "__MINGW32__=1" >> config.mak
  970. fi
  971. if test "$cygwin" = "yes" ; then
  972. # setup correct exesuffix
  973. echo "CONFIG_WIN32=yes" >> config.mak
  974. fi
  975. if test "$os2" = "yes" ; then
  976. echo "#define CONFIG_OS2 1" >> $TMPH
  977. echo "CONFIG_OS2=yes" >> config.mak
  978. fi
  979. if test "$TARGET_OS" = "SunOS" ; then
  980. echo "#define CONFIG_SUNOS 1" >> $TMPH
  981. fi
  982. if test "$darwin" = "yes"; then
  983. echo "#define CONFIG_DARWIN 1" >> $TMPH
  984. echo "CONFIG_DARWIN=yes" >> config.mak
  985. fi
  986. if test "$_malloc_h" = "yes" ; then
  987. echo "#define HAVE_MALLOC_H 1" >> $TMPH
  988. else
  989. echo "#undef HAVE_MALLOC_H" >> $TMPH
  990. fi
  991. if test "$_memalign" = "yes" ; then
  992. echo "#define HAVE_MEMALIGN 1" >> $TMPH
  993. else
  994. echo "#undef HAVE_MEMALIGN" >> $TMPH
  995. fi
  996. if test "$netserver" = "yes" ; then
  997. echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
  998. echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
  999. fi
  1000. if test "$need_inet_aton" = "yes" ; then
  1001. echo "NEED_INET_ATON=yes" >> config.mak
  1002. fi
  1003. if test "$simpleidct" = "yes" ; then
  1004. echo "#define SIMPLE_IDCT 1" >> $TMPH
  1005. fi
  1006. if test "$ffserver" = "yes" ; then
  1007. echo "#define CONFIG_FFSERVER 1" >> $TMPH
  1008. echo "CONFIG_FFSERVER=yes" >> config.mak
  1009. fi
  1010. if test "$ffplay" = "yes" ; then
  1011. echo "CONFIG_FFPLAY=yes" >> config.mak
  1012. fi
  1013. if test "$risky" = "yes" ; then
  1014. echo "#define CONFIG_RISKY 1" >> $TMPH
  1015. echo "CONFIG_RISKY=yes" >> config.mak
  1016. fi
  1017. echo "#define restrict $_restrict" >> $TMPH
  1018. # build tree in object directory if source path is different from current one
  1019. if test "$source_path_used" = "yes" ; then
  1020. DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
  1021. libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
  1022. FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
  1023. for dir in $DIRS ; do
  1024. mkdir -p $dir
  1025. done
  1026. for f in $FILES ; do
  1027. ln -sf $source_path/$f $f
  1028. done
  1029. fi
  1030. echo "SRC_PATH=$source_path" >> config.mak
  1031. if test "$amr_nb" = "yes" ; then
  1032. echo "#define AMR_NB 1" >> $TMPH
  1033. echo "AMR_NB=yes" >> config.mak
  1034. echo
  1035. if test "$amr_nb_fixed" = "yes" ; then
  1036. echo "AMR_NB_FIXED=yes" >> config.mak
  1037. echo "#define AMR_NB_FIXED 1" >> $TMPH
  1038. echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
  1039. echo "REL-5 version 5.1.0 from "
  1040. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-510.zip"
  1041. echo "and extracted src to libavcodec/amr"
  1042. echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
  1043. echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
  1044. echo
  1045. else
  1046. echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
  1047. echo "REL-5 V5.1.0 from "
  1048. echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-510.zip"
  1049. echo "and extracted the source to libavcodec/amr_float"
  1050. echo
  1051. fi
  1052. fi
  1053. diff $TMPH config.h >/dev/null 2>&1
  1054. if test $? -ne 0 ; then
  1055. mv -f $TMPH config.h
  1056. else
  1057. echo "config.h is unchanged"
  1058. fi
  1059. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH