14a1a9510SRong-En Fan#!@SHELL@ 2*aae38d10SBaptiste Daroussin# $Id: ncurses-config.in,v 1.42 2019/12/25 00:54:55 tom Exp $ 34a1a9510SRong-En Fan############################################################################## 4*aae38d10SBaptiste Daroussin# Copyright (c) 2006-2018,2019 Free Software Foundation, Inc. # 54a1a9510SRong-En Fan# # 64a1a9510SRong-En Fan# Permission is hereby granted, free of charge, to any person obtaining a # 74a1a9510SRong-En Fan# copy of this software and associated documentation files (the "Software"), # 84a1a9510SRong-En Fan# to deal in the Software without restriction, including without limitation # 94a1a9510SRong-En Fan# the rights to use, copy, modify, merge, publish, distribute, distribute # 104a1a9510SRong-En Fan# with modifications, sublicense, and/or sell copies of the Software, and to # 114a1a9510SRong-En Fan# permit persons to whom the Software is furnished to do so, subject to the # 124a1a9510SRong-En Fan# following conditions: # 134a1a9510SRong-En Fan# # 144a1a9510SRong-En Fan# The above copyright notice and this permission notice shall be included in # 154a1a9510SRong-En Fan# all copies or substantial portions of the Software. # 164a1a9510SRong-En Fan# # 174a1a9510SRong-En Fan# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # 184a1a9510SRong-En Fan# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # 194a1a9510SRong-En Fan# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 204a1a9510SRong-En Fan# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # 214a1a9510SRong-En Fan# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # 224a1a9510SRong-En Fan# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # 234a1a9510SRong-En Fan# DEALINGS IN THE SOFTWARE. # 244a1a9510SRong-En Fan# # 254a1a9510SRong-En Fan# Except as contained in this notice, the name(s) of the above copyright # 264a1a9510SRong-En Fan# holders shall not be used in advertising or otherwise to promote the sale, # 274a1a9510SRong-En Fan# use or other dealings in this Software without prior written # 284a1a9510SRong-En Fan# authorization. # 294a1a9510SRong-En Fan############################################################################## 304a1a9510SRong-En Fan# 3106bfebdeSXin LI# Author: Thomas E. Dickey, 2006-on 324a1a9510SRong-En Fan 3373f0a83dSXin LILANG=C; export LANG 3473f0a83dSXin LILANGUAGE=C; export LANGUAGE 3573f0a83dSXin LILC_ALL=C; export LC_ALL 3673f0a83dSXin LILC_CTYPE=C; export LC_CTYPE 3773f0a83dSXin LI 384a1a9510SRong-En Fanprefix="@prefix@" 394a1a9510SRong-En Fanexec_prefix="@exec_prefix@" 404a1a9510SRong-En Fan 414a1a9510SRong-En Fanbindir="@bindir@" 4206bfebdeSXin LIincludedir="@includedir@" 434a1a9510SRong-En Fanlibdir="@libdir@" 4473f0a83dSXin LIdatarootdir="@datarootdir@" 454a1a9510SRong-En Fandatadir="@datadir@" 464a1a9510SRong-En Fanmandir="@mandir@" 474a1a9510SRong-En Fan 48*aae38d10SBaptiste DaroussinTHIS="@LIB_NAME@@USE_LIB_SUFFIX@" 4906bfebdeSXin LITINFO_LIB="@TINFO_ARG_SUFFIX@" 5073f0a83dSXin LIRPATH_LIST="@RPATH_LIST@" 514a1a9510SRong-En Fan 52*aae38d10SBaptiste Daroussinincludesubdir="@includedir@/${THIS}" 53*aae38d10SBaptiste Daroussin 5473f0a83dSXin LI# Ensure that RPATH_LIST contains only absolute pathnames, if it is nonempty. 5573f0a83dSXin LI# We cannot filter it out within the build-process since the variable is used 5673f0a83dSXin LI# in some special cases of installation using a relative path. 57*aae38d10SBaptiste Daroussinif [ -n "$RPATH_LIST" ] 5873f0a83dSXin LIthen 5973f0a83dSXin LI save_IFS="$IFS" 6073f0a83dSXin LI IFS='@PATH_SEPARATOR@' 6173f0a83dSXin LI filtered= 6273f0a83dSXin LI for item in $RPATH_LIST 6373f0a83dSXin LI do 6473f0a83dSXin LI case "$item" in 6573f0a83dSXin LI ./*|../*|*/..|*/../*) 6673f0a83dSXin LI ;; 6773f0a83dSXin LI *) 68*aae38d10SBaptiste Daroussin [ -n "$filtered" ] && filtered="${filtered}@PATH_SEPARATOR@" 6973f0a83dSXin LI filtered="${filtered}${item}" 7073f0a83dSXin LI ;; 7173f0a83dSXin LI esac 7273f0a83dSXin LI done 7373f0a83dSXin LI IFS="$save_IFS" 7473f0a83dSXin LI # if the result is empty, there is little we can do to fix it 7573f0a83dSXin LI RPATH_LIST="$filtered" 7673f0a83dSXin LIfi 775ca44d1cSRong-En Fan 7806bfebdeSXin LI# with --disable-overwrite, we installed into a subdirectory, but transformed 7906bfebdeSXin LI# the headers to include like this: 8006bfebdeSXin LI# <ncurses@LIB_SUFFIX@/curses.h> 81*aae38d10SBaptiste Daroussinif [ x@WITH_OVERWRITE@ = xno ]; then 8206bfebdeSXin LI case $includedir in 83*aae38d10SBaptiste Daroussin $prefix/include/ncurses@LIB_SUFFIX@@EXTRA_SUFFIX@) 8406bfebdeSXin LI includedir=`echo "$includedir" | sed -e 's,/[^/]*$,,'` 8506bfebdeSXin LI ;; 8606bfebdeSXin LI esac 8706bfebdeSXin LIfi 8806bfebdeSXin LI 89*aae38d10SBaptiste DaroussinLIBS="@LIBS@" 90*aae38d10SBaptiste Daroussinif [ "@TINFO_NAME@" = "@LIB_NAME@" ]; then 91*aae38d10SBaptiste Daroussin LIBS="-l${THIS} $LIBS" 92*aae38d10SBaptiste Daroussinelse 93*aae38d10SBaptiste Daroussin LIBS="-l${THIS} -l${TINFO_LIB} $LIBS" 94*aae38d10SBaptiste Daroussinfi 954a1a9510SRong-En Fan 96*aae38d10SBaptiste Daroussin# Ignore -L options which do not correspond to an actual directory, or which 97*aae38d10SBaptiste Daroussin# are standard library directories (i.e., the linker is supposed to search 98*aae38d10SBaptiste Daroussin# those directories). 99*aae38d10SBaptiste Daroussin# 100*aae38d10SBaptiste Daroussin# There is no portable way to find the list of standard library directories. 101*aae38d10SBaptiste Daroussin# Require a POSIX shell anyway, to keep this simple. 102*aae38d10SBaptiste Daroussinlib_flags= 103*aae38d10SBaptiste Daroussinfor opt in -L$libdir @LDFLAGS@ @EXTRA_LDFLAGS@ $LIBS 104*aae38d10SBaptiste Daroussindo 105*aae38d10SBaptiste Daroussin case $opt in 106*aae38d10SBaptiste Daroussin -specs*) # ignore linker specs-files which were used to build library 107*aae38d10SBaptiste Daroussin continue 108*aae38d10SBaptiste Daroussin ;; 109*aae38d10SBaptiste Daroussin -Wl,-z,*) # ignore flags used to manipulate shared image 110*aae38d10SBaptiste Daroussin continue 111*aae38d10SBaptiste Daroussin ;; 112*aae38d10SBaptiste Daroussin -L*) 113*aae38d10SBaptiste Daroussin [ -d ${opt##-L} ] || continue 114*aae38d10SBaptiste Daroussin case ${opt##-L} in 115*aae38d10SBaptiste Daroussin @LD_SEARCHPATH@) # skip standard libdir 116*aae38d10SBaptiste Daroussin continue 117*aae38d10SBaptiste Daroussin ;; 118*aae38d10SBaptiste Daroussin *) 119*aae38d10SBaptiste Daroussin found=no 120*aae38d10SBaptiste Daroussin for check in $lib_flags 121*aae38d10SBaptiste Daroussin do 122*aae38d10SBaptiste Daroussin if [ "x$check" = "x$opt" ] 123*aae38d10SBaptiste Daroussin then 124*aae38d10SBaptiste Daroussin found=yes 125*aae38d10SBaptiste Daroussin break 126*aae38d10SBaptiste Daroussin fi 127*aae38d10SBaptiste Daroussin done 128*aae38d10SBaptiste Daroussin [ $found = yes ] && continue 129*aae38d10SBaptiste Daroussin ;; 130*aae38d10SBaptiste Daroussin esac 131*aae38d10SBaptiste Daroussin ;; 132*aae38d10SBaptiste Daroussin esac 133*aae38d10SBaptiste Daroussin lib_flags="$lib_flags $opt" 134*aae38d10SBaptiste Daroussindone 135*aae38d10SBaptiste Daroussin 136*aae38d10SBaptiste Daroussin[ $# = 0 ] && exec @SHELL@ $0 --error 137*aae38d10SBaptiste Daroussin 138*aae38d10SBaptiste Daroussinwhile [ $# -gt 0 ]; do 1394a1a9510SRong-En Fan case "$1" in 1404a1a9510SRong-En Fan # basic configuration 1414a1a9510SRong-En Fan --prefix) 1424a1a9510SRong-En Fan echo "$prefix" 1434a1a9510SRong-En Fan ;; 1444a1a9510SRong-En Fan --exec-prefix) 1454a1a9510SRong-En Fan echo "$exec_prefix" 1464a1a9510SRong-En Fan ;; 1474a1a9510SRong-En Fan # compile/link 1484a1a9510SRong-En Fan --cflags) 149*aae38d10SBaptiste Daroussin INCS="@PKG_CFLAGS@" 150*aae38d10SBaptiste Daroussin if [ "x@WITH_OVERWRITE@" = xno ]; then 151*aae38d10SBaptiste Daroussin INCS="$INCS -I${includesubdir}" 1524a1a9510SRong-En Fan fi 153*aae38d10SBaptiste Daroussin if [ "${includedir}" != /usr/include ]; then 15406bfebdeSXin LI INCS="$INCS -I${includedir}" 1554a1a9510SRong-En Fan fi 1564a1a9510SRong-En Fan sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO 1574a1a9510SRong-En Fan $INCS 1584a1a9510SRong-En FanENDECHO 1594a1a9510SRong-En Fan ;; 1604a1a9510SRong-En Fan --libs) 161*aae38d10SBaptiste Daroussin OPTS= 162*aae38d10SBaptiste Daroussin for opt in $lib_flags 163*aae38d10SBaptiste Daroussin do 164*aae38d10SBaptiste Daroussin [ -n "$OPTS" ] && OPTS="$OPTS " 165*aae38d10SBaptiste Daroussin OPTS="${OPTS}${opt}" 166*aae38d10SBaptiste Daroussin done 167*aae38d10SBaptiste Daroussin printf "%s\n" "$OPTS" 168*aae38d10SBaptiste Daroussin ;; 169*aae38d10SBaptiste Daroussin --libs-only-L) 170*aae38d10SBaptiste Daroussin OPTS= 171*aae38d10SBaptiste Daroussin for opt in $lib_flags 172*aae38d10SBaptiste Daroussin do 173*aae38d10SBaptiste Daroussin case "x$opt" in 174*aae38d10SBaptiste Daroussin x-L*) 175*aae38d10SBaptiste Daroussin [ -n "$OPTS" ] && OPTS="$OPTS " 176*aae38d10SBaptiste Daroussin OPTS="${OPTS}${opt}" 177*aae38d10SBaptiste Daroussin ;; 178*aae38d10SBaptiste Daroussin esac 179*aae38d10SBaptiste Daroussin done 180*aae38d10SBaptiste Daroussin printf "%s\n" "$OPTS" 181*aae38d10SBaptiste Daroussin ;; 182*aae38d10SBaptiste Daroussin --libs-only-l) 183*aae38d10SBaptiste Daroussin OPTS= 184*aae38d10SBaptiste Daroussin for opt in $lib_flags 185*aae38d10SBaptiste Daroussin do 186*aae38d10SBaptiste Daroussin case "x$opt" in 187*aae38d10SBaptiste Daroussin x-l*) 188*aae38d10SBaptiste Daroussin [ -n "$OPTS" ] && OPTS="$OPTS " 189*aae38d10SBaptiste Daroussin OPTS="${OPTS}${opt}" 190*aae38d10SBaptiste Daroussin ;; 191*aae38d10SBaptiste Daroussin esac 192*aae38d10SBaptiste Daroussin done 193*aae38d10SBaptiste Daroussin printf "%s\n" "$OPTS" 194*aae38d10SBaptiste Daroussin ;; 195*aae38d10SBaptiste Daroussin --libs-only-other) 196*aae38d10SBaptiste Daroussin OPTS= 197*aae38d10SBaptiste Daroussin for opt in $lib_flags 198*aae38d10SBaptiste Daroussin do 199*aae38d10SBaptiste Daroussin case "x$opt" in 200*aae38d10SBaptiste Daroussin x-[lL]*) 201*aae38d10SBaptiste Daroussin ;; 202*aae38d10SBaptiste Daroussin *) 203*aae38d10SBaptiste Daroussin [ -n "$OPTS" ] && OPTS="$OPTS " 204*aae38d10SBaptiste Daroussin OPTS="${OPTS}${opt}" 205*aae38d10SBaptiste Daroussin ;; 206*aae38d10SBaptiste Daroussin esac 207*aae38d10SBaptiste Daroussin done 208*aae38d10SBaptiste Daroussin printf "%s\n" "$OPTS" 2094a1a9510SRong-En Fan ;; 2104a1a9510SRong-En Fan # identification 2114a1a9510SRong-En Fan --version) 2124a1a9510SRong-En Fan echo "@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@" 2134a1a9510SRong-En Fan ;; 2144a1a9510SRong-En Fan --abi-version) 2154a1a9510SRong-En Fan echo "@cf_cv_abi_version@" 2164a1a9510SRong-En Fan ;; 2174a1a9510SRong-En Fan --mouse-version) 2184a1a9510SRong-En Fan echo "@NCURSES_MOUSE_VERSION@" 2194a1a9510SRong-En Fan ;; 2204a1a9510SRong-En Fan # locations 2214a1a9510SRong-En Fan --bindir) 2224a1a9510SRong-En Fan echo "${bindir}" 2234a1a9510SRong-En Fan ;; 2244a1a9510SRong-En Fan --datadir) 2254a1a9510SRong-En Fan echo "${datadir}" 2264a1a9510SRong-En Fan ;; 22706bfebdeSXin LI --includedir) 228*aae38d10SBaptiste Daroussin INCS= 229*aae38d10SBaptiste Daroussin if [ "x@WITH_OVERWRITE@" = xno ]; then 230*aae38d10SBaptiste Daroussin INCS="${includesubdir}" 231*aae38d10SBaptiste Daroussin elif [ "${includedir}" != /usr/include ]; then 232*aae38d10SBaptiste Daroussin INCS="${includedir}" 233*aae38d10SBaptiste Daroussin fi 234*aae38d10SBaptiste Daroussin echo $INCS 23506bfebdeSXin LI ;; 2364a1a9510SRong-En Fan --libdir) 2374a1a9510SRong-En Fan echo "${libdir}" 2384a1a9510SRong-En Fan ;; 2394a1a9510SRong-En Fan --mandir) 2404a1a9510SRong-En Fan echo "${mandir}" 2414a1a9510SRong-En Fan ;; 2424a1a9510SRong-En Fan --terminfo) 2434a1a9510SRong-En Fan echo "@TERMINFO@" 2444a1a9510SRong-En Fan ;; 2454a1a9510SRong-En Fan --terminfo-dirs) 2464a1a9510SRong-En Fan echo "@TERMINFO_DIRS@" 2474a1a9510SRong-En Fan ;; 2484a1a9510SRong-En Fan --termpath) 2494a1a9510SRong-En Fan echo "@TERMPATH@" 2504a1a9510SRong-En Fan ;; 2514a1a9510SRong-En Fan # general info 2524a1a9510SRong-En Fan --help) 2534a1a9510SRong-En Fan cat <<ENDHELP 254*aae38d10SBaptiste DaroussinUsage: `basename $0` [options] 2554a1a9510SRong-En Fan 2564a1a9510SRong-En FanOptions: 2574a1a9510SRong-En Fan --prefix echos the package-prefix of ${THIS} 2584a1a9510SRong-En Fan --exec-prefix echos the executable-prefix of ${THIS} 2594a1a9510SRong-En Fan 2604a1a9510SRong-En Fan --cflags echos the C compiler flags needed to compile with ${THIS} 2614a1a9510SRong-En Fan --libs echos the libraries needed to link with ${THIS} 2624a1a9510SRong-En Fan 263*aae38d10SBaptiste Daroussin --libs-only-L echos -L linker options (search path) for ${THIS} 264*aae38d10SBaptiste Daroussin --libs-only-l echos -l linker options (libraries) for ${THIS} 265*aae38d10SBaptiste Daroussin --libs-only-other echos linker options other than -L/-l 266*aae38d10SBaptiste Daroussin 2674a1a9510SRong-En Fan --version echos the release+patchdate version of ${THIS} 2684a1a9510SRong-En Fan --abi-version echos the ABI version of ${THIS} 2694a1a9510SRong-En Fan --mouse-version echos the mouse-interface version of ${THIS} 2704a1a9510SRong-En Fan 2714a1a9510SRong-En Fan --bindir echos the directory containing ${THIS} programs 2724a1a9510SRong-En Fan --datadir echos the directory containing ${THIS} data 27306bfebdeSXin LI --includedir echos the directory containing ${THIS} header files 2744a1a9510SRong-En Fan --libdir echos the directory containing ${THIS} libraries 2754a1a9510SRong-En Fan --mandir echos the directory containing ${THIS} manpages 2764a1a9510SRong-En Fan --terminfo echos the \$TERMINFO terminfo database path 2774a1a9510SRong-En Fan --terminfo-dirs echos the \$TERMINFO_DIRS directory list 2784a1a9510SRong-En Fan --termpath echos the \$TERMPATH termcap list 2794a1a9510SRong-En Fan 2804a1a9510SRong-En Fan --help prints this message 2814a1a9510SRong-En FanENDHELP 2824a1a9510SRong-En Fan ;; 2834a1a9510SRong-En Fan --error|*) 2844a1a9510SRong-En Fan @SHELL@ $0 --help 1>&2 2854a1a9510SRong-En Fan exit 1 2864a1a9510SRong-En Fan ;; 2874a1a9510SRong-En Fan esac 2884a1a9510SRong-En Fan shift 2894a1a9510SRong-En Fandone 29073f0a83dSXin LI# vi:ts=4 sw=4 2914a1a9510SRong-En Fan# vile:shmode 292