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.

879 lines
20KB

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