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.

970 lines
23KB

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