#!@SHELL@
-# $Id: gen-pkgconfig.in,v 1.36 2019/09/28 12:53:53 tom Exp $
+# $Id: gen-pkgconfig.in,v 1.42 2019/12/25 23:09:13 tom Exp $
##############################################################################
# Copyright (c) 2009-2018,2019 Free Software Foundation, Inc. #
# #
DFT_DEP_SUFFIX=@DFT_DEP_SUFFIX@
TINFO_ARG_SUFFIX=@TINFO_ARG_SUFFIX@
CXX_LIB_SUFFIX=@CXX_LIB_SUFFIX@
-RPATH_LIST=@RPATH_LIST@
-PRIVATE_LIBS="@PRIVATE_LIBS@"
suffix=@PC_MODULE_SUFFIX@
prefix="@prefix@"
includedir="@includedir@@includesubdir@"
libdir="@libdir@"
+RPATH_LIST=@RPATH_LIST@
+PRIVATE_LIBS="@PRIVATE_LIBS@"
+
show_prefix='@prefix@'
show_exec_prefix='@exec_prefix@'
show_includedir='@includedir@@includesubdir@'
if [ "$includedir" != "/usr/include" ]; then
includetop=`echo "$includedir" | sed -e 's,/include/[^/]*$,/include,'`
[ "$includetop" = "/usr/include" ] && includetop="$includedir"
+ CFLAGS="$CFLAGS -I\${includedir}"
if [ "x$includetop" != "x$includedir" ]
then
CFLAGS="$CFLAGS -I${includetop}"
fi
- CFLAGS="$CFLAGS -I\${includedir}"
fi
-LDFLAGS=
-if [ "$libdir" != "/usr/lib" ]; then
- LDFLAGS="$LDFLAGS -L\${libdir}"
-fi
-if [ "x@EXTRA_LDFLAGS@" != "x" ]; then
- LDFLAGS="$LDFLAGS @EXTRA_LDFLAGS@"
-fi
+lib_flags=
+for opt in -L$libdir @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
+do
+ case $opt in
+ -l*) # LIBS is handled specially below
+ continue
+ ;;
+ -specs*) # ignore linker specs-files which were used to build library
+ continue
+ ;;
+ -Wl,-z,*) # ignore flags used to manipulate shared image
+ continue
+ ;;
+ -L*)
+ [ -d ${opt##-L} ] || continue
+ case ${opt##-L} in
+ @LD_SEARCHPATH@) # skip standard libdir
+ continue
+ ;;
+ *)
+ found=no
+ for check in $lib_flags
+ do
+ if [ "x$check" = "x$opt" ]
+ then
+ found=yes
+ break
+ fi
+ done
+ [ $found = yes ] && continue
+ ;;
+ esac
+ ;;
+ esac
+ lib_flags="$lib_flags $opt"
+done
# Check if we should specify the tinfo library explicitly so that terminfo
# functions or curses variables (which also reside in tinfo) can be linked
if [ $name = $MAIN_LIBRARY ]; then
desc="$desc library"
[ $NEED_TINFO = yes ] && LIBS="$LIBS -l$TINFO_ARG_SUFFIX"
+ [ -n "@LIBS@" ] && LIBS="$LIBS @LIBS@"
elif [ $name = $SUB_LIBRARY ]; then
desc="$desc terminal interface library"
elif expr $name : ".*${CXX_NAME}.*" >/dev/null ; then
Version: \${version}
URL: https://invisible-island.net/ncurses
Requires.private: $reqs
-Libs: $LDFLAGS $LIBS
+Libs: $lib_flags $LIBS
Libs.private: @LIBS@ $main_libs
Cflags: $CFLAGS
EOF