Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | prefix=@prefix@ |
| 4 | exec_prefix=@exec_prefix@ |
| 5 | exec_prefix_set=no |
| 6 | |
| 7 | cflags="[--cflags]" |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 8 | libs= |
Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 9 | |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 10 | if test @enable_pcre2_16@ = yes ; then |
Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 11 | libs="[--libs16] $libs" |
| 12 | fi |
| 13 | |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 14 | if test @enable_pcre2_32@ = yes ; then |
Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 15 | libs="[--libs32] $libs" |
| 16 | fi |
| 17 | |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 18 | if test @enable_pcre2_8@ = yes ; then |
| 19 | libs="[--libs8] [--libs-posix] $libs" |
Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 20 | cflags="$cflags [--cflags-posix]" |
| 21 | fi |
| 22 | |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 23 | usage="Usage: pcre2-config [--prefix] [--exec-prefix] [--version] $libs $cflags" |
Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 24 | |
| 25 | if test $# -eq 0; then |
| 26 | echo "${usage}" 1>&2 |
| 27 | exit 1 |
| 28 | fi |
| 29 | |
| 30 | libR= |
| 31 | case `uname -s` in |
| 32 | *SunOS*) |
| 33 | libR=" -R@libdir@" |
| 34 | ;; |
| 35 | *BSD*) |
| 36 | libR=" -Wl,-R@libdir@" |
| 37 | ;; |
| 38 | esac |
| 39 | |
| 40 | libS= |
| 41 | if test @libdir@ != /usr/lib ; then |
| 42 | libS=-L@libdir@ |
| 43 | fi |
| 44 | |
| 45 | while 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 Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 75 | echo $includes @PCRE2_STATIC_CFLAG@ |
Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 76 | ;; |
| 77 | --cflags-posix) |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 78 | if test @enable_pcre2_8@ = yes ; then |
Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 79 | if test @includedir@ != /usr/include ; then |
| 80 | includes=-I@includedir@ |
| 81 | fi |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 82 | echo $includes @PCRE2_STATIC_CFLAG@ |
Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 83 | else |
| 84 | echo "${usage}" 1>&2 |
| 85 | fi |
| 86 | ;; |
| 87 | --libs-posix) |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 88 | if test @enable_pcre2_8@ = yes ; then |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 89 | echo $libS$libR -lpcre2-posix -lpcre2-8 |
Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 90 | else |
| 91 | echo "${usage}" 1>&2 |
| 92 | fi |
| 93 | ;; |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 94 | --libs8) |
| 95 | if test @enable_pcre2_8@ = yes ; then |
| 96 | echo $libS$libR -lpcre2-8 |
Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 97 | else |
| 98 | echo "${usage}" 1>&2 |
| 99 | fi |
| 100 | ;; |
| 101 | --libs16) |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 102 | if test @enable_pcre2_16@ = yes ; then |
| 103 | echo $libS$libR -lpcre2-16 |
Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 104 | else |
| 105 | echo "${usage}" 1>&2 |
| 106 | fi |
| 107 | ;; |
| 108 | --libs32) |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 109 | if test @enable_pcre2_32@ = yes ; then |
| 110 | echo $libS$libR -lpcre2-32 |
Nick Kralevich | f73ff17 | 2014-09-27 12:41:49 -0700 | [diff] [blame] | 111 | else |
| 112 | echo "${usage}" 1>&2 |
| 113 | fi |
| 114 | ;; |
| 115 | *) |
| 116 | echo "${usage}" 1>&2 |
| 117 | exit 1 |
| 118 | ;; |
| 119 | esac |
| 120 | shift |
| 121 | done |