2 # $Id: ncurses-config.in,v 1.52 2022/07/26 21:36:28 tom Exp $
3 ##############################################################################
4 # Copyright 2018-2021,2022 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 @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
113 -Wl,--dynamic-linker*) # ignore ELF interpreter
116 -Wl,--as-needed|-Wl,--build-id=*|-Wl,-dT,*|-Wl,-T,*)
120 lib_check=`echo "x$opt" | sed -e 's/^.-L//'`
121 [ -d "$lib_check" ] || continue
123 @LD_SEARCHPATH@) # skip standard libdir
124 if [ "$lib_check" = "$libdir" ]
129 LIBDIRS="@LD_SEARCHPATH@"
130 for lib_check in $LIBDIRS
132 if [ -d "$lib_check" ]
134 if [ "$lib_check" != "$libdir" ]
142 [ $lib_first = yes ] && continue
144 for check in $lib_flags
146 if [ "x$check" = "x$opt" ]
152 [ $found = yes ] && continue
160 for check in $lib_flags
162 if [ "x$check" = "x$opt" ]
168 [ $found = yes ] && continue
173 lib_flags="$lib_flags $opt"
176 [ $# = 0 ] && exec @SHELL@ "$0" --error
178 while [ $# -gt 0 ]; do
180 # basic configuration
190 if [ "x@WITH_OVERWRITE@" = xno ]; then
191 INCS="$INCS -I${includesubdir}"
193 if [ "${includedir}" != /usr/include ]; then
194 INCS="$INCS -I${includedir}"
196 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
202 for opt in $lib_flags
204 [ -n "$OPTS" ] && OPTS="$OPTS "
207 printf '%s\n' "$OPTS"
211 for opt in $lib_flags
215 [ -n "$OPTS" ] && OPTS="$OPTS "
220 printf '%s\n' "$OPTS"
224 for opt in $lib_flags
228 [ -n "$OPTS" ] && OPTS="$OPTS "
233 printf '%s\n' "$OPTS"
237 for opt in $lib_flags
243 [ -n "$OPTS" ] && OPTS="$OPTS "
248 printf '%s\n' "$OPTS"
252 echo "@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@"
255 echo "@cf_cv_abi_version@"
258 echo "@NCURSES_MOUSE_VERSION@"
269 if [ "x@WITH_OVERWRITE@" = xno ]; then
270 INCS="${includesubdir}"
271 elif [ "${includedir}" != /usr/include ]; then
286 echo "@TERMINFO_DIRS@"
294 Usage: `basename "$0"` [options]
297 --prefix echos the package-prefix of ${THIS}
298 --exec-prefix echos the executable-prefix of ${THIS}
300 --cflags echos the C compiler flags needed to compile with ${THIS}
301 --libs echos the libraries needed to link with ${THIS}
303 --libs-only-L echos -L linker options (search path) for ${THIS}
304 --libs-only-l echos -l linker options (libraries) for ${THIS}
305 --libs-only-other echos linker options other than -L/-l
307 --version echos the release+patchdate version of ${THIS}
308 --abi-version echos the ABI version of ${THIS}
309 --mouse-version echos the mouse-interface version of ${THIS}
311 --bindir echos the directory containing ${THIS} programs
312 --datadir echos the directory containing ${THIS} data
313 --includedir echos the directory containing ${THIS} header files
314 --libdir echos the directory containing ${THIS} libraries
315 --mandir echos the directory containing ${THIS} manpages
316 --terminfo echos the \$TERMINFO terminfo database path
317 --terminfo-dirs echos the \$TERMINFO_DIRS directory list
318 --termpath echos the \$TERMPATH termcap list
320 --help prints this message
324 @SHELL@ "$0" --help 1>&2