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.

1152 lines
27KB

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