2 # $Id: ncurses-config.in,v 1.44 2020/05/23 17:56:52 tom Exp $
3 ##############################################################################
4 # Copyright 2018-2019,2020 Thomas E. Dickey #
5 # Copyright 2006-2015,2017 Free Software Foundation, Inc. #
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: #
15 # The above copyright notice and this permission notice shall be included in #
16 # all copies or substantial portions of the Software. #
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. #
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 #
30 ##############################################################################
32 # Author: Thomas E. Dickey, 2006-on
35 LANGUAGE=C; export LANGUAGE
36 LC_ALL=C; export LC_ALL
37 LC_CTYPE=C; export LC_CTYPE
40 exec_prefix="@exec_prefix@"
43 includedir="@includedir@"
45 datarootdir="@datarootdir@"
49 THIS="@LIB_NAME@@USE_LIB_SUFFIX@"
50 TINFO_LIB="@TINFO_ARG_SUFFIX@"
51 RPATH_LIST="@RPATH_LIST@"
53 includesubdir="@includedir@/${THIS}"
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.
58 if [ -n "$RPATH_LIST" ]
61 IFS='@PATH_SEPARATOR@'
63 for item in $RPATH_LIST
69 [ -n "$filtered" ] && filtered="${filtered}@PATH_SEPARATOR@"
70 filtered="${filtered}${item}"
75 # if the result is empty, there is little we can do to fix it
76 RPATH_LIST="$filtered"
79 # with --disable-overwrite, we installed into a subdirectory, but transformed
80 # the headers to include like this:
81 # <ncurses@LIB_SUFFIX@/curses.h>
82 if [ x@WITH_OVERWRITE@ = xno ]; then
84 $prefix/include/ncurses@LIB_SUFFIX@@EXTRA_SUFFIX@)
85 includedir=`echo "$includedir" | sed -e 's,/[^/]*$,,'`
91 if [ "@TINFO_NAME@" = "@LIB_NAME@" ]; then
92 LIBS="-l${THIS} $LIBS"
94 LIBS="-l${THIS} -l${TINFO_LIB} $LIBS"
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
101 # There is no portable way to find the list of standard library directories.
102 # Require a POSIX shell anyway, to keep this simple.
104 for opt in -L$libdir @LDFLAGS@ @EXTRA_PKG_LDFLAGS@ $LIBS
107 -specs*) # ignore linker specs-files which were used to build library
110 -Wl,-z,*) # ignore flags used to manipulate shared image
114 [ -d ${opt##-L} ] || continue
116 @LD_SEARCHPATH@) # skip standard libdir
121 for check in $lib_flags
123 if [ "x$check" = "x$opt" ]
129 [ $found = yes ] && continue
134 lib_flags="$lib_flags $opt"
137 [ $# = 0 ] && exec @SHELL@ $0 --error
139 while [ $# -gt 0 ]; do
141 # basic configuration
151 if [ "x@WITH_OVERWRITE@" = xno ]; then
152 INCS="$INCS -I${includesubdir}"
154 if [ "${includedir}" != /usr/include ]; then
155 INCS="$INCS -I${includedir}"
157 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
163 for opt in $lib_flags
165 [ -n "$OPTS" ] && OPTS="$OPTS "
168 printf "%s\n" "$OPTS"
172 for opt in $lib_flags
176 [ -n "$OPTS" ] && OPTS="$OPTS "
181 printf "%s\n" "$OPTS"
185 for opt in $lib_flags
189 [ -n "$OPTS" ] && OPTS="$OPTS "
194 printf "%s\n" "$OPTS"
198 for opt in $lib_flags
204 [ -n "$OPTS" ] && OPTS="$OPTS "
209 printf "%s\n" "$OPTS"
213 echo "@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@"
216 echo "@cf_cv_abi_version@"
219 echo "@NCURSES_MOUSE_VERSION@"
230 if [ "x@WITH_OVERWRITE@" = xno ]; then
231 INCS="${includesubdir}"
232 elif [ "${includedir}" != /usr/include ]; then
247 echo "@TERMINFO_DIRS@"
255 Usage: `basename $0` [options]
258 --prefix echos the package-prefix of ${THIS}
259 --exec-prefix echos the executable-prefix of ${THIS}
261 --cflags echos the C compiler flags needed to compile with ${THIS}
262 --libs echos the libraries needed to link with ${THIS}
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
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}
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
281 --help prints this message
285 @SHELL@ $0 --help 1>&2