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