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.

934 lines
22KB

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