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.

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