blob: 74271c08805f475f61918981968c68b5afec3afc [file] [log] [blame]
Nick Kralevichf73ff172014-09-27 12:41:49 -07001#!/bin/sh
2
3prefix=@prefix@
4exec_prefix=@exec_prefix@
5exec_prefix_set=no
6
7cflags="[--cflags]"
Janis Danisevskis112c9cc2016-03-31 13:35:25 +01008libs=
Nick Kralevichf73ff172014-09-27 12:41:49 -07009
Janis Danisevskis112c9cc2016-03-31 13:35:25 +010010if test @enable_pcre2_16@ = yes ; then
Nick Kralevichf73ff172014-09-27 12:41:49 -070011 libs="[--libs16] $libs"
12fi
13
Janis Danisevskis112c9cc2016-03-31 13:35:25 +010014if test @enable_pcre2_32@ = yes ; then
Nick Kralevichf73ff172014-09-27 12:41:49 -070015 libs="[--libs32] $libs"
16fi
17
Janis Danisevskis112c9cc2016-03-31 13:35:25 +010018if test @enable_pcre2_8@ = yes ; then
19 libs="[--libs8] [--libs-posix] $libs"
Nick Kralevichf73ff172014-09-27 12:41:49 -070020 cflags="$cflags [--cflags-posix]"
21fi
22
Janis Danisevskis112c9cc2016-03-31 13:35:25 +010023usage="Usage: pcre2-config [--prefix] [--exec-prefix] [--version] $libs $cflags"
Nick Kralevichf73ff172014-09-27 12:41:49 -070024
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
Janis Danisevskis112c9cc2016-03-31 13:35:25 +010075 echo $includes @PCRE2_STATIC_CFLAG@
Nick Kralevichf73ff172014-09-27 12:41:49 -070076 ;;
77 --cflags-posix)
Janis Danisevskis112c9cc2016-03-31 13:35:25 +010078 if test @enable_pcre2_8@ = yes ; then
Nick Kralevichf73ff172014-09-27 12:41:49 -070079 if test @includedir@ != /usr/include ; then
80 includes=-I@includedir@
81 fi
Janis Danisevskis112c9cc2016-03-31 13:35:25 +010082 echo $includes @PCRE2_STATIC_CFLAG@
Nick Kralevichf73ff172014-09-27 12:41:49 -070083 else
84 echo "${usage}" 1>&2
85 fi
86 ;;
87 --libs-posix)
Janis Danisevskis112c9cc2016-03-31 13:35:25 +010088 if test @enable_pcre2_8@ = yes ; then
Elliott Hughes9bc971b2018-07-27 13:23:14 -070089 echo $libS$libR -lpcre2-posix -lpcre2-8
Nick Kralevichf73ff172014-09-27 12:41:49 -070090 else
91 echo "${usage}" 1>&2
92 fi
93 ;;
Janis Danisevskis112c9cc2016-03-31 13:35:25 +010094 --libs8)
95 if test @enable_pcre2_8@ = yes ; then
96 echo $libS$libR -lpcre2-8
Nick Kralevichf73ff172014-09-27 12:41:49 -070097 else
98 echo "${usage}" 1>&2
99 fi
100 ;;
101 --libs16)
Janis Danisevskis112c9cc2016-03-31 13:35:25 +0100102 if test @enable_pcre2_16@ = yes ; then
103 echo $libS$libR -lpcre2-16
Nick Kralevichf73ff172014-09-27 12:41:49 -0700104 else
105 echo "${usage}" 1>&2
106 fi
107 ;;
108 --libs32)
Janis Danisevskis112c9cc2016-03-31 13:35:25 +0100109 if test @enable_pcre2_32@ = yes ; then
110 echo $libS$libR -lpcre2-32
Nick Kralevichf73ff172014-09-27 12:41:49 -0700111 else
112 echo "${usage}" 1>&2
113 fi
114 ;;
115 *)
116 echo "${usage}" 1>&2
117 exit 1
118 ;;
119 esac
120 shift
121done