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.

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