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