]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - misc/ncurses-config.in
ncurses 6.4 - patch 20240420
[ncurses.git] / misc / ncurses-config.in
index 7f8ba697d118f4ce15a0f5440803aee5e32db335..c9f1cf80984366be481c397cb5d26d5b4124bef1 100644 (file)
@@ -1,7 +1,7 @@
 #!@SHELL@
 #!@SHELL@
-# $Id: ncurses-config.in,v 1.43 2020/02/02 23:34:34 tom Exp $
+# $Id: ncurses-config.in,v 1.52 2022/07/26 21:36:28 tom Exp $
 ##############################################################################
 ##############################################################################
-# Copyright 2018-2019,2020 Thomas E. Dickey                                  #
+# Copyright 2018-2021,2022 Thomas E. Dickey                                  #
 # Copyright 2006-2015,2017 Free Software Foundation, Inc.                    #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # Copyright 2006-2015,2017 Free Software Foundation, Inc.                    #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
@@ -98,10 +98,10 @@ fi
 # are standard library directories (i.e., the linker is supposed to search
 # those directories).
 #
 # are standard library directories (i.e., the linker is supposed to search
 # those directories).
 #
-# There is no portable way to find the list of standard library directories. 
+# There is no portable way to find the list of standard library directories.
 # Require a POSIX shell anyway, to keep this simple.
 lib_flags=
 # Require a POSIX shell anyway, to keep this simple.
 lib_flags=
-for opt in -L$libdir @LDFLAGS@ @EXTRA_LDFLAGS@ $LIBS
+for opt in -L$libdir @EXTRA_PKG_LDFLAGS@ $LIBS
 do
        case $opt in
        -specs*) # ignore linker specs-files which were used to build library
 do
        case $opt in
        -specs*) # ignore linker specs-files which were used to build library
@@ -110,11 +110,50 @@ do
        -Wl,-z,*) # ignore flags used to manipulate shared image
                continue
                ;;
        -Wl,-z,*) # ignore flags used to manipulate shared image
                continue
                ;;
+       -Wl,--dynamic-linker*) # ignore ELF interpreter
+               continue
+               ;;
+       -Wl,--as-needed|-Wl,--build-id=*|-Wl,-dT,*|-Wl,-T,*)
+               continue
+               ;;
        -L*)
        -L*)
-               [ -d ${opt##-L} ] || continue
-               case ${opt##-L} in
+               lib_check=`echo "x$opt" | sed -e 's/^.-L//'`
+               [ -d "$lib_check" ] || continue
+               case "$lib_check" in
                @LD_SEARCHPATH@) # skip standard libdir
                @LD_SEARCHPATH@) # skip standard libdir
-                       continue
+                       if [ "$lib_check" = "$libdir" ]
+                       then
+                               lib_first=yes
+                               IFS_save="$IFS"
+                               IFS='|'
+                               LIBDIRS="@LD_SEARCHPATH@"
+                               for lib_check in $LIBDIRS
+                               do
+                                       if [ -d "$lib_check" ]
+                                       then
+                                               if [ "$lib_check" != "$libdir" ]
+                                               then
+                                                       lib_first=no
+                                               fi
+                                               break
+                                       fi
+                               done
+                               IFS="$IFS_save"
+                               [ $lib_first = yes ] && continue
+                               found=no
+                               for check in $lib_flags
+                               do
+                                       if [ "x$check" = "x$opt" ]
+                                       then
+                                               found=yes
+                                               break
+                                       fi
+                               done
+                               [ $found = yes ] && continue
+                               :
+                       else
+                               continue
+                       fi
                        ;;
                *)
                        found=no
                        ;;
                *)
                        found=no
@@ -134,7 +173,7 @@ do
        lib_flags="$lib_flags $opt"
 done
 
        lib_flags="$lib_flags $opt"
 done
 
-[ $# = 0 ] && exec @SHELL@ $0 --error
+[ $# = 0 ] && exec @SHELL@ "$0" --error
 
 while [ $# -gt 0 ]; do
        case "$1" in
 
 while [ $# -gt 0 ]; do
        case "$1" in
@@ -165,7 +204,7 @@ ENDECHO
                        [ -n "$OPTS" ] && OPTS="$OPTS "
                        OPTS="${OPTS}${opt}"
                done
                        [ -n "$OPTS" ] && OPTS="$OPTS "
                        OPTS="${OPTS}${opt}"
                done
-               printf "%s\n" "$OPTS"
+               printf '%s\n' "$OPTS"
                ;;
        --libs-only-L)
                OPTS=
                ;;
        --libs-only-L)
                OPTS=
@@ -178,7 +217,7 @@ ENDECHO
                                ;;
                        esac
                done
                                ;;
                        esac
                done
-               printf "%s\n" "$OPTS"
+               printf '%s\n' "$OPTS"
                ;;
        --libs-only-l)
                OPTS=
                ;;
        --libs-only-l)
                OPTS=
@@ -191,7 +230,7 @@ ENDECHO
                                ;;
                        esac
                done
                                ;;
                        esac
                done
-               printf "%s\n" "$OPTS"
+               printf '%s\n' "$OPTS"
                ;;
        --libs-only-other)
                OPTS=
                ;;
        --libs-only-other)
                OPTS=
@@ -206,7 +245,7 @@ ENDECHO
                                ;;
                        esac
                done
                                ;;
                        esac
                done
-               printf "%s\n" "$OPTS"
+               printf '%s\n' "$OPTS"
                ;;
        # identification
        --version)
                ;;
        # identification
        --version)
@@ -232,7 +271,7 @@ ENDECHO
                elif [ "${includedir}" != /usr/include ]; then
                        INCS="${includedir}"
                fi
                elif [ "${includedir}" != /usr/include ]; then
                        INCS="${includedir}"
                fi
-               echo $INCS
+               echo "$INCS"
                ;;
        --libdir)
                echo "${libdir}"
                ;;
        --libdir)
                echo "${libdir}"
@@ -252,7 +291,7 @@ ENDECHO
        # general info
        --help)
                cat <<ENDHELP
        # general info
        --help)
                cat <<ENDHELP
-Usage: `basename $0` [options]
+Usage: `basename "$0"` [options]
 
 Options:
   --prefix           echos the package-prefix of ${THIS}
 
 Options:
   --prefix           echos the package-prefix of ${THIS}
@@ -282,7 +321,7 @@ Options:
 ENDHELP
                ;;
        --error|*)
 ENDHELP
                ;;
        --error|*)
-               @SHELL@ $0 --help 1>&2
+               @SHELL@ "$0" --help 1>&2
                exit 1
                ;;
        esac
                exit 1
                ;;
        esac