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.

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