5 kx #!@SHELL@
5 kx # $Id: dialog-config.in,v 1.14 2021/03/05 23:48:36 tom Exp $
5 kx ##############################################################################
5 kx # Copyright (c) 2007-2019,2021 Thomas E. Dickey #
5 kx # #
5 kx # Permission is hereby granted, free of charge, to any person obtaining a #
5 kx # copy of this software and associated documentation files (the "Software"), #
5 kx # to deal in the Software without restriction, including without limitation #
5 kx # the rights to use, copy, modify, merge, publish, distribute, distribute #
5 kx # with modifications, sublicense, and/or sell copies of the Software, and to #
5 kx # permit persons to whom the Software is furnished to do so, subject to the #
5 kx # following conditions: #
5 kx # #
5 kx # The above copyright notice and this permission notice shall be included in #
5 kx # all copies or substantial portions of the Software. #
5 kx # #
5 kx # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
5 kx # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
5 kx # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
5 kx # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
5 kx # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
5 kx # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
5 kx # DEALINGS IN THE SOFTWARE. #
5 kx # #
5 kx # Except as contained in this notice, the name(s) of the above copyright #
5 kx # holders shall not be used in advertising or otherwise to promote the sale, #
5 kx # use or other dealings in this Software without prior written #
5 kx # authorization. #
5 kx ##############################################################################
5 kx
5 kx prefix="@prefix@"
5 kx exec_prefix="@exec_prefix@"
5 kx datarootdir="@datarootdir@"
5 kx
5 kx same_prefix=yes
5 kx same_exec_prefix=yes
5 kx
5 kx THIS="@PACKAGE@"
5 kx
5 kx test $# = 0 && exec @SHELL@ "$0" --error
5 kx
5 kx while test $# -gt 0; do
5 kx
5 kx # (re)evaluate symbols that may depend upon $prefix
5 kx if [ "x$same_prefix" != "xyes" ]
5 kx then
5 kx eval exec_prefix='@exec_prefix@'
5 kx eval datarootdir='@datarootdir@'
5 kx elif [ "x$same_exec_prefix" != "xyes" ]
5 kx then
5 kx eval datarootdir='@datarootdir@'
5 kx fi
5 kx
5 kx eval bindir='"@bindir@"'
5 kx eval includedir='"@includedir@"'
5 kx eval libdir='"@libdir@"'
5 kx eval datadir='"@datadir@"'
5 kx eval mandir='"@mandir@"'
5 kx
5 kx [ -z "$includedir" ] && includedir="${prefix}/include"
5 kx
5 kx eval LDFLAGS='"@LDFLAGS@"'
5 kx eval LIBS='"@LIBS@"'
5 kx LIBS="-l${THIS} $LIBS"
5 kx
5 kx # If the directory given by --libdir is not in the LDFLAGS+LIBS set,
5 kx # prepend it to LDFLAGS to help link this application's library.
5 kx found=no
5 kx for opt in $LDFLAGS $LIBS
5 kx do
5 kx if [ "x$-L${libdir}" = "x$opt" ]
5 kx then
5 kx found=yes
5 kx break
5 kx fi
5 kx done
5 kx if [ $found = no ]
5 kx then
5 kx [ -n "$LFLAGS" ] && LDFLAGS=" $LFDLAGS"
5 kx LDFLAGS="-L${libdir}$LDFLAGS"
5 kx fi
5 kx [ -z "$LDFLAGS" ] && LDFLAGS="-L${libdir}"
5 kx
5 kx # Ignore -L options which do not correspond to an actual directory,
5 kx # or which are standard library directories (i.e., the linker is
5 kx # supposed to search those directories).
5 kx #
5 kx # There is no portable way to find the list of standard library
5 kx # directories. Require a POSIX shell anyway, to keep this simple.
5 kx lib_flags=
5 kx for opt in $LDFLAGS $LIBS
5 kx do
5 kx case $opt in
5 kx -L*)
5 kx opt_lib=`echo "x$opt" | sed -e 's/^x-L//'`
5 kx [ -d "$opt_lib" ] || continue
5 kx case "$opt_lib" in
5 kx @LD_SEARCHPATH@) # skip standard libdir
5 kx continue
5 kx ;;
5 kx *)
5 kx ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx lib_flags="$lib_flags $opt"
5 kx done
5 kx
5 kx case "$1" in
5 kx -*=*)
5 kx ARG=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
5 kx ;;
5 kx *)
5 kx ARG=
5 kx ;;
5 kx esac
5 kx
5 kx case "$1" in
5 kx # basic configuration
5 kx --prefix=*)
5 kx prefix="$ARG"
5 kx test -z "$exec_prefix" && exec_prefix="$ARG"
5 kx same_prefix=no
5 kx ;;
5 kx --prefix)
5 kx echo "$prefix"
5 kx ;;
5 kx --exec-prefix=*)
5 kx exec_prefix="$ARG"
5 kx same_exec_prefix=no
5 kx ;;
5 kx --exec-prefix)
5 kx echo "$exec_prefix"
5 kx ;;
5 kx # compile/link
5 kx --cflags|--cflags-only-I)
5 kx INCS="-I$includedir"
5 kx sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
5 kx $INCS
5 kx ENDECHO
5 kx ;;
5 kx --cflags-only-other)
5 kx # no -D/-U options should be needed
5 kx echo
5 kx ;;
5 kx --ldflags)
5 kx OPTS=
5 kx for opt in $LDFLAGS $LIBS
5 kx do
5 kx case "x$opt" in
5 kx x-[^l]*)
5 kx OPTS="$OPTS $opt"
5 kx ;;
5 kx esac
5 kx done
5 kx printf "%s\n" "$OPTS"
5 kx ;;
5 kx --libs)
5 kx OPTS=
5 kx for opt in $lib_flags
5 kx do
5 kx [ -n "$OPTS" ] && OPTS="$OPTS "
5 kx OPTS="${OPTS}${opt}"
5 kx done
5 kx printf "%s\n" "$OPTS"
5 kx ;;
5 kx --libs-only-L)
5 kx OPTS=
5 kx for opt in $lib_flags
5 kx do
5 kx case "x$opt" in
5 kx x-L*)
5 kx [ -n "$OPTS" ] && OPTS="$OPTS "
5 kx OPTS="${OPTS}${opt}"
5 kx ;;
5 kx esac
5 kx done
5 kx printf "%s\n" "$OPTS"
5 kx ;;
5 kx --libs-only-l)
5 kx OPTS=
5 kx for opt in $lib_flags
5 kx do
5 kx case "x$opt" in
5 kx x-l*)
5 kx [ -n "$OPTS" ] && OPTS="$OPTS "
5 kx OPTS="${OPTS}${opt}"
5 kx ;;
5 kx esac
5 kx done
5 kx printf "%s\n" "$OPTS"
5 kx ;;
5 kx --libs-only-other)
5 kx OPTS=
5 kx for opt in $lib_flags
5 kx do
5 kx case "x$opt" in
5 kx x-[lL]*)
5 kx ;;
5 kx *)
5 kx [ -n "$OPTS" ] && OPTS="$OPTS "
5 kx OPTS="${OPTS}${opt}"
5 kx ;;
5 kx esac
5 kx done
5 kx printf "%s\n" "$OPTS"
5 kx ;;
5 kx # identification
5 kx --version)
5 kx echo "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@"
5 kx ;;
5 kx --abi-version)
5 kx echo "@VERSION@" | sed -e 's/:/./g'
5 kx ;;
5 kx # locations
5 kx --bindir)
5 kx echo "${bindir}"
5 kx ;;
5 kx --datadir)
5 kx echo "${datadir}"
5 kx ;;
5 kx --libdir)
5 kx echo "${libdir}"
5 kx ;;
5 kx --mandir)
5 kx echo "${mandir}"
5 kx ;;
5 kx # general info
5 kx --help)
5 kx cat <<ENDHELP
5 kx Usage: ${THIS}-config [options]
5 kx
5 kx Options:
5 kx --prefix echos the package-prefix of ${THIS}
5 kx --prefix=ARG sets the package-prefix of ${THIS}
5 kx --exec-prefix echos the executable-prefix of ${THIS}
5 kx --exec-prefix=ARG sets the executable-prefix of ${THIS}
5 kx
5 kx --cflags echos the C compiler flags needed to compile with ${THIS}
5 kx --ldflags echos the linker flags needed to link with ${THIS}
5 kx
5 kx --libs echos the libraries needed to link with ${THIS}
5 kx --libs-only-L echos -L linker options (search path) for ${THIS}
5 kx --libs-only-l echos -l linker options (libraries) for ${THIS}
5 kx --libs-only-other echos linker options other than -L/-l
5 kx
5 kx --version echos the release+patchdate version of ${THIS}
5 kx --abi-version echos the ABI version of ${THIS}
5 kx
5 kx --bindir echos the directory containing ${THIS} programs
5 kx --datadir echos the directory containing ${THIS} data
5 kx --libdir echos the directory containing ${THIS} libraries
5 kx --mandir echos the directory containing ${THIS} manual pages
5 kx
5 kx --help prints this message
5 kx ENDHELP
5 kx ;;
5 kx --error|*)
5 kx @SHELL@ "$0" --help 1>&2
5 kx exit 1
5 kx ;;
5 kx esac
5 kx shift
5 kx done
5 kx # vile:shmode