]> ncurses.scripts.mit.edu Git - ncurses.git/blob - misc/ncurses-config.in
ncurses 5.9 - patch 20141115
[ncurses.git] / misc / ncurses-config.in
1 #!@SHELL@
2 # $Id: ncurses-config.in,v 1.30 2012/11/11 00:14:28 tom Exp $
3 ##############################################################################
4 # Copyright (c) 2006-2011,2012 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@@DFT_ARG_SUFFIX@"
49 TINFO_LIB="@TINFO_ARG_SUFFIX@"
50 RPATH_LIST="@RPATH_LIST@"
51
52 # Ensure that RPATH_LIST contains only absolute pathnames, if it is nonempty.
53 # We cannot filter it out within the build-process since the variable is used
54 # in some special cases of installation using a relative path.
55 if test -n "$RPATH_LIST"
56 then
57         save_IFS="$IFS"
58         IFS='@PATH_SEPARATOR@'
59         filtered=
60         for item in $RPATH_LIST
61         do
62                 case "$item" in
63                 ./*|../*|*/..|*/../*)
64                         ;;
65                 *)
66                         test -n "$filtered" && filtered="${filtered}@PATH_SEPARATOR@"
67                         filtered="${filtered}${item}"
68                         ;;
69                 esac
70         done
71         IFS="$save_IFS"
72         # if the result is empty, there is little we can do to fix it
73         RPATH_LIST="$filtered"
74 fi
75
76 # with --disable-overwrite, we installed into a subdirectory, but transformed
77 # the headers to include like this:
78 #       <ncurses@LIB_SUFFIX@/curses.h>
79 if test x@WITH_OVERWRITE@ = xno ; then
80         case $includedir in
81         $prefix/include/ncurses@LIB_SUFFIX@)
82                 includedir=`echo "$includedir" | sed -e 's,/[^/]*$,,'`
83                 ;;
84         esac
85 fi
86
87 test $# = 0 && exec @SHELL@ $0 --error
88
89 while test $# -gt 0; do
90         case "$1" in
91         # basic configuration
92         --prefix)
93                 echo "$prefix"
94                 ;;
95         --exec-prefix)
96                 echo "$exec_prefix"
97                 ;;
98         # compile/link
99         --cflags)
100                 INCS=
101                 if test "x@WITH_OVERWRITE@" = xno ; then
102                         INCS="$INCS -I${includedir}/${THIS}"
103                 fi
104                 if test "${includedir}" != /usr/include ; then
105                         INCS="$INCS -I${includedir}"
106                 fi
107                 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
108                         $INCS
109 ENDECHO
110                 ;;
111         --libs)
112                 if test "$libdir" = /usr/lib
113                 then
114                         LIBDIR=
115                 else
116                         LIBDIR=-L$libdir
117                 fi
118                 if test @TINFO_NAME@ = @LIB_NAME@ ; then
119                 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
120                         $LIBDIR @EXTRA_LDFLAGS@ -l${THIS} @LIBS@
121 ENDECHO
122                 else
123                 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
124                         $LIBDIR @EXTRA_LDFLAGS@ -l${THIS} -l${TINFO_LIB} @LIBS@
125 ENDECHO
126                 fi
127                 ;;
128         # identification
129         --version)
130                 echo "@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@"
131                 ;;
132         --abi-version)
133                 echo "@cf_cv_abi_version@"
134                 ;;
135         --mouse-version)
136                 echo "@NCURSES_MOUSE_VERSION@"
137                 ;;
138         # locations
139         --bindir)
140                 echo "${bindir}"
141                 ;;
142         --datadir)
143                 echo "${datadir}"
144                 ;;
145         --includedir)
146                 echo "${includedir}"
147                 ;;
148         --libdir)
149                 echo "${libdir}"
150                 ;;
151         --mandir)
152                 echo "${mandir}"
153                 ;;
154         --terminfo)
155                 echo "@TERMINFO@"
156                 ;;
157         --terminfo-dirs)
158                 echo "@TERMINFO_DIRS@"
159                 ;;
160         --termpath)
161                 echo "@TERMPATH@"
162                 ;;
163         # general info
164         --help)
165                 cat <<ENDHELP
166 Usage: ${THIS}-config [options]
167
168 Options:
169   --prefix           echos the package-prefix of ${THIS}
170   --exec-prefix      echos the executable-prefix of ${THIS}
171
172   --cflags           echos the C compiler flags needed to compile with ${THIS}
173   --libs             echos the libraries needed to link with ${THIS}
174
175   --version          echos the release+patchdate version of ${THIS}
176   --abi-version      echos the ABI version of ${THIS}
177   --mouse-version    echos the mouse-interface version of ${THIS}
178
179   --bindir           echos the directory containing ${THIS} programs
180   --datadir          echos the directory containing ${THIS} data
181   --includedir       echos the directory containing ${THIS} header files
182   --libdir           echos the directory containing ${THIS} libraries
183   --mandir           echos the directory containing ${THIS} manpages
184   --terminfo         echos the \$TERMINFO terminfo database path
185   --terminfo-dirs    echos the \$TERMINFO_DIRS directory list
186   --termpath         echos the \$TERMPATH termcap list
187
188   --help             prints this message
189 ENDHELP
190                 ;;
191         --error|*)
192                 @SHELL@ $0 --help 1>&2
193                 exit 1
194                 ;;
195         esac
196         shift
197 done
198 # vi:ts=4 sw=4
199 # vile:shmode