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.

931 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. 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. which freetype-config > /dev/null
  527. if test $? -eq 0; then
  528. if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` 2> /dev/null ; then
  529. freetype2=yes
  530. fi
  531. fi
  532. fi
  533. if test "$small" = "yes"; then
  534. # CFLAGS=${CFLAGS//-O3/-Os}
  535. CFLAGS="$CFLAGS -Os"
  536. fi
  537. if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
  538. cat << EOF
  539. Usage: configure [options]
  540. Options: [defaults in brackets after descriptions]
  541. EOF
  542. echo "Standard options:"
  543. echo " --help print this message"
  544. echo " --prefix=PREFIX install in PREFIX [$prefix]"
  545. echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
  546. echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
  547. echo " --enable-win32 enable win32 cross compile"
  548. echo " --enable-mingw32 enable mingw32 native windows compile"
  549. echo " --disable-a52 disable GPL'ed A52 support [default=no]"
  550. echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
  551. echo " --disable-pp disable GPL'ed post processing support [default=no]"
  552. echo " --enable-shared-pp use libpostproc.so [default=no]"
  553. echo " --enable-shared build shared libraries [default=no]"
  554. echo ""
  555. echo "Advanced options (experts only):"
  556. echo " --source-path=PATH path of source code [$source_path]"
  557. echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
  558. echo " --cc=CC use C compiler CC [$cc]"
  559. echo " --make=MAKE use specified make [$make]"
  560. echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
  561. echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
  562. echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
  563. echo " --cpu=CPU force cpu to CPU [$cpu]"
  564. echo " --disable-mmx disable mmx usage"
  565. echo " --disable-altivec disable AltiVec usage"
  566. echo " --disable-audio-oss disable OSS audio support [default=no]"
  567. echo " --disable-audio-beos disable BeOS audio support [default=no]"
  568. echo " --disable-v4l disable video4linux grabbing [default=no]"
  569. echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
  570. echo " --disable-network disable network support [default=no]"
  571. echo " --disable-zlib disable zlib [default=no]"
  572. echo " --disable-simple_idct disable simple IDCT routines [default=no]"
  573. echo " --disable-vhook disable video hooking support"
  574. echo " --enable-gprof enable profiling with gprof [$gprof]"
  575. echo " --disable-mpegaudio-hp faster (but less accurate)"
  576. echo " mpegaudio decoding [default=no]"
  577. echo " --disable-ffserver disable ffserver build"
  578. echo " --disable-risky disables patent encumbered codecs"
  579. echo " --enable-small optimize for size instead of speed"
  580. echo ""
  581. echo "NOTE: The object files are build at the place where configure is launched"
  582. exit 1
  583. fi
  584. echo "Install prefix $prefix"
  585. echo "Source path $source_path"
  586. echo "C compiler $cc"
  587. echo "make $make"
  588. echo "CPU $cpu"
  589. echo "Big Endian $bigendian"
  590. if test $cpu = "x86"; then
  591. echo "MMX enabled $mmx"
  592. echo "Vector Builtins $builtin_vector"
  593. fi
  594. if test $cpu = "mips"; then
  595. echo "MMI enabled $mmi"
  596. fi
  597. if test $cpu = "powerpc"; then
  598. echo "AltiVec enabled $altivec"
  599. fi
  600. echo "gprof enabled $gprof"
  601. echo "zlib enabled $zlib"
  602. echo "mp3lame enabled $mp3lame"
  603. echo "vorbis enabled $vorbis"
  604. echo "a52 support $a52"
  605. echo "a52 dlopened $a52bin"
  606. echo "pp support $pp"
  607. echo "shared pp $shared_pp"
  608. echo "Video hooking $vhook"
  609. echo "risky / patent encumbered codecs $risky"
  610. echo "optimize for size $small"
  611. if test "$vhook" = "yes" ; then
  612. echo "Imlib2 support $imlib2"
  613. echo "freetype support $freetype2"
  614. fi
  615. echo "Creating config.mak and config.h"
  616. echo "# Automatically generated by configure - do not modify" > config.mak
  617. echo "/* Automatically generated by configure - do not modify */" > $TMPH
  618. echo "prefix=$prefix" >> config.mak
  619. echo "MAKE=$make" >> config.mak
  620. echo "CC=$cc" >> config.mak
  621. echo "AR=$ar" >> config.mak
  622. echo "RANLIB=$ranlib" >> config.mak
  623. echo "STRIP=$strip" >> config.mak
  624. echo "OPTFLAGS=$CFLAGS" >> config.mak
  625. echo "LDFLAGS=$LDFLAGS" >> config.mak
  626. echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
  627. echo "SHFLAGS=$SHFLAGS" >> config.mak
  628. echo "LIBPREF=$LIBPREF" >> config.mak
  629. echo "LIBSUF=$LIBSUF" >> config.mak
  630. echo "SLIBPREF=$SLIBPREF" >> config.mak
  631. echo "SLIBSUF=$SLIBSUF" >> config.mak
  632. echo "TARGET_OS=$TARGET_OS" >> config.mak
  633. if test "$cpu" = "x86" ; then
  634. echo "TARGET_ARCH_X86=yes" >> config.mak
  635. echo "#define ARCH_X86 1" >> $TMPH
  636. elif test "$cpu" = "armv4l" ; then
  637. echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
  638. echo "#define ARCH_ARMV4L 1" >> $TMPH
  639. elif test "$cpu" = "alpha" ; then
  640. echo "TARGET_ARCH_ALPHA=yes" >> config.mak
  641. echo "#define ARCH_ALPHA 1" >> $TMPH
  642. elif test "$cpu" = "sparc64" ; then
  643. echo "TARGET_ARCH_SPARC64=yes" >> config.mak
  644. echo "#define ARCH_SPARC64 1" >> $TMPH
  645. elif test "$cpu" = "powerpc" ; then
  646. echo "TARGET_ARCH_POWERPC=yes" >> config.mak
  647. echo "#define ARCH_POWERPC 1" >> $TMPH
  648. echo "// Enable the next line to get PowerPC performance report" >> $TMPH
  649. echo "// #define POWERPC_TBL_PERFORMANCE_REPORT 1" >> $TMPH
  650. echo "// Enable the next line to use PMC registers instead of TBL" >> $TMPH
  651. echo "// #define POWERPC_PERF_USE_PMC 1" >> $TMPH
  652. elif test "$cpu" = "mips" ; then
  653. echo "TARGET_ARCH_MIPS=yes" >> config.mak
  654. echo "#define ARCH_MIPS 1" >> $TMPH
  655. fi
  656. if test "$bigendian" = "yes" ; then
  657. echo "WORDS_BIGENDIAN=yes" >> config.mak
  658. echo "#define WORDS_BIGENDIAN 1" >> $TMPH
  659. fi
  660. if test "$mmx" = "yes" ; then
  661. echo "TARGET_MMX=yes" >> config.mak
  662. echo "#define HAVE_MMX 1" >> $TMPH
  663. fi
  664. if test "$builtin_vector" = "yes" ; then
  665. echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
  666. echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
  667. fi
  668. if test "$mmi" = "yes" ; then
  669. echo "TARGET_MMI=yes" >> config.mak
  670. echo "#define HAVE_MMI 1" >> $TMPH
  671. fi
  672. if test "$altivec" = "yes" ; then
  673. echo "TARGET_ALTIVEC=yes" >> config.mak
  674. echo "#define HAVE_ALTIVEC 1" >> $TMPH
  675. echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
  676. echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
  677. fi
  678. if test "$gprof" = "yes" ; then
  679. echo "TARGET_GPROF=yes" >> config.mak
  680. echo "#define HAVE_GPROF 1" >> $TMPH
  681. fi
  682. if test "$strptime" = "yes" ; then
  683. echo "#define HAVE_STRPTIME 1" >> $TMPH
  684. else
  685. echo "BUILD_STRPTIME=yes" >> config.mak
  686. fi
  687. if test "$imlib2" = "yes" ; then
  688. echo "HAVE_IMLIB2=yes" >> config.mak
  689. fi
  690. if test "$freetype2" = "yes" ; then
  691. echo "HAVE_FREETYPE2=yes" >> config.mak
  692. fi
  693. if test "$have_lrintf" = "yes" ; then
  694. echo "#define HAVE_LRINTF 1" >> $TMPH
  695. fi
  696. if test "$vhook" = "yes" ; then
  697. echo "BUILD_VHOOK=yes" >> config.mak
  698. echo "#define HAVE_VHOOK 1" >> $TMPH
  699. extralibs="$extralibs $ldl"
  700. fi
  701. if test "$lshared" = "yes" ; then
  702. echo "BUILD_SHARED=yes" >> config.mak
  703. echo "PIC=-fPIC" >> config.mak
  704. fi
  705. echo "EXTRALIBS=$extralibs" >> config.mak
  706. echo "VERSION=`head $source_path/VERSION`" >>config.mak
  707. echo "" >>config.mak
  708. # if you do not want to use encoders, disable that.
  709. echo "#define CONFIG_ENCODERS 1" >> $TMPH
  710. echo "CONFIG_ENCODERS=yes" >> config.mak
  711. # if you do not want to use decoders, disable that.
  712. echo "#define CONFIG_DECODERS 1" >> $TMPH
  713. echo "CONFIG_DECODERS=yes" >> config.mak
  714. # AC3
  715. if test "$a52" = "yes" ; then
  716. echo "#define CONFIG_AC3 1" >> $TMPH
  717. echo "CONFIG_AC3=yes" >> config.mak
  718. if test "$a52bin" = "yes" ; then
  719. echo "#define CONFIG_A52BIN 1" >> $TMPH
  720. echo "CONFIG_A52BIN=yes" >> config.mak
  721. fi
  722. fi
  723. # PP
  724. if test "$pp" = "yes" ; then
  725. echo "#define CONFIG_PP 1" >> $TMPH
  726. echo "CONFIG_PP=yes" >> config.mak
  727. if test "$shared_pp" = "yes" ; then
  728. echo "#define SHARED_PP 1" >> $TMPH
  729. echo "SHARED_PP=yes" >> config.mak
  730. fi
  731. fi
  732. # mpeg audio high precision mode
  733. if test "$mpegaudio_hp" = "yes" ; then
  734. echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
  735. fi
  736. if test "$v4l" = "yes" ; then
  737. echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
  738. echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
  739. fi
  740. if test "$dv1394" = "yes" ; then
  741. echo "#define CONFIG_DV1394 1" >> $TMPH
  742. echo "CONFIG_DV1394=yes" >> config.mak
  743. fi
  744. if test "$dlopen" = "yes" ; then
  745. echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
  746. fi
  747. if test "$dlfcn" = "yes" ; then
  748. echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
  749. fi
  750. if test "$audio_oss" = "yes" ; then
  751. echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
  752. echo "CONFIG_AUDIO_OSS=yes" >> config.mak
  753. fi
  754. if test "$audio_beos" = "yes" ; then
  755. echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
  756. echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
  757. fi
  758. if test "$network" = "yes" ; then
  759. echo "#define CONFIG_NETWORK 1" >> $TMPH
  760. echo "CONFIG_NETWORK=yes" >> config.mak
  761. fi
  762. if test "$zlib" = "yes" ; then
  763. echo "#define CONFIG_ZLIB 1" >> $TMPH
  764. echo "CONFIG_ZLIB=yes" >> config.mak
  765. fi
  766. if test "$mp3lame" = "yes" ; then
  767. echo "#define CONFIG_MP3LAME 1" >> $TMPH
  768. echo "CONFIG_MP3LAME=yes" >> config.mak
  769. fi
  770. if test "$vorbis" = "yes" ; then
  771. echo "#define CONFIG_VORBIS 1" >> $TMPH
  772. echo "CONFIG_VORBIS=yes" >> config.mak
  773. fi
  774. if test "$win32" = "yes" ; then
  775. echo "#define CONFIG_WIN32 1" >> $TMPH
  776. echo "CONFIG_WIN32=yes" >> config.mak
  777. fi
  778. if test "$mingw32" = "yes" ; then
  779. echo "#define CONFIG_WIN32 1" >> $TMPH
  780. echo "CONFIG_WIN32=yes" >> config.mak
  781. echo "#define __MINGW32__ 1" >> $TMPH
  782. echo "__MINGW32__=1" >> config.mak
  783. fi
  784. if test "$cygwin" = "yes" ; then
  785. # setup correct exesuffix
  786. echo "CONFIG_WIN32=yes" >> config.mak
  787. fi
  788. if test "$os2" = "yes" ; then
  789. echo "#define CONFIG_OS2 1" >> $TMPH
  790. echo "CONFIG_OS2=yes" >> config.mak
  791. fi
  792. if test "$darwin" = "yes"; then
  793. echo "#define CONFIG_DARWIN 1" >> $TMPH
  794. echo "CONFIG_DARWIN=yes" >> config.mak
  795. fi
  796. if test "$_malloc_h" = "yes" ; then
  797. echo "#define HAVE_MALLOC_H 1" >> $TMPH
  798. else
  799. echo "#undef HAVE_MALLOC_H" >> $TMPH
  800. fi
  801. if test "$_memalign" = "yes" ; then
  802. echo "#define HAVE_MEMALIGN 1" >> $TMPH
  803. else
  804. echo "#undef HAVE_MEMALIGN" >> $TMPH
  805. fi
  806. if test "$netserver" = "yes" ; then
  807. echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
  808. echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
  809. fi
  810. if test "$need_inet_aton" = "yes" ; then
  811. echo "NEED_INET_ATON=yes" >> config.mak
  812. fi
  813. if test "$simpleidct" = "yes" ; then
  814. echo "#define SIMPLE_IDCT 1" >> $TMPH
  815. fi
  816. if test "$ffserver" = "yes" ; then
  817. echo "#define CONFIG_FFSERVER 1" >> $TMPH
  818. echo "CONFIG_FFSERVER=yes" >> config.mak
  819. fi
  820. if test "$risky" = "yes" ; then
  821. echo "#define CONFIG_RISKY 1" >> $TMPH
  822. echo "CONFIG_RISKY=yes" >> config.mak
  823. fi
  824. echo "#define restrict $_restrict" >> $TMPH
  825. # build tree in object directory if source path is different from current one
  826. if test "$source_path_used" = "yes" ; then
  827. DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
  828. libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests vhook"
  829. FILES="Makefile libavformat/Makefile libavcodec/Makefile tests/Makefile vhook/Makefile"
  830. for dir in $DIRS ; do
  831. mkdir -p $dir
  832. done
  833. for f in $FILES ; do
  834. ln -sf $source_path/$f $f
  835. done
  836. fi
  837. echo "SRC_PATH=$source_path" >> config.mak
  838. diff $TMPH config.h >/dev/null 2>&1
  839. if test $? -ne 0 ; then
  840. mv -f $TMPH config.h
  841. else
  842. echo "config.h is unchanged"
  843. fi
  844. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH