]> ncurses.scripts.mit.edu Git - ncurses.git/blob - misc/ncurses-config.in
ncurses 6.1 - patch 20181110
[ncurses.git] / misc / ncurses-config.in
1 #!@SHELL@
2 # $Id: ncurses-config.in,v 1.37 2018/06/09 22:29:01 tom Exp $
3 ##############################################################################
4 # Copyright (c) 2006-2017,2018 Free Software Foundation, Inc.                #
5 #                                                                            #
6 # Permission is hereby granted, free of charge, to any person obtaining a    #
7 # copy of this software and associated documentation files (the "Software"), #
8 # to deal in the Software without restriction, including without limitation  #
9 # the rights to use, copy, modify, merge, publish, distribute, distribute    #
10 # with modifications, sublicense, and/or sell copies of the Software, and to #
11 # permit persons to whom the Software is furnished to do so, subject to the  #
12 # following conditions:                                                      #
13 #                                                                            #
14 # The above copyright notice and this permission notice shall be included in #
15 # all copies or substantial portions of the Software.                        #
16 #                                                                            #
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
20 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
22 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
23 # DEALINGS IN THE SOFTWARE.                                                  #
24 #                                                                            #
25 # Except as contained in this notice, the name(s) of the above copyright     #
26 # holders shall not be used in advertising or otherwise to promote the sale, #
27 # use or other dealings in this Software without prior written               #
28 # authorization.                                                             #
29 ##############################################################################
30 #
31 # Author: Thomas E. Dickey, 2006-on
32
33 LANG=C;         export LANG
34 LANGUAGE=C;     export LANGUAGE
35 LC_ALL=C;       export LC_ALL
36 LC_CTYPE=C;     export LC_CTYPE
37
38 prefix="@prefix@"
39 exec_prefix="@exec_prefix@"
40
41 bindir="@bindir@"
42 includedir="@includedir@"
43 libdir="@libdir@"
44 datarootdir="@datarootdir@"
45 datadir="@datadir@"
46 mandir="@mandir@"
47
48 THIS="@LIB_NAME@@USE_LIB_SUFFIX@"
49 TINFO_LIB="@TINFO_ARG_SUFFIX@"
50 RPATH_LIST="@RPATH_LIST@"
51
52 includesubdir="@includedir@/${THIS}"
53
54 # Ensure that RPATH_LIST contains only absolute pathnames, if it is nonempty.
55 # We cannot filter it out within the build-process since the variable is used
56 # in some special cases of installation using a relative path.
57 if test -n "$RPATH_LIST"
58 then
59         save_IFS="$IFS"
60         IFS='@PATH_SEPARATOR@'
61         filtered=
62         for item in $RPATH_LIST
63         do
64                 case "$item" in
65                 ./*|../*|*/..|*/../*)
66                         ;;
67                 *)
68                         test -n "$filtered" && filtered="${filtered}@PATH_SEPARATOR@"
69                         filtered="${filtered}${item}"
70                         ;;
71                 esac
72         done
73         IFS="$save_IFS"
74         # if the result is empty, there is little we can do to fix it
75         RPATH_LIST="$filtered"
76 fi
77
78 # with --disable-overwrite, we installed into a subdirectory, but transformed
79 # the headers to include like this:
80 #       <ncurses@LIB_SUFFIX@/curses.h>
81 if test x@WITH_OVERWRITE@ = xno ; then
82         case $includedir in
83         $prefix/include/ncurses@LIB_SUFFIX@@EXTRA_SUFFIX@)
84                 includedir=`echo "$includedir" | sed -e 's,/[^/]*$,,'`
85                 ;;
86         esac
87 fi
88
89 test $# = 0 && exec @SHELL@ $0 --error
90
91 while test $# -gt 0; do
92         case "$1" in
93         # basic configuration
94         --prefix)
95                 echo "$prefix"
96                 ;;
97         --exec-prefix)
98                 echo "$exec_prefix"
99                 ;;
100         # compile/link
101         --cflags)
102                 INCS="@PKG_CFLAGS@"
103                 if test "x@WITH_OVERWRITE@" = xno ; then
104                         INCS="$INCS -I${includesubdir}"
105                 fi
106                 if test "${includedir}" != /usr/include ; then
107                         INCS="$INCS -I${includedir}"
108                 fi
109                 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
110                         $INCS
111 ENDECHO
112                 ;;
113         --libs)
114                 if test "$libdir" = /usr/lib
115                 then
116                         LIBDIR=
117                 else
118                         LIBDIR=-L$libdir
119                 fi
120                 LIBS="@LIBS@ @PRIVATE_LIBS@"
121                 if test @TINFO_NAME@ = @LIB_NAME@ ; then
122                 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
123                         $LIBDIR @EXTRA_LDFLAGS@ -l${THIS} $LIBS
124 ENDECHO
125                 else
126                 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
127                         $LIBDIR @EXTRA_LDFLAGS@ -l${THIS} -l${TINFO_LIB} $LIBS
128 ENDECHO
129                 fi
130                 ;;
131         # identification
132         --version)
133                 echo "@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@"
134                 ;;
135         --abi-version)
136                 echo "@cf_cv_abi_version@"
137                 ;;
138         --mouse-version)
139                 echo "@NCURSES_MOUSE_VERSION@"
140                 ;;
141         # locations
142         --bindir)
143                 echo "${bindir}"
144                 ;;
145         --datadir)
146                 echo "${datadir}"
147                 ;;
148         --includedir)
149                 INCS=
150                 if test "x@WITH_OVERWRITE@" = xno ; then
151                         INCS="${includesubdir}"
152                 elif test "${includedir}" != /usr/include ; then
153                         INCS="${includedir}"
154                 fi
155                 echo $INCS
156                 ;;
157         --libdir)
158                 echo "${libdir}"
159                 ;;
160         --mandir)
161                 echo "${mandir}"
162                 ;;
163         --terminfo)
164                 echo "@TERMINFO@"
165                 ;;
166         --terminfo-dirs)
167                 echo "@TERMINFO_DIRS@"
168                 ;;
169         --termpath)
170                 echo "@TERMPATH@"
171                 ;;
172         # general info
173         --help)
174                 cat <<ENDHELP
175 Usage: `basename $0` [options]
176
177 Options:
178   --prefix           echos the package-prefix of ${THIS}
179   --exec-prefix      echos the executable-prefix of ${THIS}
180
181   --cflags           echos the C compiler flags needed to compile with ${THIS}
182   --libs             echos the libraries needed to link with ${THIS}
183
184   --version          echos the release+patchdate version of ${THIS}
185   --abi-version      echos the ABI version of ${THIS}
186   --mouse-version    echos the mouse-interface version of ${THIS}
187
188   --bindir           echos the directory containing ${THIS} programs
189   --datadir          echos the directory containing ${THIS} data
190   --includedir       echos the directory containing ${THIS} header files
191   --libdir           echos the directory containing ${THIS} libraries
192   --mandir           echos the directory containing ${THIS} manpages
193   --terminfo         echos the \$TERMINFO terminfo database path
194   --terminfo-dirs    echos the \$TERMINFO_DIRS directory list
195   --termpath         echos the \$TERMPATH termcap list
196
197   --help             prints this message
198 ENDHELP
199                 ;;
200         --error|*)
201                 @SHELL@ $0 --help 1>&2
202                 exit 1
203                 ;;
204         esac
205         shift
206 done
207 # vi:ts=4 sw=4
208 # vile:shmode