2013-01-26 06:39:31 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-08-01 10:32:49 -03:00
|
|
|
# Keep this script in sync with python-config.in
|
|
|
|
|
2013-01-26 06:39:31 -04:00
|
|
|
exit_with_usage ()
|
|
|
|
{
|
2024-06-11 04:11:13 -03:00
|
|
|
local usage
|
|
|
|
usage="Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed"
|
|
|
|
if [ "$1" -eq 0 ]; then
|
|
|
|
echo "$usage"
|
2024-02-26 16:04:44 -04:00
|
|
|
else
|
2024-06-11 04:11:13 -03:00
|
|
|
echo "$usage" >&2
|
2024-02-26 16:04:44 -04:00
|
|
|
fi
|
2013-01-26 06:39:31 -04:00
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$1" = "" ] ; then
|
|
|
|
exit_with_usage 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Returns the actual prefix where this script was installed to.
|
|
|
|
installed_prefix ()
|
|
|
|
{
|
|
|
|
RESULT=$(dirname $(cd $(dirname "$1") && pwd -P))
|
|
|
|
if which readlink >/dev/null 2>&1 ; then
|
2013-08-01 10:32:49 -03:00
|
|
|
if readlink -f "$RESULT" >/dev/null 2>&1; then
|
|
|
|
RESULT=$(readlink -f "$RESULT")
|
|
|
|
fi
|
2013-01-26 06:39:31 -04:00
|
|
|
fi
|
|
|
|
echo $RESULT
|
|
|
|
}
|
|
|
|
|
|
|
|
prefix_real=$(installed_prefix "$0")
|
|
|
|
|
2013-08-01 10:32:49 -03:00
|
|
|
# Use sed to fix paths from their built-to locations to their installed-to
|
2017-09-27 02:45:06 -03:00
|
|
|
# locations. Keep prefix & exec_prefix using their original values in case
|
|
|
|
# they are referenced in other configure variables, to prevent double
|
|
|
|
# substitution, issue #22140.
|
|
|
|
prefix="@prefix@"
|
|
|
|
exec_prefix="@exec_prefix@"
|
|
|
|
exec_prefix_real=${prefix_real}
|
|
|
|
includedir=$(echo "@includedir@" | sed "s#$prefix#$prefix_real#")
|
|
|
|
libdir=$(echo "@libdir@" | sed "s#$prefix#$prefix_real#")
|
|
|
|
CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix#$prefix_real#")
|
2013-01-26 06:39:31 -04:00
|
|
|
VERSION="@VERSION@"
|
|
|
|
LIBM="@LIBM@"
|
|
|
|
LIBC="@LIBC@"
|
|
|
|
SYSLIBS="$LIBM $LIBC"
|
|
|
|
ABIFLAGS="@ABIFLAGS@"
|
2024-08-08 19:00:55 -03:00
|
|
|
LIBS="@LIBPYTHON@ @LIBS@ $SYSLIBS"
|
2019-05-22 22:30:23 -03:00
|
|
|
LIBS_EMBED="-lpython${VERSION}${ABIFLAGS} @LIBS@ $SYSLIBS"
|
2013-01-26 06:39:31 -04:00
|
|
|
BASECFLAGS="@BASECFLAGS@"
|
|
|
|
LDLIBRARY="@LDLIBRARY@"
|
|
|
|
OPT="@OPT@"
|
|
|
|
PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
|
|
|
|
LDVERSION="@LDVERSION@"
|
2017-09-27 02:45:06 -03:00
|
|
|
LIBDEST=${prefix_real}/lib/python${VERSION}
|
|
|
|
LIBPL=$(echo "@LIBPL@" | sed "s#$prefix#$prefix_real#")
|
2015-10-19 09:07:57 -03:00
|
|
|
SO="@EXT_SUFFIX@"
|
2013-01-26 06:39:31 -04:00
|
|
|
PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
|
|
|
|
INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
|
|
|
|
PLATINCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
|
2019-05-22 22:30:23 -03:00
|
|
|
PY_EMBED=0
|
2013-01-26 06:39:31 -04:00
|
|
|
|
|
|
|
# Scan for --help or unknown argument.
|
|
|
|
for ARG in $*
|
|
|
|
do
|
|
|
|
case $ARG in
|
|
|
|
--help)
|
|
|
|
exit_with_usage 0
|
|
|
|
;;
|
2019-05-22 22:30:23 -03:00
|
|
|
--embed)
|
|
|
|
PY_EMBED=1
|
|
|
|
;;
|
2013-01-26 06:39:31 -04:00
|
|
|
--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--abiflags|--configdir)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit_with_usage 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2019-05-22 22:30:23 -03:00
|
|
|
if [ $PY_EMBED = 1 ] ; then
|
|
|
|
LIBS="$LIBS_EMBED"
|
|
|
|
fi
|
|
|
|
|
2013-01-26 06:39:31 -04:00
|
|
|
for ARG in "$@"
|
|
|
|
do
|
|
|
|
case "$ARG" in
|
|
|
|
--prefix)
|
2017-09-27 02:45:06 -03:00
|
|
|
echo "$prefix_real"
|
2013-01-26 06:39:31 -04:00
|
|
|
;;
|
|
|
|
--exec-prefix)
|
2017-09-27 02:45:06 -03:00
|
|
|
echo "$exec_prefix_real"
|
2013-01-26 06:39:31 -04:00
|
|
|
;;
|
|
|
|
--includes)
|
|
|
|
echo "$INCDIR $PLATINCDIR"
|
|
|
|
;;
|
|
|
|
--cflags)
|
|
|
|
echo "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT"
|
|
|
|
;;
|
|
|
|
--libs)
|
|
|
|
echo "$LIBS"
|
|
|
|
;;
|
|
|
|
--ldflags)
|
|
|
|
LIBPLUSED=
|
|
|
|
if [ "$PY_ENABLE_SHARED" = "0" ] ; then
|
|
|
|
LIBPLUSED="-L$LIBPL"
|
|
|
|
fi
|
2019-04-09 13:12:44 -03:00
|
|
|
echo "$LIBPLUSED -L$libdir $LIBS"
|
2013-01-26 06:39:31 -04:00
|
|
|
;;
|
|
|
|
--extension-suffix)
|
|
|
|
echo "$SO"
|
|
|
|
;;
|
|
|
|
--abiflags)
|
|
|
|
echo "$ABIFLAGS"
|
|
|
|
;;
|
|
|
|
--configdir)
|
|
|
|
echo "$LIBPL"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|