diff -ruN a/misc/gen-pkgconfig.in b/misc/gen-pkgconfig.in --- a/misc/gen-pkgconfig.in 2021-08-07 23:36:33.000000000 +0200 +++ b/misc/gen-pkgconfig.in 2021-11-03 11:12:51.127160950 +0100 @@ -83,7 +83,7 @@ fi lib_flags= -for opt in -L$libdir @EXTRA_PKG_LDFLAGS@ @LIBS@ +for opt in -L$libdir @LIBS@ do case $opt in -l*) # LIBS is handled specially below diff -ruN a/misc/ncurses-config.in b/misc/ncurses-config.in --- a/misc/ncurses-config.in 2021-08-07 23:36:14.000000000 +0200 +++ b/misc/ncurses-config.in 2021-11-03 11:26:12.393533954 +0100 @@ -101,7 +101,7 @@ # There is no portable way to find the list of standard library directories. # Require a POSIX shell anyway, to keep this simple. lib_flags= -for opt in -L$libdir @EXTRA_PKG_LDFLAGS@ $LIBS +for opt in -L$libdir $LIBS do case $opt in -specs*) # ignore linker specs-files which were used to build library