• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2#
3# Copyright (C) 2000-2019 by
4# David Turner, Robert Wilhelm, and Werner Lemberg.
5#
6# This file is part of the FreeType project, and may only be used, modified,
7# and distributed under the terms of the FreeType project license,
8# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
9# indicate that you have read the license and understand and accept it
10# fully.
11
12LC_ALL=C
13export LC_ALL
14
15
16# if `pkg-config' is available, use values from `freetype2.pc'
17%PKG_CONFIG% --atleast-pkgconfig-version 0.24 >/dev/null 2>&1
18if test $? -eq 0 ; then
19  # note that option `--variable' is not affected by the
20  # PKG_CONFIG_SYSROOT_DIR environment variable
21  if test "x$SYSROOT" != "x" ; then
22    PKG_CONFIG_SYSROOT_DIR="$SYSROOT"
23    export PKG_CONFIG_SYSROOT_DIR
24  fi
25
26  prefix=`%PKG_CONFIG% --variable prefix freetype2`
27  exec_prefix=`%PKG_CONFIG% --variable exec_prefix freetype2`
28
29  includedir=`%PKG_CONFIG% --variable includedir freetype2`
30  libdir=`%PKG_CONFIG% --variable libdir freetype2`
31
32  version=`%PKG_CONFIG% --modversion freetype2`
33
34  cflags=`%PKG_CONFIG% --cflags freetype2`
35  dynamic_libs=`%PKG_CONFIG% --libs freetype2`
36  static_libs=`%PKG_CONFIG% --static --libs freetype2`
37else
38  prefix="%prefix%"
39  exec_prefix="%exec_prefix%"
40
41  includedir="%includedir%"
42  libdir="%libdir%"
43
44  version=%ft_version%
45
46  cflags="-I${SYSROOT}$includedir/freetype2"
47  dynamic_libs="-lfreetype"
48  static_libs="%LIBSSTATIC_CONFIG%"
49  if test "${SYSROOT}$libdir" != "/usr/lib"   &&
50     test "${SYSROOT}$libdir" != "/usr/lib64" ; then
51    libs_L="-L${SYSROOT}$libdir"
52  fi
53fi
54
55orig_prefix=$prefix
56orig_exec_prefix=$exec_prefix
57
58orig_includedir=$includedir
59orig_libdir=$libdir
60
61include_suffix=`echo $includedir | sed "s|$prefix||"`
62lib_suffix=`echo $libdir | sed "s|$exec_prefix||"`
63
64
65usage()
66{
67  cat <<EOF
68Usage: freetype-config [OPTION]...
69Get FreeType compilation and linking information.
70
71Options:
72  --prefix               display \`--prefix' value used for building the
73                         FreeType library
74  --prefix=PREFIX        override \`--prefix' value with PREFIX
75  --exec-prefix          display \`--exec-prefix' value used for building
76                         the FreeType library
77  --exec-prefix=EPREFIX  override \`--exec-prefix' value with EPREFIX
78  --version              display libtool version of the FreeType library
79  --ftversion            display FreeType version number
80  --libs                 display flags for linking with the FreeType library
81  --libtool              display library name for linking with libtool
82  --cflags               display flags for compiling with the FreeType
83                         library
84  --static               make command line options display flags
85                         for static linking
86  --help                 display this help and exit
87EOF
88  exit $1
89}
90
91
92if test $# -eq 0 ; then
93  usage 1 1>&2
94fi
95
96
97while test $# -gt 0 ; do
98  case "$1" in
99  -*=*)
100    optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
101    ;;
102  *)
103    optarg=
104    ;;
105  esac
106
107  case $1 in
108  --prefix=*)
109    prefix=$optarg
110    local_prefix=yes
111    ;;
112  --prefix)
113    echo_prefix=yes
114    ;;
115  --exec-prefix=*)
116    exec_prefix=$optarg
117    exec_prefix_set=yes
118    local_prefix=yes
119    ;;
120  --exec-prefix)
121    echo_exec_prefix=yes
122    ;;
123  --version)
124    echo_version=yes
125    break
126    ;;
127  --ftversion)
128    echo_ft_version=yes
129    ;;
130  --cflags)
131    echo_cflags=yes
132    ;;
133  --libs)
134    echo_libs=yes
135    ;;
136  --libtool)
137    echo_libtool=yes
138    ;;
139  --static)
140    show_static=yes
141    ;;
142  --help)
143    usage 0
144    ;;
145  *)
146    usage 1 1>&2
147    ;;
148  esac
149  shift
150done
151
152
153if test "$local_prefix" = "yes" ; then
154  if test "$exec_prefix_set" != "yes" ; then
155    exec_prefix=$prefix
156  fi
157fi
158
159if test "$local_prefix" = "yes" ; then
160  includedir=${prefix}${include_suffix}
161  if test "$exec_prefix_set" = "yes" ; then
162    libdir=${exec_prefix}${lib_suffix}
163  else
164    libdir=${prefix}${lib_suffix}
165  fi
166fi
167
168
169if test "$echo_version" = "yes" ; then
170  echo $version
171fi
172
173if test "$echo_prefix" = "yes" ; then
174  echo ${SYSROOT}$prefix
175fi
176
177if test "$echo_exec_prefix" = "yes" ; then
178  echo ${SYSROOT}$exec_prefix
179fi
180
181if test "$echo_ft_version" = "yes" ; then
182  major=`grep define ${SYSROOT}$includedir/freetype2/freetype/freetype.h \
183         | grep FREETYPE_MAJOR \
184         | sed 's/.*[ 	]\([0-9][0-9]*\).*/\1/'`
185  minor=`grep define ${SYSROOT}$includedir/freetype2/freetype/freetype.h \
186         | grep FREETYPE_MINOR \
187         | sed 's/.*[ 	]\([0-9][0-9]*\).*/\1/'`
188  patch=`grep define ${SYSROOT}$includedir/freetype2/freetype/freetype.h \
189         | grep FREETYPE_PATCH \
190         | sed 's/.*[ 	]\([0-9][0-9]*\).*/\1/'`
191  echo $major.$minor.$patch
192fi
193
194if test "$echo_cflags" = "yes" ; then
195  echo $cflags | sed "s|$orig_includedir/freetype2|$includedir/freetype2|"
196fi
197
198if test "$echo_libs" = "yes" ; then
199  if test "$show_static" = "yes" ; then
200    libs="$libs_L $static_libs"
201  else
202    libs="$libs_L $dynamic_libs"
203  fi
204  echo $libs | sed "s|$orig_libdir|$libdir|"
205fi
206
207if test "$echo_libtool" = "yes" ; then
208  echo ${SYSROOT}$libdir/libfreetype.la
209fi
210
211# EOF
212