1#!@SHELL@ 2# $Id: ncurses-config.in,v 1.43 2020/02/02 23:34:34 tom Exp $ 3############################################################################## 4# Copyright 2018-2019,2020 Thomas E. Dickey # 5# Copyright 2006-2015,2017 Free Software Foundation, Inc. # 6# # 7# Permission is hereby granted, free of charge, to any person obtaining a # 8# copy of this software and associated documentation files (the "Software"), # 9# to deal in the Software without restriction, including without limitation # 10# the rights to use, copy, modify, merge, publish, distribute, distribute # 11# with modifications, sublicense, and/or sell copies of the Software, and to # 12# permit persons to whom the Software is furnished to do so, subject to the # 13# following conditions: # 14# # 15# The above copyright notice and this permission notice shall be included in # 16# all copies or substantial portions of the Software. # 17# # 18# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # 19# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # 20# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 21# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # 22# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # 23# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # 24# DEALINGS IN THE SOFTWARE. # 25# # 26# Except as contained in this notice, the name(s) of the above copyright # 27# holders shall not be used in advertising or otherwise to promote the sale, # 28# use or other dealings in this Software without prior written # 29# authorization. # 30############################################################################## 31# 32# Author: Thomas E. Dickey, 2006-on 33 34LANG=C; export LANG 35LANGUAGE=C; export LANGUAGE 36LC_ALL=C; export LC_ALL 37LC_CTYPE=C; export LC_CTYPE 38 39prefix="@prefix@" 40exec_prefix="@exec_prefix@" 41 42bindir="@bindir@" 43includedir="@includedir@" 44libdir="@libdir@" 45datarootdir="@datarootdir@" 46datadir="@datadir@" 47mandir="@mandir@" 48 49THIS="@LIB_NAME@@USE_LIB_SUFFIX@" 50TINFO_LIB="@TINFO_ARG_SUFFIX@" 51RPATH_LIST="@RPATH_LIST@" 52 53includesubdir="@includedir@/${THIS}" 54 55# Ensure that RPATH_LIST contains only absolute pathnames, if it is nonempty. 56# We cannot filter it out within the build-process since the variable is used 57# in some special cases of installation using a relative path. 58if [ -n "$RPATH_LIST" ] 59then 60 save_IFS="$IFS" 61 IFS='@PATH_SEPARATOR@' 62 filtered= 63 for item in $RPATH_LIST 64 do 65 case "$item" in 66 ./*|../*|*/..|*/../*) 67 ;; 68 *) 69 [ -n "$filtered" ] && filtered="${filtered}@PATH_SEPARATOR@" 70 filtered="${filtered}${item}" 71 ;; 72 esac 73 done 74 IFS="$save_IFS" 75 # if the result is empty, there is little we can do to fix it 76 RPATH_LIST="$filtered" 77fi 78 79# with --disable-overwrite, we installed into a subdirectory, but transformed 80# the headers to include like this: 81# <ncurses@LIB_SUFFIX@/curses.h> 82if [ x@WITH_OVERWRITE@ = xno ]; then 83 case $includedir in 84 $prefix/include/ncurses@LIB_SUFFIX@@EXTRA_SUFFIX@) 85 includedir=`echo "$includedir" | sed -e 's,/[^/]*$,,'` 86 ;; 87 esac 88fi 89 90LIBS="@LIBS@" 91if [ "@TINFO_NAME@" = "@LIB_NAME@" ]; then 92 LIBS="-l${THIS} $LIBS" 93else 94 LIBS="-l${THIS} -l${TINFO_LIB} $LIBS" 95fi 96 97# Ignore -L options which do not correspond to an actual directory, or which 98# are standard library directories (i.e., the linker is supposed to search 99# those directories). 100# 101# There is no portable way to find the list of standard library directories. 102# Require a POSIX shell anyway, to keep this simple. 103lib_flags= 104for opt in -L$libdir @LDFLAGS@ @EXTRA_LDFLAGS@ $LIBS 105do 106 case $opt in 107 -specs*) # ignore linker specs-files which were used to build library 108 continue 109 ;; 110 -Wl,-z,*) # ignore flags used to manipulate shared image 111 continue 112 ;; 113 -L*) 114 [ -d ${opt##-L} ] || continue 115 case ${opt##-L} in 116 @LD_SEARCHPATH@) # skip standard libdir 117 continue 118 ;; 119 *) 120 found=no 121 for check in $lib_flags 122 do 123 if [ "x$check" = "x$opt" ] 124 then 125 found=yes 126 break 127 fi 128 done 129 [ $found = yes ] && continue 130 ;; 131 esac 132 ;; 133 esac 134 lib_flags="$lib_flags $opt" 135done 136 137[ $# = 0 ] && exec @SHELL@ $0 --error 138 139while [ $# -gt 0 ]; do 140 case "$1" in 141 # basic configuration 142 --prefix) 143 echo "$prefix" 144 ;; 145 --exec-prefix) 146 echo "$exec_prefix" 147 ;; 148 # compile/link 149 --cflags) 150 INCS="@PKG_CFLAGS@" 151 if [ "x@WITH_OVERWRITE@" = xno ]; then 152 INCS="$INCS -I${includesubdir}" 153 fi 154 if [ "${includedir}" != /usr/include ]; then 155 INCS="$INCS -I${includedir}" 156 fi 157 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO 158 $INCS 159ENDECHO 160 ;; 161 --libs) 162 OPTS= 163 for opt in $lib_flags 164 do 165 [ -n "$OPTS" ] && OPTS="$OPTS " 166 OPTS="${OPTS}${opt}" 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-l) 184 OPTS= 185 for opt in $lib_flags 186 do 187 case "x$opt" in 188 x-l*) 189 [ -n "$OPTS" ] && OPTS="$OPTS " 190 OPTS="${OPTS}${opt}" 191 ;; 192 esac 193 done 194 printf "%s\n" "$OPTS" 195 ;; 196 --libs-only-other) 197 OPTS= 198 for opt in $lib_flags 199 do 200 case "x$opt" in 201 x-[lL]*) 202 ;; 203 *) 204 [ -n "$OPTS" ] && OPTS="$OPTS " 205 OPTS="${OPTS}${opt}" 206 ;; 207 esac 208 done 209 printf "%s\n" "$OPTS" 210 ;; 211 # identification 212 --version) 213 echo "@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@" 214 ;; 215 --abi-version) 216 echo "@cf_cv_abi_version@" 217 ;; 218 --mouse-version) 219 echo "@NCURSES_MOUSE_VERSION@" 220 ;; 221 # locations 222 --bindir) 223 echo "${bindir}" 224 ;; 225 --datadir) 226 echo "${datadir}" 227 ;; 228 --includedir) 229 INCS= 230 if [ "x@WITH_OVERWRITE@" = xno ]; then 231 INCS="${includesubdir}" 232 elif [ "${includedir}" != /usr/include ]; then 233 INCS="${includedir}" 234 fi 235 echo $INCS 236 ;; 237 --libdir) 238 echo "${libdir}" 239 ;; 240 --mandir) 241 echo "${mandir}" 242 ;; 243 --terminfo) 244 echo "@TERMINFO@" 245 ;; 246 --terminfo-dirs) 247 echo "@TERMINFO_DIRS@" 248 ;; 249 --termpath) 250 echo "@TERMPATH@" 251 ;; 252 # general info 253 --help) 254 cat <<ENDHELP 255Usage: `basename $0` [options] 256 257Options: 258 --prefix echos the package-prefix of ${THIS} 259 --exec-prefix echos the executable-prefix of ${THIS} 260 261 --cflags echos the C compiler flags needed to compile with ${THIS} 262 --libs echos the libraries needed to link with ${THIS} 263 264 --libs-only-L echos -L linker options (search path) for ${THIS} 265 --libs-only-l echos -l linker options (libraries) for ${THIS} 266 --libs-only-other echos linker options other than -L/-l 267 268 --version echos the release+patchdate version of ${THIS} 269 --abi-version echos the ABI version of ${THIS} 270 --mouse-version echos the mouse-interface version of ${THIS} 271 272 --bindir echos the directory containing ${THIS} programs 273 --datadir echos the directory containing ${THIS} data 274 --includedir echos the directory containing ${THIS} header files 275 --libdir echos the directory containing ${THIS} libraries 276 --mandir echos the directory containing ${THIS} manpages 277 --terminfo echos the \$TERMINFO terminfo database path 278 --terminfo-dirs echos the \$TERMINFO_DIRS directory list 279 --termpath echos the \$TERMPATH termcap list 280 281 --help prints this message 282ENDHELP 283 ;; 284 --error|*) 285 @SHELL@ $0 --help 1>&2 286 exit 1 287 ;; 288 esac 289 shift 290done 291# vi:ts=4 sw=4 292# vile:shmode 293