1#!@SHELL@ 2# $Id: ncurses-config.in,v 1.63 2025/11/22 19:19:28 tom Exp $ 3############################################################################## 4# Copyright 2018-2024,2025 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 49CURSES_LIB="@LIB_NAME@@ABI_SUFFIX@" 50TINFO_LIB="@TINFO_ARG_SUFFIX@" 51RPATH_LIST="@RPATH_LIST@" 52 53# Ensure that RPATH_LIST contains only absolute pathnames, if it is nonempty. 54# We cannot filter it out within the build-process since the variable is used 55# in some special cases of installation using a relative path. 56if [ -n "$RPATH_LIST" ] 57then 58 save_IFS="$IFS" 59 IFS='@PATH_SEPARATOR@' 60 filtered= 61 for item in $RPATH_LIST 62 do 63 case "$item" in 64 ./*|../*|*/..|*/../*) 65 ;; 66 *) 67 [ -n "$filtered" ] && filtered="${filtered}@PATH_SEPARATOR@" 68 filtered="${filtered}${item}" 69 ;; 70 esac 71 done 72 IFS="$save_IFS" 73 # if the result is empty, there is little we can do to fix it 74 RPATH_LIST="$filtered" 75fi 76 77# with --disable-overwrite, we installed into a subdirectory, but transformed 78# the headers to include like this: 79# <ncurses@LIB_SUFFIX@/curses.h> 80if [ x@WITH_OVERWRITE@ = xno ]; then 81 includesubdir="@includedir@/${CURSES_LIB}" 82 case $includedir in 83 $prefix/include/ncurses@LIB_SUFFIX@@EXTRA_SUFFIX@) 84 includedir=`echo "$includedir" | sed -e 's,/[^/]*$,,'` 85 ;; 86 esac 87else 88 includesubdir="@includedir@" 89fi 90 91LIBS="@LIBS@" 92if [ "@TINFO_NAME@" = "@LIB_NAME@" ]; then 93 LIBS="-l${CURSES_LIB} $LIBS" 94else 95 LIBS="-l${CURSES_LIB} -l${TINFO_LIB} $LIBS" 96fi 97 98CFLAGS="@PKG_CFLAGS@" 99if [ "$includesubdir" != "/usr/include" ]; then 100 CFLAGS="$CFLAGS -I${includesubdir}" 101 if [ "$includedir" != "/usr/include" ]; then 102 [ x@WITH_OVERWRITE@ = xno ] && CFLAGS="$CFLAGS -I${includedir}" 103 fi 104fi 105 106# Ignore -L options which do not correspond to an actual directory, or which 107# are standard library directories (i.e., the linker is supposed to search 108# those directories). 109# 110# There is no portable way to find the list of standard library directories. 111# Require a POSIX shell anyway, to keep this simple. 112lib_flags= 113for opt in -L$libdir @EXTRA_PKG_LDFLAGS@ $LIBS 114do 115 case $opt in 116 -specs*) # ignore linker specs-files which were used to build library 117 continue 118 ;; 119 -Wl,-z*) # ignore flags used to manipulate shared image 120 continue 121 ;; 122 -Wl,--dynamic-linker*) # ignore ELF interpreter 123 continue 124 ;; 125 -Wl,--as-needed|-Wl,--build-id=*|-Wl,-dT,*|-Wl,-T,*) 126 continue 127 ;; 128 -L*) 129 lib_check=`echo "x$opt" | sed -e 's/^.-L//'` 130 [ -d "$lib_check" ] || continue 131 case "$lib_check" in 132 @LD_SEARCHPATH@) # skip standard libdir 133 if [ "$lib_check" = "$libdir" ] 134 then 135 lib_first=no 136 IFS_save="$IFS" 137 IFS='|' 138 LIBDIRS="@LD_SEARCHPATH@" 139 for lib_check in $LIBDIRS 140 do 141 if [ -d "$lib_check" ] 142 then 143 if [ "$lib_check" = "$libdir" ] 144 then 145 lib_first=yes 146 break 147 fi 148 fi 149 done 150 IFS="$IFS_save" 151 [ $lib_first = yes ] && continue 152 found=no 153 for check in $lib_flags 154 do 155 if [ "x$check" = "x$opt" ] 156 then 157 found=yes 158 break 159 fi 160 done 161 [ $found = yes ] && continue 162 : 163 else 164 continue 165 fi 166 ;; 167 *) 168 found=no 169 for check in $lib_flags 170 do 171 if [ "x$check" = "x$opt" ] 172 then 173 found=yes 174 break 175 fi 176 done 177 [ $found = yes ] && continue 178 ;; 179 esac 180 ;; 181 esac 182 lib_flags="$lib_flags $opt" 183done 184 185[ $# = 0 ] && exec @SHELL@ "$0" --error 186 187while [ $# -gt 0 ]; do 188 case "$1" in 189 # basic configuration 190 --prefix) 191 echo "$prefix" 192 ;; 193 --exec-prefix) 194 echo "$exec_prefix" 195 ;; 196 # compile/link 197 --cflags) 198 OPTS= 199 for opt in $CFLAGS 200 do 201 case "x$opt" in 202 x-[fgOW]*) 203 opt= 204 ;; 205 esac 206 if [ -n "$opt" ] 207 then 208 [ -n "$OPTS" ] && OPTS="$OPTS " 209 OPTS="$OPTS$opt" 210 fi 211 done 212 printf "%s\n" "$OPTS" 213 ;; 214 --cflags-only-I) 215 OPTS= 216 for opt in $CFLAGS 217 do 218 case "x$opt" in 219 x-[I]*) 220 ;; 221 *) 222 opt= 223 ;; 224 esac 225 if [ -n "$opt" ] 226 then 227 [ -n "$OPTS" ] && OPTS="$OPTS " 228 OPTS="$OPTS$opt" 229 fi 230 done 231 printf "%s\n" "$OPTS" 232 ;; 233 --cflags-only-other) 234 OPTS= 235 for opt in $CFLAGS 236 do 237 case "x$opt" in 238 x-[I]*|x-[fgOW]*) 239 opt= 240 ;; 241 esac 242 if [ -n "$opt" ] 243 then 244 [ -n "$OPTS" ] && OPTS="$OPTS " 245 OPTS="$OPTS$opt" 246 fi 247 done 248 printf "%s\n" "$OPTS" 249 ;; 250 --libs) 251 OPTS= 252 for opt in $lib_flags 253 do 254 [ -n "$OPTS" ] && OPTS="$OPTS " 255 OPTS="${OPTS}${opt}" 256 done 257 printf '%s\n' "$OPTS" 258 ;; 259 --libs-only-L) 260 OPTS= 261 for opt in $lib_flags 262 do 263 case "x$opt" in 264 x-L*) 265 [ -n "$OPTS" ] && OPTS="$OPTS " 266 OPTS="${OPTS}${opt}" 267 ;; 268 esac 269 done 270 printf '%s\n' "$OPTS" 271 ;; 272 --libs-only-l) 273 OPTS= 274 for opt in $lib_flags 275 do 276 case "x$opt" in 277 x-l*) 278 [ -n "$OPTS" ] && OPTS="$OPTS " 279 OPTS="${OPTS}${opt}" 280 ;; 281 esac 282 done 283 printf '%s\n' "$OPTS" 284 ;; 285 --libs-only-other) 286 OPTS= 287 for opt in $lib_flags 288 do 289 case "x$opt" in 290 x-[lL]*) 291 ;; 292 *) 293 [ -n "$OPTS" ] && OPTS="$OPTS " 294 OPTS="${OPTS}${opt}" 295 ;; 296 esac 297 done 298 printf '%s\n' "$OPTS" 299 ;; 300 # identification 301 --version) 302 echo "@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@" 303 ;; 304 --abi-version) 305 echo "@cf_cv_abi_version@" 306 ;; 307 --mouse-version) 308 echo "@NCURSES_MOUSE_VERSION@" 309 ;; 310 # locations 311 --bindir) 312 echo "${bindir}" 313 ;; 314 --datadir) 315 echo "${datadir}" 316 ;; 317 --includedir) 318 INCS= 319 if [ "x@WITH_OVERWRITE@" = xno ]; then 320 INCS="${includesubdir}" 321 elif [ "${includedir}" != /usr/include ]; then 322 INCS="${includedir}" 323 fi 324 echo "$INCS" 325 ;; 326 --libdir) 327 echo "${libdir}" 328 ;; 329 --mandir) 330 echo "${mandir}" 331 ;; 332 --terminfo) 333 echo "@TERMINFO@" 334 ;; 335 --terminfo-dirs) 336 echo "@TERMINFO_DIRS@" 337 ;; 338 --termpath) 339 echo "@TERMPATH@" 340 ;; 341 # general info 342 --help) 343 cat <<ENDHELP 344Usage: `basename "$0"` [options] 345 346Options: 347 --prefix echoes the package-prefix of ${CURSES_LIB} 348 --exec-prefix echoes the executable-prefix of ${CURSES_LIB} 349 350 --cflags echoes the C compiler flags needed to compile for ${CURSES_LIB} 351 --cflags-only-I echoes only -I C compiler flags needed with ${CURSES_LIB} 352 --cflags-only-other echoes only C compiler flags other than -I for ${CURSES_LIB} 353 --libs echoes the libraries needed to link with ${CURSES_LIB} 354 355 --libs-only-L echoes -L linker options (search path) for ${CURSES_LIB} 356 --libs-only-l echoes -l linker options (libraries) for ${CURSES_LIB} 357 --libs-only-other echoes linker options other than -L/-l 358 359 --version echoes the release+patchdate version of ${CURSES_LIB} 360 --abi-version echoes the ABI version of ${CURSES_LIB} 361 --mouse-version echoes the mouse-interface version of ${CURSES_LIB} 362 363 --bindir echoes the directory containing ${CURSES_LIB} programs 364 --datadir echoes the directory containing ${CURSES_LIB} data 365 --includedir echoes the directory containing ${CURSES_LIB} header files 366 --libdir echoes the directory containing ${CURSES_LIB} libraries 367 --mandir echoes the directory containing ${CURSES_LIB} man pages 368 --terminfo echoes the \$TERMINFO terminfo database path 369 --terminfo-dirs echoes the \$TERMINFO_DIRS directory list 370 --termpath echoes the \$TERMPATH termcap list 371 372 --help prints this message 373ENDHELP 374 ;; 375 --error|*) 376 @SHELL@ "$0" --help 1>&2 377 exit 1 378 ;; 379 esac 380 shift 381done 382# vi:ts=4 sw=4 383# vile:shmode 384