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.

1001 lines
23KB

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