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.

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