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.

919 lines
21KB

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