1#!/bin/sh
2
3prefix=@prefix@
4exec_prefix=@exec_prefix@
5exec_prefix_set=no
6
7cflags="[--cflags]"
8
9if test @enable_cpp@ = yes ; then
10  libs="[--libs-cpp]"
11else
12  libs=
13fi
14
15if test @enable_pcre16@ = yes ; then
16  libs="[--libs16] $libs"
17fi
18
19if test @enable_pcre32@ = yes ; then
20  libs="[--libs32] $libs"
21fi
22
23if test @enable_pcre8@ = yes ; then
24  libs="[--libs] [--libs-posix] $libs"
25  cflags="$cflags [--cflags-posix]"
26fi
27
28usage="Usage: pcre-config [--prefix] [--exec-prefix] [--version] $libs $cflags"
29
30if test $# -eq 0; then
31      echo "${usage}" 1>&2
32      exit 1
33fi
34
35libR=
36case `uname -s` in
37  *SunOS*)
38  libR=" -R@libdir@"
39  ;;
40  *BSD*)
41  libR=" -Wl,-R@libdir@"
42  ;;
43esac
44
45libS=
46if test @libdir@ != /usr/lib ; then
47  libS=-L@libdir@
48fi
49
50while test $# -gt 0; do
51  case "$1" in
52  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
53  *) optarg= ;;
54  esac
55
56  case $1 in
57    --prefix=*)
58      prefix=$optarg
59      if test $exec_prefix_set = no ; then
60        exec_prefix=$optarg
61      fi
62      ;;
63    --prefix)
64      echo $prefix
65      ;;
66    --exec-prefix=*)
67      exec_prefix=$optarg
68      exec_prefix_set=yes
69      ;;
70    --exec-prefix)
71      echo $exec_prefix
72      ;;
73    --version)
74      echo @PACKAGE_VERSION@
75      ;;
76    --cflags)
77      if test @includedir@ != /usr/include ; then
78        includes=-I@includedir@
79      fi
80      echo $includes @PCRE_STATIC_CFLAG@
81      ;;
82    --cflags-posix)
83      if test @enable_pcre8@ = yes ; then
84        if test @includedir@ != /usr/include ; then
85          includes=-I@includedir@
86        fi
87        echo $includes @PCRE_STATIC_CFLAG@
88      else
89        echo "${usage}" 1>&2
90      fi
91      ;;
92    --libs-posix)
93      if test @enable_pcre8@ = yes ; then
94        echo $libS$libR -lpcreposix -lpcre
95      else
96        echo "${usage}" 1>&2
97      fi
98      ;;
99    --libs)
100      if test @enable_pcre8@ = yes ; then
101        echo $libS$libR -lpcre
102      else
103        echo "${usage}" 1>&2
104      fi
105      ;;
106    --libs16)
107      if test @enable_pcre16@ = yes ; then
108        echo $libS$libR -lpcre16
109      else
110        echo "${usage}" 1>&2
111      fi
112      ;;
113    --libs32)
114      if test @enable_pcre32@ = yes ; then
115        echo $libS$libR -lpcre32
116      else
117        echo "${usage}" 1>&2
118      fi
119      ;;
120    --libs-cpp)
121      if test @enable_cpp@ = yes ; then
122        echo $libS$libR -lpcrecpp -lpcre
123      else
124        echo "${usage}" 1>&2
125      fi
126      ;;
127    *)
128      echo "${usage}" 1>&2
129      exit 1
130      ;;
131  esac
132  shift
133done
134