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.

824 lines
19KB

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