1#!@SHELL@ 2# $Id: dialog-config.in,v 1.13 2019/09/26 00:50:46 tom Exp $ 3############################################################################## 4# Copyright (c) 2007-2012,2019 Thomas E. Dickey # 5# # 6# Permission is hereby granted, free of charge, to any person obtaining a # 7# copy of this software and associated documentation files (the "Software"), # 8# to deal in the Software without restriction, including without limitation # 9# the rights to use, copy, modify, merge, publish, distribute, distribute # 10# with modifications, sublicense, and/or sell copies of the Software, and to # 11# permit persons to whom the Software is furnished to do so, subject to the # 12# following conditions: # 13# # 14# The above copyright notice and this permission notice shall be included in # 15# all copies or substantial portions of the Software. # 16# # 17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # 18# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # 19# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 20# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # 21# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # 22# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # 23# DEALINGS IN THE SOFTWARE. # 24# # 25# Except as contained in this notice, the name(s) of the above copyright # 26# holders shall not be used in advertising or otherwise to promote the sale, # 27# use or other dealings in this Software without prior written # 28# authorization. # 29############################################################################## 30 31prefix="@prefix@" 32exec_prefix="@exec_prefix@" 33datarootdir="@datarootdir@" 34 35same_prefix=yes 36same_exec_prefix=yes 37 38THIS="@PACKAGE@" 39 40test $# = 0 && exec @SHELL@ "$0" --error 41 42while test $# -gt 0; do 43 44 # (re)evaluate symbols that may depend upon $prefix 45 if [ "x$same_prefix" != "xyes" ] 46 then 47 eval exec_prefix='@exec_prefix@' 48 eval datarootdir='@datarootdir@' 49 elif [ "x$same_exec_prefix" != "xyes" ] 50 then 51 eval datarootdir='@datarootdir@' 52 fi 53 54 eval bindir='"@bindir@"' 55 eval includedir='"@includedir@"' 56 eval libdir='"@libdir@"' 57 eval datadir='"@datadir@"' 58 eval mandir='"@mandir@"' 59 60 [ -z "$includedir" ] && includedir="${prefix}/include" 61 62 eval LDFLAGS='"@LDFLAGS@"' 63 eval LIBS='"@LIBS@"' 64 LIBS="-l${THIS} $LIBS" 65 66 # If the directory given by --libdir is not in the LDFLAGS+LIBS set, 67 # prepend it to LDFLAGS to help link this application's library. 68 found=no 69 for opt in $LDFLAGS $LIBS 70 do 71 if [ "x$-L${libdir}" = "x$opt" ] 72 then 73 found=yes 74 break 75 fi 76 done 77 if [ $found = no ] 78 then 79 [ -n "$LFLAGS" ] && LDFLAGS=" $LFDLAGS" 80 LDFLAGS="-L${libdir}$LDFLAGS" 81 fi 82 [ -z "$LDFLAGS" ] && LDFLAGS="-L${exec_prefix}/lib" 83 84 # Ignore -L options which do not correspond to an actual directory, 85 # or which are standard library directories (i.e., the linker is 86 # supposed to search those directories). 87 # 88 # There is no portable way to find the list of standard library 89 # directories. Require a POSIX shell anyway, to keep this simple. 90 lib_flags= 91 for opt in $LDFLAGS $LIBS 92 do 93 case $opt in 94 -L*) 95 [ -d ${opt##-L} ] || continue 96 case ${opt##-L} in 97 @LD_SEARCHPATH@) # skip standard libdir 98 continue 99 ;; 100 *) 101 ;; 102 esac 103 ;; 104 esac 105 lib_flags="$lib_flags $opt" 106 done 107 108 case "$1" in 109 -*=*) 110 ARG=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` 111 ;; 112 *) 113 ARG= 114 ;; 115 esac 116 117 case "$1" in 118 # basic configuration 119 --prefix=*) 120 prefix="$ARG" 121 test -z "$exec_prefix" && exec_prefix="$ARG" 122 same_prefix=no 123 ;; 124 --prefix) 125 echo "$prefix" 126 ;; 127 --exec-prefix=*) 128 exec_prefix="$ARG" 129 same_exec_prefix=no 130 ;; 131 --exec-prefix) 132 echo "$exec_prefix" 133 ;; 134 # compile/link 135 --cflags|--cflags-only-I) 136 INCS= 137 if test "$includedir" != /usr/include ; then 138 INCS="-I$includedir" 139 fi 140 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO 141 $INCS 142ENDECHO 143 ;; 144 --cflags-only-other) 145 # no -D/-U options should be needed 146 echo 147 ;; 148 --libs) 149 OPTS= 150 for opt in $lib_flags 151 do 152 [ -n "$OPTS" ] && OPTS="$OPTS " 153 OPTS="${OPTS}${opt}" 154 done 155 printf "%s\n" "$OPTS" 156 ;; 157 --libs-only-L) 158 OPTS= 159 for opt in $lib_flags 160 do 161 case "x$opt" in 162 x-L*) 163 [ -n "$OPTS" ] && OPTS="$OPTS " 164 OPTS="${OPTS}${opt}" 165 ;; 166 esac 167 done 168 printf "%s\n" "$OPTS" 169 ;; 170 --libs-only-l) 171 OPTS= 172 for opt in $lib_flags 173 do 174 case "x$opt" in 175 x-l*) 176 [ -n "$OPTS" ] && OPTS="$OPTS " 177 OPTS="${OPTS}${opt}" 178 ;; 179 esac 180 done 181 printf "%s\n" "$OPTS" 182 ;; 183 --libs-only-other) 184 OPTS= 185 for opt in $lib_flags 186 do 187 case "x$opt" in 188 x-[lL]*) 189 ;; 190 *) 191 [ -n "$OPTS" ] && OPTS="$OPTS " 192 OPTS="${OPTS}${opt}" 193 ;; 194 esac 195 done 196 printf "%s\n" "$OPTS" 197 ;; 198 # identification 199 --version) 200 echo "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@" 201 ;; 202 --abi-version) 203 echo "@VERSION@" | sed -e 's/:/./g' 204 ;; 205 # locations 206 --bindir) 207 echo "${bindir}" 208 ;; 209 --datadir) 210 echo "${datadir}" 211 ;; 212 --libdir) 213 echo "${libdir}" 214 ;; 215 --mandir) 216 echo "${mandir}" 217 ;; 218 # general info 219 --help) 220 cat <<ENDHELP 221Usage: ${THIS}-config [options] 222 223Options: 224 --prefix echos the package-prefix of ${THIS} 225 --prefix=ARG sets the package-prefix of ${THIS} 226 --exec-prefix echos the executable-prefix of ${THIS} 227 --exec-prefix=ARG sets the executable-prefix of ${THIS} 228 229 --cflags echos the C compiler flags needed to compile with ${THIS} 230 --libs echos the libraries needed to link with ${THIS} 231 232 --libs-only-L echos -L linker options (search path) for ${THIS} 233 --libs-only-l echos -l linker options (libraries) for ${THIS} 234 --libs-only-other echos linker options other than -L/-l 235 236 --version echos the release+patchdate version of ${THIS} 237 --abi-version echos the ABI version of ${THIS} 238 239 --bindir echos the directory containing ${THIS} programs 240 --datadir echos the directory containing ${THIS} data 241 --libdir echos the directory containing ${THIS} libraries 242 --mandir echos the directory containing ${THIS} manual pages 243 244 --help prints this message 245ENDHELP 246 ;; 247 --error|*) 248 @SHELL@ "$0" --help 1>&2 249 exit 1 250 ;; 251 esac 252 shift 253done 254# vile:shmode 255