2 # $Id: ncurses-config.in,v 1.46 2021/01/23 23:47:46 tom Exp $
3 ##############################################################################
4 # Copyright 2018-2020,2021 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
115 [ -d "$lib_check" ] || continue
117 @LD_SEARCHPATH@) # skip standard libdir
118 if [ "$lib_check" = "$libdir" ]
123 LIBDIRS="@LD_SEARCHPATH@"
124 for lib_check in $LIBDIRS
126 if [ -d "$lib_check" ]
128 if [ "$lib_check" != "$libdir" ]
136 [ $lib_first = yes ] && continue
138 for check in $lib_flags
140 if [ "x$check" = "x$opt" ]
146 [ $found = yes ] && continue
154 for check in $lib_flags
156 if [ "x$check" = "x$opt" ]
162 [ $found = yes ] && continue
167 lib_flags="$lib_flags $opt"
170 [ $# = 0 ] && exec @SHELL@ $0 --error
172 while [ $# -gt 0 ]; do
174 # basic configuration
184 if [ "x@WITH_OVERWRITE@" = xno ]; then
185 INCS="$INCS -I${includesubdir}"
187 if [ "${includedir}" != /usr/include ]; then
188 INCS="$INCS -I${includedir}"
190 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
196 for opt in $lib_flags
198 [ -n "$OPTS" ] && OPTS="$OPTS "
201 printf "%s\n" "$OPTS"
205 for opt in $lib_flags
209 [ -n "$OPTS" ] && OPTS="$OPTS "
214 printf "%s\n" "$OPTS"
218 for opt in $lib_flags
222 [ -n "$OPTS" ] && OPTS="$OPTS "
227 printf "%s\n" "$OPTS"
231 for opt in $lib_flags
237 [ -n "$OPTS" ] && OPTS="$OPTS "
242 printf "%s\n" "$OPTS"
246 echo "@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@"
249 echo "@cf_cv_abi_version@"
252 echo "@NCURSES_MOUSE_VERSION@"
263 if [ "x@WITH_OVERWRITE@" = xno ]; then
264 INCS="${includesubdir}"
265 elif [ "${includedir}" != /usr/include ]; then
280 echo "@TERMINFO_DIRS@"
288 Usage: `basename $0` [options]
291 --prefix echos the package-prefix of ${THIS}
292 --exec-prefix echos the executable-prefix of ${THIS}
294 --cflags echos the C compiler flags needed to compile with ${THIS}
295 --libs echos the libraries needed to link with ${THIS}
297 --libs-only-L echos -L linker options (search path) for ${THIS}
298 --libs-only-l echos -l linker options (libraries) for ${THIS}
299 --libs-only-other echos linker options other than -L/-l
301 --version echos the release+patchdate version of ${THIS}
302 --abi-version echos the ABI version of ${THIS}
303 --mouse-version echos the mouse-interface version of ${THIS}
305 --bindir echos the directory containing ${THIS} programs
306 --datadir echos the directory containing ${THIS} data
307 --includedir echos the directory containing ${THIS} header files
308 --libdir echos the directory containing ${THIS} libraries
309 --mandir echos the directory containing ${THIS} manpages
310 --terminfo echos the \$TERMINFO terminfo database path
311 --terminfo-dirs echos the \$TERMINFO_DIRS directory list
312 --termpath echos the \$TERMPATH termcap list
314 --help prints this message
318 @SHELL@ $0 --help 1>&2