directfb-config.in 5.74 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
#!/bin/sh

prefix=@prefix@
exec_prefix=@exec_prefix@
exec_prefix_set=no
moduledir=@MODULEDIR@

usage()
{
	cat <<EOF
Usage: directfb-config [OPTIONS] [LIBRARIES]
Options:
	[--prefix[=DIR]]
	[--exec-prefix[=DIR]]
	[--version]
	[--libs]
	[--cflags]
	[--input=<driver>[,<driver>]...]
	[--graphics=<driver>[,<driver>]...]
	[--font=<impl>[,<impl>]...]
	[--imageprovider=<impl>[,<impl>]...]
	[--videoprovider=<impl>[,<impl>]...]
Libraries:
	directfb
	avifile
EOF
	exit $1
}

if test $# -eq 0; then
	usage 1 1>&2
fi

lib_directfb=yes
lib_avifile=no

while test $# -gt 0; do
  case "$1" in
    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
    *) optarg= ;;
  esac

  case $1 in
    --prefix=*)
      prefix=$optarg
      if test $exec_prefix_set = no ; then
        exec_prefix=$optarg
      fi
      ;;
    --prefix)
      echo_prefix=yes
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      exec_prefix_set=yes
      ;;
    --exec-prefix)
      echo_exec_prefix=yes
      ;;
    --version)
      echo @DIRECTFB_MAJOR_VERSION@.@DIRECTFB_MINOR_VERSION@.@DIRECTFB_MICRO_VERSION@
      ;;
    --cflags)
      echo_cflags=yes
      ;;
    --libs)
      echo_libs=yes
      ;;
    directfb)
      lib_directfb=yes
      ;;
    avifile)
      lib_avifile=yes
      ;;
    --input=*)
      if test -z "$optarg"; then
        usage 2 1>&2
      fi
        
      for i in `echo $optarg | sed 's/,/ /g'`; do
        echo_input="$echo_input -Wl,-udirectfb_$i -ldirectfb_$i"
      done

      echo_static=yes
      ;;
    --graphics=*)
      if test -z "$optarg"; then
        usage 2 1>&2
      fi
        
      for i in `echo $optarg | sed 's/,/ /g'`; do
        echo_graphics="$echo_graphics -Wl,-udirectfb_$i -ldirectfb_$i"
      done

      echo_static=yes
      ;;
    --font=*)
      if test -z "$optarg"; then
        usage 2 1>&2
      fi
        
      for i in `echo $optarg | sed 's/,/ /g'`; do
        case $i in
          ft2)
            echo_font="$echo_font -Wl,-uIDirectFBFont_FT2 -lidirectfbfont_$i -lfreetype"
            ;;
          *)
            echo_font="$echo_font -Wl,-uIDirectFBFont_$i -lidirectfbfont_$i"
            ;;
        esac
      done

      echo_static=yes
      ;;
    --imageprovider=*)
      if test -z "$optarg"; then
        usage 2 1>&2
      fi
        
      for i in `echo $optarg | sed 's/,/ /g'`; do
        case $i in
          imlib2)
            echo_imageprovider="$echo_imageprovider -Wl,-uIDirectFBImageProvider_Imlib2 -lidirectfbimageprovider_$i"
            echo_imageprovider="$echo_imageprovider -lImlib2 -lttf -lm -L/usr/X11R6/lib -lXext -lX11"
            ;;
          jpeg)
            echo_imageprovider="$echo_imageprovider -Wl,-uIDirectFBImageProvider_JPEG -lidirectfbimageprovider_$i"
            echo_imageprovider="$echo_imageprovider -ljpeg"
            ;;
          png)
            echo_imageprovider="$echo_imageprovider -Wl,-uIDirectFBImageProvider_PNG -lidirectfbimageprovider_$i"
            echo_imageprovider="$echo_imageprovider -lpng -lz -lm"
            ;;
          gif)
            echo_imageprovider="$echo_imageprovider -Wl,-uIDirectFBImageProvider_GIF -lidirectfbimageprovider_$i"
            ;;
          mpeg2)
            echo_imageprovider="$echo_imageprovider -Wl,-uIDirectFBImageProvider_MPEG2 -lidirectfbimageprovider_$i"
            echo_imageprovider="$echo_imageprovider -lm"
            ;;
          *)
            echo_imageprovider="$echo_imageprovider -Wl,-uIDirectFBImageProvider_$i -lidirectfbimageprovider_$i"
            ;;
        esac
      done

      echo_static=yes
      ;;
    --videoprovider=*)
      if test -z "$optarg"; then
        usage 2 1>&2
      fi
        
      for i in `echo $optarg | sed 's/,/ /g'`; do
        case $i in
          libmpeg3)
            echo_videoprovider="$echo_videoprovider -Wl,-uIDirectFBVideoProvider_Libmpeg3 -lidirectfbvideoprovider_$i"
            echo_videoprovider="$echo_videoprovider -lmpeg3"
            ;;
          swf)
            echo_videoprovider="$echo_videoprovider -Wl,-uIDirectFBVideoProvider_SWF -lidirectfbvideoprovider_$i"
            echo_videoprovider="$echo_videoprovider -ljpeg -lz"
            ;;
          openquicktime)
            echo_videoprovider="$echo_videoprovider -Wl,-uIDirectFBVideoProvider_OpenQuicktime -lidirectfbvideoprovider_$i"
            echo_videoprovider="$echo_videoprovider -lopenquicktime -lz -lglib -lm"
            ;;
          *)
            echo_videoprovider="$echo_videoprovider -Wl,-uIDirectFBVideoProvider_$i -lidirectfbvideoprovider_$i"
            ;;
        esac
      done

      echo_static=yes
      ;;
    *)
      usage 1 1>&2
      ;;
  esac
  shift
done

if test "$echo_prefix" = "yes"; then
	echo $prefix
fi

if test "$echo_exec_prefix" = "yes"; then
	echo $exec_prefix
fi

if test "$echo_cflags" = "yes"; then
      if test @INCLUDEDIR@ != /usr/include ; then
        cflags="-I@INCLUDEDIR@"
      fi
      echo $cflags @THREADFLAGS@
fi

if test -n "$echo_static"; then
	echo -static -L$moduledir/systems -Wl,-udirectfb_fbdev -ldirectfb_fbdev
fi

if test -n "$echo_input"; then
	echo -L$moduledir/inputdrivers $echo_input
fi

if test -n "$echo_graphics"; then
	echo -L$moduledir/gfxdrivers $echo_graphics
fi

if test -n "$echo_font"; then
	echo -L$moduledir/interfaces/IDirectFBFont $echo_font
fi

if test -n "$echo_imageprovider"; then
	echo -L$moduledir/interfaces/IDirectFBImageProvider $echo_imageprovider
fi

if test -n "$echo_videoprovider"; then
	echo -L$moduledir/interfaces/IDirectFBVideoProvider $echo_videoprovider
fi

if test "$echo_libs" = "yes"; then
      libs=-L@libdir@

      if test "$lib_directfb" = "yes"; then
	 libs="$libs -ldirectfb @THREADLIB@"

	 if test -z "$echo_static"; then
	    libs="$libs @DYNLIB@"
	 fi
      fi

      if test "$lib_avifile" = "yes"; then
	 libs="$libs @AVIFILE_LIBS@"
      fi

      echo $libs
fi