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.

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