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.

869 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. # 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. for opt do
  236. case "$opt" in
  237. --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
  238. ;;
  239. --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  240. ;;
  241. --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  242. ;;
  243. --cc=*) cc=`echo $opt | cut -d '=' -f 2`
  244. ;;
  245. --make=*) make=`echo $opt | cut -d '=' -f 2`
  246. ;;
  247. --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
  248. ;;
  249. --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
  250. ;;
  251. --extra-libs=*) extralibs=${opt#--extra-libs=}
  252. ;;
  253. --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  254. ;;
  255. --disable-mmx) mmx="no"
  256. ;;
  257. --disable-altivec) altivec="no"
  258. ;;
  259. --enable-gprof) gprof="yes"
  260. ;;
  261. --disable-v4l) v4l="no"
  262. ;;
  263. --disable-audio-oss) audio_oss="no"
  264. ;;
  265. --disable-audio-beos) audio_beos="no"
  266. ;;
  267. --disable-dv1394) dv1394="no"
  268. ;;
  269. --disable-network) network="no"
  270. ;;
  271. --disable-zlib) zlib="no"
  272. ;;
  273. --disable-a52) a52="no"
  274. ;;
  275. --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
  276. ;;
  277. --enable-mp3lame) mp3lame="yes"
  278. ;;
  279. --enable-vorbis) vorbis="yes"
  280. ;;
  281. --disable-vhook) vhook="no"
  282. ;;
  283. --disable-simple_idct) simpleidct="no"
  284. ;;
  285. --enable-win32) win32="yes"
  286. ;;
  287. --enable-mingw32) mingw32="yes"
  288. ;;
  289. --enable-shared) lshared="yes"
  290. ;;
  291. --disable-mpegaudio-hp) mpegaudio_hp="no"
  292. ;;
  293. --disable-ffserver) ffserver="no"
  294. ;;
  295. esac
  296. done
  297. # compute mmx state
  298. if test $mmx = "default"; then
  299. if test $cpu = "x86"; then
  300. mmx="yes"
  301. else
  302. mmx="no"
  303. fi
  304. fi
  305. # Can only do AltiVec on PowerPC
  306. if test $altivec = "default"; then
  307. if test $cpu = "powerpc"; then
  308. altivec="yes"
  309. else
  310. altivec="no"
  311. fi
  312. fi
  313. # See does our compiler support Motorola AltiVec C API
  314. if test $altivec = "yes"; then
  315. cat > $TMPC << EOF
  316. int main(void) {
  317. vector signed int v1, v2, v3;
  318. v1 = vec_add(v2,v3);
  319. return 0;
  320. }
  321. EOF
  322. $cc -o $TMPE $TMPC -faltivec 2> /dev/null || altivec="no"
  323. fi
  324. # Can only do mmi on mips
  325. if test $mmi = "default"; then
  326. if test $cpu = "mips"; then
  327. mmi="yes"
  328. else
  329. mmi="no"
  330. fi
  331. fi
  332. # See does our compiler support mmi
  333. if test $mmi = "yes"; then
  334. cat > $TMPC << EOF
  335. int main(void) {
  336. __asm__ ("lq \$2, 0(\$2)");
  337. return 0;
  338. }
  339. EOF
  340. $cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
  341. fi
  342. # Checking for CFLAGS
  343. if test -z "$CFLAGS"; then
  344. CFLAGS="-O3"
  345. fi
  346. if test "$win32" = "yes" ; then
  347. cross_prefix="i386-mingw32msvc-"
  348. v4l="no"
  349. audio_oss="no"
  350. dv1394="no"
  351. network="no"
  352. fi
  353. if test "$mingw32" = "yes" ; then
  354. cross_prefix=""
  355. v4l="no"
  356. audio_oss="no"
  357. dv1394="no"
  358. network="no"
  359. fi
  360. cc="${cross_prefix}${cc}"
  361. ar="${cross_prefix}${ar}"
  362. ranlib="${cross_prefix}${ranlib}"
  363. strip="${cross_prefix}${strip}"
  364. if test -z "$cross_prefix" ; then
  365. # ---
  366. # big/little endian test
  367. cat > $TMPC << EOF
  368. #include <inttypes.h>
  369. int main(int argc, char ** argv){
  370. volatile uint32_t i=0x01234567;
  371. return (*((uint8_t*)(&i))) == 0x67;
  372. }
  373. EOF
  374. if $cc -o $TMPE $TMPC 2>/dev/null ; then
  375. $TMPE && bigendian="yes"
  376. else
  377. echo big/little test failed
  378. fi
  379. else
  380. # if cross compiling, cannot launch a program, so make a static guess
  381. if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
  382. bigendian="yes"
  383. fi
  384. fi
  385. # ---
  386. # check availability of some header files
  387. cat > $TMPC << EOF
  388. #include <malloc.h>
  389. int main( void ) { return 0; }
  390. EOF
  391. _memalign=no
  392. _malloc_h=no
  393. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  394. _malloc_h=yes
  395. _memalign=yes
  396. # check for memalign - atmos
  397. cat > $TMPC << EOF
  398. #include <malloc.h>
  399. int main ( void ) {
  400. char *string = NULL;
  401. string = memalign(64, sizeof(char));
  402. return 0;
  403. }
  404. EOF
  405. $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
  406. fi
  407. cat > $TMPC << EOF
  408. #define _GNU_SOURCE
  409. #include <time.h>
  410. int main( void ) { return *strptime("", "", 0); }
  411. EOF
  412. strptime=no
  413. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  414. strptime=yes
  415. fi
  416. if test "$zlib" = "yes"; then
  417. # check for zlib - mmu_man
  418. cat > $TMPC << EOF
  419. #include <zlib.h>
  420. int main ( void ) {
  421. if (zlibVersion() != ZLIB_VERSION)
  422. puts("zlib version differs !!!");
  423. return 1;
  424. return 0;
  425. }
  426. EOF
  427. $cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
  428. # $TMPE 2> /dev/null > /dev/null || zlib="no"
  429. # XXX: more tests needed - runtime test
  430. fi
  431. if test "$zlib" = "yes"; then
  432. extralibs="$extralibs -lz"
  433. fi
  434. # test for lrintf in math.h
  435. cat > $TMPC << EOF
  436. #define _ISOC9X_SOURCE 1
  437. #include <math.h>
  438. int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
  439. EOF
  440. have_lrintf="no"
  441. if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
  442. have_lrintf="yes"
  443. $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
  444. fi
  445. _restrict=
  446. for restrict_keyword in restrict __restrict__ __restrict; do
  447. echo "void foo(char * $restrict_keyword p);" > $TMPC
  448. if $cc -c -o $TMPO $TMPC 2> /dev/null; then
  449. _restrict=$restrict_keyword
  450. break;
  451. fi
  452. done
  453. # test gcc version to see if vector builtins can be used
  454. # currently only used on i386 for MMX builtins
  455. cat > $TMPC << EOF
  456. int main(void) {
  457. #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
  458. return 0;
  459. #else
  460. #error no vector builtins
  461. #endif
  462. }
  463. EOF
  464. builtin_vector=no
  465. if $cc -o $TMPO $TMPC 2> /dev/null ; then
  466. builtin_vector=yes
  467. fi
  468. # dlopen/dlfcn.h probing
  469. cat > $TMPC << EOF
  470. #include <dlfcn.h>
  471. int main( void ) { return (int) dlopen("foo", 0); }
  472. EOF
  473. ldl=-ldl
  474. if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
  475. dlfcn=yes
  476. dlopen=yes
  477. fi
  478. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  479. dlfcn=yes
  480. dlopen=yes
  481. ldl=""
  482. fi
  483. cat > $TMPC << EOF
  484. int main( void ) { return (int) dlopen("foo", 0); }
  485. EOF
  486. if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
  487. dlopen=yes
  488. fi
  489. if $cc -o $TMPE $TMPC 2> /dev/null ; then
  490. dlopen=yes
  491. ldl=""
  492. fi
  493. if test "$vhook" = "default" ; then
  494. vhook="$dlopen"
  495. fi
  496. cat > $TMPC << EOF
  497. #include <X11/Xlib.h>
  498. #include <Imlib2.h>
  499. int main( void ) { return (int) imlib_load_font("foo"); }
  500. EOF
  501. imlib2=no
  502. if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null ; then
  503. imlib2=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