MLT library
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.

configure 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. #!/bin/bash
  2. show_help()
  3. {
  4. cat << EOF
  5. Non-autotool config script for MLT.
  6. Help options:
  7. --help - this information
  8. General build options:
  9. --prefix=directory - install prefix for path (default: $prefix)
  10. --libdir=directory - lib directory (default: $prefix/lib)
  11. --enable-gpl - Enable GPL components
  12. --enable-motion-est - Enable motion estimation components
  13. --disable-debug - Compile without debug support (default: on)
  14. --disable-mmx - Compile without MMX support (default: on)
  15. --cpu='cpu' - Compile for a specific CPU/architectre (default: none)
  16. Module disables options:
  17. EOF
  18. for i in src/modules/*
  19. do
  20. [ -d $i ] && [ "`basename $i`" != "CVS" ] && echo `basename $i` `[ -f $i/gpl ] && echo [GPL]`
  21. done |
  22. awk '{ printf( " --disable-%-14.14s- Disable the %s module %s\n", $1, $1, $2 ); }'
  23. echo
  24. echo " NOTE: libraries marked [GPL] will not be built unless --enable-gpl is stipulated."
  25. echo
  26. }
  27. build_config()
  28. {
  29. (
  30. echo "version=$version"
  31. echo "prefix=$prefix"
  32. echo "libdir=$libdir"
  33. echo "bindir=$prefix/bin"
  34. echo "targetos=$targetos"
  35. [ "$mmx" = "true" ] &&
  36. echo "MMX_FLAGS=-DUSE_MMX"
  37. [ "$debug" = "true" ] &&
  38. echo "DEBUG_FLAGS=-g"
  39. echo "LARGE_FILE=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
  40. [ "$cpu" != "" ] &&
  41. echo "TARGETARCH=-march=$cpu" &&
  42. echo "TARGETCPU=-mcpu=$cpu"
  43. echo "OPTIMISATIONS=-O4 -pipe -fomit-frame-pointer"
  44. echo "CFLAGS+=-Wall -fPIC -DPIC \$(TARGETARCH) \$(TARGETCPU) \$(OPTIMISATIONS) \$(MMX_FLAGS) \$(DEBUG_FLAGS) \$(LARGE_FILE)"
  45. case $targetos in
  46. Darwin)
  47. echo "CFLAGS+=-D__DARWIN__ `sdl-config --cflags`"
  48. echo "SHFLAGS=-dynamiclib"
  49. echo "LDFLAGS+=`sdl-config --libs`"
  50. ;;
  51. Linux)
  52. echo "OPTIMISATIONS+=-ffast-math"
  53. echo "CFLAGS+=-pthread"
  54. echo "SHFLAGS=-shared"
  55. echo "LIBDL=-ldl"
  56. echo "RDYNAMIC=-rdynamic"
  57. ;;
  58. *)
  59. ;;
  60. esac
  61. echo "LIBSUF=$LIBSUF"
  62. ) > config.mak
  63. echo "#!/bin/sh" > mlt-config
  64. (
  65. echo export version=$version
  66. echo export prefix=$prefix
  67. echo export libdir=$libdir
  68. echo export bindir=$prefix/bin
  69. ) >> mlt-config
  70. cat < mlt-config-template >> mlt-config
  71. echo -n > packages.dat
  72. }
  73. build_pkgconfig()
  74. {
  75. for i in framework valerie miracle
  76. do
  77. echo prefix="$prefix" > mlt-$i.pc
  78. (
  79. echo exec_prefix=$prefix
  80. echo libdir=$libdir
  81. echo includedir=$prefix/include
  82. echo version=$version
  83. echo cflags=`grep ^$i packages.dat | cut -f 2`
  84. echo libs=`grep ^$i packages.dat | cut -f 3`
  85. ) >> mlt-$i.pc
  86. cat mlt-$i.pc.in >>mlt-$i.pc
  87. done
  88. }
  89. # Debug mode
  90. set +x
  91. # Define build directory for scripts called
  92. export build_dir=`dirname $0`
  93. export prefix=/usr/local
  94. export libdir=""
  95. export help=0
  96. export version=0.2.5
  97. export debug=true
  98. export mmx=true
  99. export gpl=false
  100. export cpu=
  101. export motionest=false
  102. # Determine OS
  103. targetos=$(uname -s)
  104. # Chose appropriate suffix for libraries
  105. case $targetos in
  106. Darwin)
  107. LIBSUF=".dylib"
  108. mmx=false
  109. ;;
  110. Linux)
  111. LIBSUF=".so"
  112. ;;
  113. *)
  114. LIBSUF=".so"
  115. ;;
  116. esac
  117. export LIBSUF
  118. # Iterate through arguments
  119. for i in "$@"
  120. do
  121. case $i in
  122. --help ) help=1 ;;
  123. --prefix=* ) prefix="${i#--prefix=}" ;;
  124. --libdir=* ) libdir="${i#--libdir=}" ;;
  125. --disable-debug ) debug=false ;;
  126. --disable-mmx ) mmx=false ;;
  127. --enable-gpl ) gpl=true ;;
  128. --enable-motion-est ) motionest=true ;;
  129. --cpu=* ) cpu="${i#--cpu=}" ;;
  130. esac
  131. done
  132. # Determine the libdir if it's not specified in the args
  133. [ "$libdir" = "" ] && libdir=$prefix/lib
  134. # Double check mmx (may end up disabling mmx on non-linux platforms incorrectly)
  135. if [ "$mmx" = "true" ]
  136. then
  137. grep mmx /proc/cpuinfo > /dev/null 2>&1 || mmx=false
  138. fi
  139. # Show help if requested
  140. if [ $help = 1 ]
  141. then
  142. show_help
  143. else
  144. # Log the configuration history
  145. date >> config.log
  146. echo "$0 $@" >> config.log
  147. build_config
  148. fi
  149. # Iterate through each of the components
  150. for i in framework modules inigo valerie miracle humperdink
  151. do
  152. if [ -x src/$i/configure ]
  153. then
  154. [ $help = 0 ] && echo "Configuring `basename $i`:"
  155. olddir=`pwd`
  156. cd src/$i
  157. ./configure "$@"
  158. [ $? != 0 ] && exit 1
  159. cd $olddir
  160. fi
  161. done
  162. # Build the pkg-config files
  163. build_pkgconfig
  164. # Report GPL Usage
  165. [ $help != 1 ] &&
  166. ( [ "$gpl" = "false" ] &&
  167. echo "GPL Components are disabled" ||
  168. echo "GPL License Used" )
  169. if [ "$motionest" = "true" -a "$gpl" = "false" ]
  170. then
  171. echo "Add the --enable-gpl flag to build the motion estimation components."
  172. fi