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.

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