1262617Sdelphij#!@SHELL@
2262685Sdelphij# $Id: gen-pkgconfig.in,v 1.16 2014/01/18 20:21:45 tom Exp $
3262617Sdelphij##############################################################################
4262685Sdelphij# Copyright (c) 2009-2013,2014 Free Software Foundation, Inc.                #
5262617Sdelphij#                                                                            #
6262617Sdelphij# Permission is hereby granted, free of charge, to any person obtaining a    #
7262617Sdelphij# copy of this software and associated documentation files (the "Software"), #
8262617Sdelphij# to deal in the Software without restriction, including without limitation  #
9262617Sdelphij# the rights to use, copy, modify, merge, publish, distribute, distribute    #
10262617Sdelphij# with modifications, sublicense, and/or sell copies of the Software, and to #
11262617Sdelphij# permit persons to whom the Software is furnished to do so, subject to the  #
12262617Sdelphij# following conditions:                                                      #
13262617Sdelphij#                                                                            #
14262617Sdelphij# The above copyright notice and this permission notice shall be included in #
15262617Sdelphij# all copies or substantial portions of the Software.                        #
16262617Sdelphij#                                                                            #
17262617Sdelphij# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18262617Sdelphij# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
19262617Sdelphij# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
20262617Sdelphij# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
21262617Sdelphij# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
22262617Sdelphij# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
23262617Sdelphij# DEALINGS IN THE SOFTWARE.                                                  #
24262617Sdelphij#                                                                            #
25262617Sdelphij# Except as contained in this notice, the name(s) of the above copyright     #
26262617Sdelphij# holders shall not be used in advertising or otherwise to promote the sale, #
27262617Sdelphij# use or other dealings in this Software without prior written               #
28262617Sdelphij# authorization.                                                             #
29262617Sdelphij##############################################################################
30262617Sdelphij#
31262685Sdelphij# Author: Thomas E. Dickey
32262617Sdelphij#
33262617Sdelphij# The complete configure script for ncurses is the ncurses5-config (or similar
34262617Sdelphij# name, depending on the flavor, e.g., ncursesw5-config, ncurses6-config, etc).
35262617Sdelphij# That provides more information than pkg-config, and is the portable and
36262617Sdelphij# recommended solution.
37262617Sdelphij#
38262617Sdelphij# For each library, generate a ".pc" file which depends on the base ncurses
39262617Sdelphij# library, except that the tinfo library does not depend on ncurses.
40262617SdelphijLIB_NAME=@LIB_NAME@
41262617SdelphijTINFO_NAME=@TINFO_NAME@
42262685SdelphijPANEL_NAME=@PANEL_NAME@
43262685SdelphijMENU_NAME=@MENU_NAME@
44262685SdelphijFORM_NAME=@FORM_NAME@
45262685SdelphijCXX_NAME=@CXX_NAME@
46262617SdelphijDFT_DEP_SUFFIX=@DFT_DEP_SUFFIX@
47262617SdelphijTINFO_ARG_SUFFIX=@TINFO_ARG_SUFFIX@
48262617SdelphijCXX_LIB_SUFFIX=@CXX_LIB_SUFFIX@
49262617Sdelphij
50262617Sdelphijprefix="@prefix@"
51262617Sdelphijexec_prefix="@exec_prefix@"
52262685Sdelphijincludedir="@includedir@@includesubdir@"
53262617Sdelphijlibdir="@libdir@"
54262617Sdelphij
55262617Sdelphijshow_prefix='@prefix@'
56262617Sdelphijshow_exec_prefix='@exec_prefix@'
57262685Sdelphijshow_includedir='@includedir@@includesubdir@'
58262617Sdelphijshow_libdir='@libdir@'
59262617Sdelphij
60262617SdelphijMAIN_LIBRARY="${LIB_NAME}@DFT_ARG_SUFFIX@"
61262617SdelphijSUB_LIBRARY="${TINFO_ARG_SUFFIX}"
62262617SdelphijPANEL_LIBRARY="${PANEL_NAME}@DFT_ARG_SUFFIX@"
63262617SdelphijMENU_LIBRARY="${MENU_NAME}@DFT_ARG_SUFFIX@"
64262617SdelphijFORM_LIBRARY="${FORM_NAME}@DFT_ARG_SUFFIX@"
65262617Sdelphij
66262685Sdelphijif test "$includedir" = "/usr/include" ; then
67262685Sdelphij	CFLAGS=
68262685Sdelphijelse
69262685Sdelphij	CFLAGS="-I\${includedir}"
70262617Sdelphijfi
71262617Sdelphij
72262685Sdelphijif test "$libdir" = "/usr/lib" ; then
73262685Sdelphij	LDFLAGS=
74262685Sdelphijelse
75262685Sdelphij	LDFLAGS="-L\${libdir}"
76262685Sdelphijfi
77262685Sdelphij
78262685Sdelphijfor name in @PC_MODULES_TO_MAKE@
79262617Sdelphijdo
80262685Sdelphij	name="${name}"
81262617Sdelphij
82262685Sdelphij	desc="ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@"
83262685Sdelphij	reqs=
84262617Sdelphij
85262617Sdelphij	if test $name = $MAIN_LIBRARY ; then
86262617Sdelphij		desc="$desc library"
87262617Sdelphij	elif test $name = $SUB_LIBRARY ; then
88262617Sdelphij		desc="$desc terminal interface library"
89262617Sdelphij	elif expr $name : ".*${CXX_NAME}.*" >/dev/null ; then
90262685Sdelphij		reqs="$PANEL_LIBRARY, $MENU_LIBRARY, $FORM_LIBRARY, $MAIN_LIBRARY"
91262617Sdelphij		desc="$desc add-on library"
92262617Sdelphij	else
93262685Sdelphij		reqs="$MAIN_LIBRARY"
94262617Sdelphij		desc="$desc add-on library"
95262617Sdelphij	fi
96262617Sdelphij
97262685Sdelphij	if test $name != $SUB_LIBRARY && test $SUB_LIBRARY != $MAIN_LIBRARY ; then
98262685Sdelphij		if test $name != $TINFO_NAME ; then
99262685Sdelphij			test -n "$reqs" && reqs="$reqs, "
100262685Sdelphij			reqs="${reqs}${SUB_LIBRARY}"
101262685Sdelphij		fi
102262617Sdelphij	fi
103262617Sdelphij
104262617Sdelphij	echo "** creating ${name}.pc"
105262617Sdelphij	cat >${name}.pc <<EOF
106262617Sdelphijprefix=$show_prefix
107262617Sdelphijexec_prefix=$show_exec_prefix
108262617Sdelphijlibdir=$show_libdir
109262617Sdelphijincludedir=$show_includedir
110262617Sdelphijmajor_version=@NCURSES_MAJOR@
111262617Sdelphijversion=@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@
112262617Sdelphij
113262617SdelphijName: $name
114262617SdelphijDescription: $desc
115262617SdelphijVersion: \${version}
116262685SdelphijURL: http://invisible-island.net/ncurses
117262685SdelphijRequires.private: $reqs
118262685SdelphijLibs: $LDFLAGS -l$name
119262685SdelphijLibs.private: @LIBS@
120262685SdelphijCflags: $CFLAGS
121262617SdelphijEOF
122262685Sdelphij
123262685Sdelphij	#pr -f ${name}.pc
124262617Sdelphijdone
125262617Sdelphij# vile:shmode
126