2 # $Id: ncurses-config.in,v 1.50 2021/08/07 21:36:14 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 @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
117 lib_check=`echo "x$opt" | sed -e 's/^.-L//'`
118 [ -d "$lib_check" ] || continue
120 @LD_SEARCHPATH@) # skip standard libdir
121 if [ "$lib_check" = "$libdir" ]
126 LIBDIRS="@LD_SEARCHPATH@"
127 for lib_check in $LIBDIRS
129 if [ -d "$lib_check" ]
131 if [ "$lib_check" != "$libdir" ]
139 [ $lib_first = yes ] && continue
141 for check in $lib_flags
143 if [ "x$check" = "x$opt" ]
149 [ $found = yes ] && continue
157 for check in $lib_flags
159 if [ "x$check" = "x$opt" ]
165 [ $found = yes ] && continue
170 lib_flags="$lib_flags $opt"
173 [ $# = 0 ] && exec @SHELL@ $0 --error
175 while [ $# -gt 0 ]; do
177 # basic configuration
187 if [ "x@WITH_OVERWRITE@" = xno ]; then
188 INCS="$INCS -I${includesubdir}"
190 if [ "${includedir}" != /usr/include ]; then
191 INCS="$INCS -I${includedir}"
193 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
199 for opt in $lib_flags
201 [ -n "$OPTS" ] && OPTS="$OPTS "
204 printf "%s\n" "$OPTS"
208 for opt in $lib_flags
212 [ -n "$OPTS" ] && OPTS="$OPTS "
217 printf "%s\n" "$OPTS"
221 for opt in $lib_flags
225 [ -n "$OPTS" ] && OPTS="$OPTS "
230 printf "%s\n" "$OPTS"
234 for opt in $lib_flags
240 [ -n "$OPTS" ] && OPTS="$OPTS "
245 printf "%s\n" "$OPTS"
249 echo "@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@"
252 echo "@cf_cv_abi_version@"
255 echo "@NCURSES_MOUSE_VERSION@"
266 if [ "x@WITH_OVERWRITE@" = xno ]; then
267 INCS="${includesubdir}"
268 elif [ "${includedir}" != /usr/include ]; then
283 echo "@TERMINFO_DIRS@"
291 Usage: `basename $0` [options]
294 --prefix echos the package-prefix of ${THIS}
295 --exec-prefix echos the executable-prefix of ${THIS}
297 --cflags echos the C compiler flags needed to compile with ${THIS}
298 --libs echos the libraries needed to link with ${THIS}
300 --libs-only-L echos -L linker options (search path) for ${THIS}
301 --libs-only-l echos -l linker options (libraries) for ${THIS}
302 --libs-only-other echos linker options other than -L/-l
304 --version echos the release+patchdate version of ${THIS}
305 --abi-version echos the ABI version of ${THIS}
306 --mouse-version echos the mouse-interface version of ${THIS}
308 --bindir echos the directory containing ${THIS} programs
309 --datadir echos the directory containing ${THIS} data
310 --includedir echos the directory containing ${THIS} header files
311 --libdir echos the directory containing ${THIS} libraries
312 --mandir echos the directory containing ${THIS} manpages
313 --terminfo echos the \$TERMINFO terminfo database path
314 --terminfo-dirs echos the \$TERMINFO_DIRS directory list
315 --termpath echos the \$TERMPATH termcap list
317 --help prints this message
321 @SHELL@ $0 --help 1>&2