gen-pkgconfig.in revision 262685
1219820Sjeff#!@SHELL@
2219820Sjeff# $Id: gen-pkgconfig.in,v 1.16 2014/01/18 20:21:45 tom Exp $
3219820Sjeff##############################################################################
4219820Sjeff# Copyright (c) 2009-2013,2014 Free Software Foundation, Inc.                #
5219820Sjeff#                                                                            #
6219820Sjeff# Permission is hereby granted, free of charge, to any person obtaining a    #
7219820Sjeff# copy of this software and associated documentation files (the "Software"), #
8219820Sjeff# to deal in the Software without restriction, including without limitation  #
9219820Sjeff# the rights to use, copy, modify, merge, publish, distribute, distribute    #
10219820Sjeff# with modifications, sublicense, and/or sell copies of the Software, and to #
11219820Sjeff# permit persons to whom the Software is furnished to do so, subject to the  #
12219820Sjeff# following conditions:                                                      #
13219820Sjeff#                                                                            #
14219820Sjeff# The above copyright notice and this permission notice shall be included in #
15219820Sjeff# all copies or substantial portions of the Software.                        #
16219820Sjeff#                                                                            #
17219820Sjeff# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18219820Sjeff# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
19219820Sjeff# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
20219820Sjeff# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
21219820Sjeff# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
22219820Sjeff# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
23219820Sjeff# DEALINGS IN THE SOFTWARE.                                                  #
24219820Sjeff#                                                                            #
25219820Sjeff# Except as contained in this notice, the name(s) of the above copyright     #
26219820Sjeff# holders shall not be used in advertising or otherwise to promote the sale, #
27219820Sjeff# use or other dealings in this Software without prior written               #
28219820Sjeff# authorization.                                                             #
29219820Sjeff##############################################################################
30219820Sjeff#
31219820Sjeff# Author: Thomas E. Dickey
32219820Sjeff#
33219820Sjeff# The complete configure script for ncurses is the ncurses5-config (or similar
34219820Sjeff# name, depending on the flavor, e.g., ncursesw5-config, ncurses6-config, etc).
35219820Sjeff# That provides more information than pkg-config, and is the portable and
36219820Sjeff# recommended solution.
37219820Sjeff#
38219820Sjeff# For each library, generate a ".pc" file which depends on the base ncurses
39219820Sjeff# library, except that the tinfo library does not depend on ncurses.
40219820SjeffLIB_NAME=@LIB_NAME@
41219820SjeffTINFO_NAME=@TINFO_NAME@
42219820SjeffPANEL_NAME=@PANEL_NAME@
43219820SjeffMENU_NAME=@MENU_NAME@
44219820SjeffFORM_NAME=@FORM_NAME@
45219820SjeffCXX_NAME=@CXX_NAME@
46219820SjeffDFT_DEP_SUFFIX=@DFT_DEP_SUFFIX@
47219820SjeffTINFO_ARG_SUFFIX=@TINFO_ARG_SUFFIX@
48219820SjeffCXX_LIB_SUFFIX=@CXX_LIB_SUFFIX@
49219820Sjeff
50219820Sjeffprefix="@prefix@"
51219820Sjeffexec_prefix="@exec_prefix@"
52219820Sjeffincludedir="@includedir@@includesubdir@"
53219820Sjefflibdir="@libdir@"
54219820Sjeff
55219820Sjeffshow_prefix='@prefix@'
56219820Sjeffshow_exec_prefix='@exec_prefix@'
57219820Sjeffshow_includedir='@includedir@@includesubdir@'
58219820Sjeffshow_libdir='@libdir@'
59219820Sjeff
60219820SjeffMAIN_LIBRARY="${LIB_NAME}@DFT_ARG_SUFFIX@"
61219820SjeffSUB_LIBRARY="${TINFO_ARG_SUFFIX}"
62219820SjeffPANEL_LIBRARY="${PANEL_NAME}@DFT_ARG_SUFFIX@"
63219820SjeffMENU_LIBRARY="${MENU_NAME}@DFT_ARG_SUFFIX@"
64219820SjeffFORM_LIBRARY="${FORM_NAME}@DFT_ARG_SUFFIX@"
65219820Sjeff
66219820Sjeffif test "$includedir" = "/usr/include" ; then
67219820Sjeff	CFLAGS=
68219820Sjeffelse
69219820Sjeff	CFLAGS="-I\${includedir}"
70219820Sjefffi
71219820Sjeff
72219820Sjeffif test "$libdir" = "/usr/lib" ; then
73219820Sjeff	LDFLAGS=
74219820Sjeffelse
75219820Sjeff	LDFLAGS="-L\${libdir}"
76219820Sjefffi
77219820Sjeff
78219820Sjefffor name in @PC_MODULES_TO_MAKE@
79219820Sjeffdo
80219820Sjeff	name="${name}"
81219820Sjeff
82219820Sjeff	desc="ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@"
83219820Sjeff	reqs=
84219820Sjeff
85219820Sjeff	if test $name = $MAIN_LIBRARY ; then
86219820Sjeff		desc="$desc library"
87219820Sjeff	elif test $name = $SUB_LIBRARY ; then
88219820Sjeff		desc="$desc terminal interface library"
89219820Sjeff	elif expr $name : ".*${CXX_NAME}.*" >/dev/null ; then
90219820Sjeff		reqs="$PANEL_LIBRARY, $MENU_LIBRARY, $FORM_LIBRARY, $MAIN_LIBRARY"
91219820Sjeff		desc="$desc add-on library"
92219820Sjeff	else
93219820Sjeff		reqs="$MAIN_LIBRARY"
94219820Sjeff		desc="$desc add-on library"
95219820Sjeff	fi
96219820Sjeff
97219820Sjeff	if test $name != $SUB_LIBRARY && test $SUB_LIBRARY != $MAIN_LIBRARY ; then
98219820Sjeff		if test $name != $TINFO_NAME ; then
99219820Sjeff			test -n "$reqs" && reqs="$reqs, "
100219820Sjeff			reqs="${reqs}${SUB_LIBRARY}"
101219820Sjeff		fi
102219820Sjeff	fi
103219820Sjeff
104219820Sjeff	echo "** creating ${name}.pc"
105219820Sjeff	cat >${name}.pc <<EOF
106219820Sjeffprefix=$show_prefix
107219820Sjeffexec_prefix=$show_exec_prefix
108219820Sjefflibdir=$show_libdir
109219820Sjeffincludedir=$show_includedir
110219820Sjeffmajor_version=@NCURSES_MAJOR@
111219820Sjeffversion=@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@
112219820Sjeff
113219820SjeffName: $name
114219820SjeffDescription: $desc
115219820SjeffVersion: \${version}
116219820SjeffURL: http://invisible-island.net/ncurses
117219820SjeffRequires.private: $reqs
118219820SjeffLibs: $LDFLAGS -l$name
119219820SjeffLibs.private: @LIBS@
120219820SjeffCflags: $CFLAGS
121219820SjeffEOF
122219820Sjeff
123219820Sjeff	#pr -f ${name}.pc
124219820Sjeffdone
125219820Sjeff# vile:shmode
126219820Sjeff