]> ncurses.scripts.mit.edu Git - ncurses.git/blob - misc/ncurses-config.in
ncurses 6.1 - patch 20190928
[ncurses.git] / misc / ncurses-config.in
1 #!@SHELL@
2 # $Id: ncurses-config.in,v 1.39 2019/09/28 12:54:17 tom Exp $
3 ##############################################################################
4 # Copyright (c) 2006-2018,2019 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 [ -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                         [ -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 [ 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 LIBS="@LIBS@ @PRIVATE_LIBS@"
90 if [ "@TINFO_NAME@" = "@LIB_NAME@" ]; then
91         LIBS="-l${THIS} $LIBS"
92 else
93         LIBS="-l${THIS} -l${TINFO_LIB} $LIBS"
94 fi
95
96 # Ignore -L options which do not correspond to an actual directory, or which
97 # are standard library directories (i.e., the linker is supposed to search
98 # those directories).
99 #
100 # There is no portable way to find the list of standard library directories. 
101 # Require a POSIX shell anyway, to keep this simple.
102 lib_flags=
103 for opt in -L$libdir @LDFLAGS@ @EXTRA_LDFLAGS@ $LIBS
104 do
105         case $opt in
106         -L*)
107                 [ -d ${opt##-L} ] || continue
108                 case ${opt##-L} in
109                 @LD_SEARCHPATH@) # skip standard libdir
110                         continue
111                         ;;
112                 *)
113                         found=no
114                         for check in $lib_flags
115                         do
116                                 if [ "x$check" = "x$opt" ]
117                                 then
118                                         found=yes
119                                         break
120                                 fi
121                         done
122                         [ $found = yes ] && continue
123                         ;;
124                 esac
125                 ;;
126         esac
127         lib_flags="$lib_flags $opt"
128 done
129
130 [ $# = 0 ] && exec @SHELL@ $0 --error
131
132 while [ $# -gt 0 ]; do
133         case "$1" in
134         # basic configuration
135         --prefix)
136                 echo "$prefix"
137                 ;;
138         --exec-prefix)
139                 echo "$exec_prefix"
140                 ;;
141         # compile/link
142         --cflags)
143                 INCS="@PKG_CFLAGS@"
144                 if [ "x@WITH_OVERWRITE@" = xno ]; then
145                         INCS="$INCS -I${includesubdir}"
146                 fi
147                 if [ "${includedir}" != /usr/include ]; then
148                         INCS="$INCS -I${includedir}"
149                 fi
150                 sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
151                         $INCS
152 ENDECHO
153                 ;;
154         --libs)
155                 OPTS=
156                 for opt in $lib_flags
157                 do
158                         [ -n "$OPTS" ] && OPTS="$OPTS "
159                         OPTS="${OPTS}${opt}"
160                 done
161                 printf "%s\n" "$OPTS"
162                 ;;
163         --libs-only-L)
164                 OPTS=
165                 for opt in $lib_flags
166                 do
167                         case "x$opt" in
168                         x-L*)
169                                 [ -n "$OPTS" ] && OPTS="$OPTS "
170                                 OPTS="${OPTS}${opt}"
171                                 ;;
172                         esac
173                 done
174                 printf "%s\n" "$OPTS"
175                 ;;
176         --libs-only-l)
177                 OPTS=
178                 for opt in $lib_flags
179                 do
180                         case "x$opt" in
181                         x-l*)
182                                 [ -n "$OPTS" ] && OPTS="$OPTS "
183                                 OPTS="${OPTS}${opt}"
184                                 ;;
185                         esac
186                 done
187                 printf "%s\n" "$OPTS"
188                 ;;
189         --libs-only-other)
190                 OPTS=
191                 for opt in $lib_flags
192                 do
193                         case "x$opt" in
194                         x-[lL]*)
195                                 ;;
196                         *)
197                                 [ -n "$OPTS" ] && OPTS="$OPTS "
198                                 OPTS="${OPTS}${opt}"
199                                 ;;
200                         esac
201                 done
202                 printf "%s\n" "$OPTS"
203                 ;;
204         # identification
205         --version)
206                 echo "@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@"
207                 ;;
208         --abi-version)
209                 echo "@cf_cv_abi_version@"
210                 ;;
211         --mouse-version)
212                 echo "@NCURSES_MOUSE_VERSION@"
213                 ;;
214         # locations
215         --bindir)
216                 echo "${bindir}"
217                 ;;
218         --datadir)
219                 echo "${datadir}"
220                 ;;
221         --includedir)
222                 INCS=
223                 if [ "x@WITH_OVERWRITE@" = xno ]; then
224                         INCS="${includesubdir}"
225                 elif [ "${includedir}" != /usr/include ]; then
226                         INCS="${includedir}"
227                 fi
228                 echo $INCS
229                 ;;
230         --libdir)
231                 echo "${libdir}"
232                 ;;
233         --mandir)
234                 echo "${mandir}"
235                 ;;
236         --terminfo)
237                 echo "@TERMINFO@"
238                 ;;
239         --terminfo-dirs)
240                 echo "@TERMINFO_DIRS@"
241                 ;;
242         --termpath)
243                 echo "@TERMPATH@"
244                 ;;
245         # general info
246         --help)
247                 cat <<ENDHELP
248 Usage: `basename $0` [options]
249
250 Options:
251   --prefix           echos the package-prefix of ${THIS}
252   --exec-prefix      echos the executable-prefix of ${THIS}
253
254   --cflags           echos the C compiler flags needed to compile with ${THIS}
255   --libs             echos the libraries needed to link with ${THIS}
256
257   --libs-only-L      echos -L linker options (search path) for ${THIS}
258   --libs-only-l      echos -l linker options (libraries) for ${THIS}
259   --libs-only-other  echos linker options other than -L/-l
260
261   --version          echos the release+patchdate version of ${THIS}
262   --abi-version      echos the ABI version of ${THIS}
263   --mouse-version    echos the mouse-interface version of ${THIS}
264
265   --bindir           echos the directory containing ${THIS} programs
266   --datadir          echos the directory containing ${THIS} data
267   --includedir       echos the directory containing ${THIS} header files
268   --libdir           echos the directory containing ${THIS} libraries
269   --mandir           echos the directory containing ${THIS} manpages
270   --terminfo         echos the \$TERMINFO terminfo database path
271   --terminfo-dirs    echos the \$TERMINFO_DIRS directory list
272   --termpath         echos the \$TERMPATH termcap list
273
274   --help             prints this message
275 ENDHELP
276                 ;;
277         --error|*)
278                 @SHELL@ $0 --help 1>&2
279                 exit 1
280                 ;;
281         esac
282         shift
283 done
284 # vi:ts=4 sw=4
285 # vile:shmode