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.

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