2 # $Id: gen-pkgconfig.in,v 1.36 2019/09/28 12:53:53 tom Exp $
3 ##############################################################################
4 # Copyright (c) 2009-2018,2019 Free Software Foundation, Inc. #
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: #
14 # The above copyright notice and this permission notice shall be included in #
15 # all copies or substantial portions of the Software. #
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. #
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 #
29 ##############################################################################
31 # Author: Thomas E. Dickey
33 # The complete configure script for ncurses is the ncurses5-config (or similar
34 # name, depending on the flavor, e.g., ncursesw5-config, ncurses6-config, etc).
35 # That provides more information than pkg-config, and is the portable and
36 # recommended solution.
38 # For each library, generate a ".pc" file which depends on the base ncurses
39 # library, except that the tinfo library does not depend on ncurses.
41 TINFO_NAME=@TINFO_NAME@
42 PANEL_NAME=@PANEL_NAME@
46 DFT_DEP_SUFFIX=@DFT_DEP_SUFFIX@
47 TINFO_ARG_SUFFIX=@TINFO_ARG_SUFFIX@
48 CXX_LIB_SUFFIX=@CXX_LIB_SUFFIX@
49 RPATH_LIST=@RPATH_LIST@
50 PRIVATE_LIBS="@PRIVATE_LIBS@"
52 suffix=@PC_MODULE_SUFFIX@
54 exec_prefix="@exec_prefix@"
55 includedir="@includedir@@includesubdir@"
58 show_prefix='@prefix@'
59 show_exec_prefix='@exec_prefix@'
60 show_includedir='@includedir@@includesubdir@'
61 show_libdir='@libdir@'
63 MAIN_LIBRARY="${LIB_NAME}@USE_ARG_SUFFIX@"
64 SUB_LIBRARY="${TINFO_ARG_SUFFIX}"
65 PANEL_LIBRARY="${PANEL_NAME}@USE_ARG_SUFFIX@"
66 MENU_LIBRARY="${MENU_NAME}@USE_ARG_SUFFIX@"
67 FORM_LIBRARY="${FORM_NAME}@USE_ARG_SUFFIX@"
70 if [ "$includedir" != "/usr/include" ]; then
71 includetop=`echo "$includedir" | sed -e 's,/include/[^/]*$,/include,'`
72 [ "$includetop" = "/usr/include" ] && includetop="$includedir"
73 if [ "x$includetop" != "x$includedir" ]
75 CFLAGS="$CFLAGS -I${includetop}"
77 CFLAGS="$CFLAGS -I\${includedir}"
81 if [ "$libdir" != "/usr/lib" ]; then
82 LDFLAGS="$LDFLAGS -L\${libdir}"
84 if [ "x@EXTRA_LDFLAGS@" != "x" ]; then
85 LDFLAGS="$LDFLAGS @EXTRA_LDFLAGS@"
88 # Check if we should specify the tinfo library explicitly so that terminfo
89 # functions or curses variables (which also reside in tinfo) can be linked
90 # using the -lncurses option.
92 if [ "x@TINFO_LIBS@" != "x" ] && \
93 [ "x$TINFO_ARG_SUFFIX" != "x$MAIN_LIBRARY" ]
98 for name in @PC_MODULES_TO_MAKE@
103 desc="ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@"
106 if [ $name = $MAIN_LIBRARY ]; then
108 [ $NEED_TINFO = yes ] && LIBS="$LIBS -l$TINFO_ARG_SUFFIX"
109 elif [ $name = $SUB_LIBRARY ]; then
110 desc="$desc terminal interface library"
111 elif expr $name : ".*${CXX_NAME}.*" >/dev/null ; then
112 reqs="$PANEL_LIBRARY${suffix}, $MENU_LIBRARY${suffix}, $FORM_LIBRARY${suffix}, $MAIN_LIBRARY${suffix}"
113 desc="$desc add-on library"
115 reqs="$MAIN_LIBRARY${suffix}"
116 desc="$desc add-on library"
119 if [ $name != $SUB_LIBRARY ] && \
120 [ $SUB_LIBRARY != $MAIN_LIBRARY ] && \
121 [ $name != $TINFO_NAME ] && \
122 [ $NEED_TINFO != yes ] ; then
123 [ -n "$reqs" ] && reqs="$reqs, "
124 reqs="${reqs}${SUB_LIBRARY}${suffix}"
127 if [ $name = $MAIN_LIBRARY ]
129 main_libs="$PRIVATE_LIBS"
134 echo "** creating ${name}${suffix}.pc"
135 cat >${name}${suffix}.pc <<EOF
136 # pkg-config file generated by `basename $0`
140 exec_prefix=$show_exec_prefix
142 includedir=$show_includedir
143 abi_version=@cf_cv_abi_version@
144 major_version=@NCURSES_MAJOR@
145 version=@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@
147 Name: ${name}${suffix}
150 URL: https://invisible-island.net/ncurses
151 Requires.private: $reqs
153 Libs.private: @LIBS@ $main_libs
158 # vile:shmode ts=4 sw=4