2013-01-26 11:39:31 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-08-01 15:32:49 +02:00
|
|
|
# Keep this script in sync with python-config.in
|
|
|
|
|
2013-01-26 11:39:31 +01:00
|
|
|
exit_with_usage ()
|
|
|
|
{
|
2024-02-26 21:04:44 +01:00
|
|
|
local USAGE="Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed"
|
|
|
|
if [[ "$1" -eq 0 ]]; then
|
|
|
|
echo "$USAGE"
|
|
|
|
else
|
|
|
|
echo "$USAGE" >&2
|
|
|
|
fi
|
2013-01-26 11:39:31 +01: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 15:32:49 +02:00
|
|
|
if readlink -f "$RESULT" >/dev/null 2>&1; then
|
|
|
|
RESULT=$(readlink -f "$RESULT")
|
|
|
|
fi
|
2013-01-26 11:39:31 +01:00
|
|
|
fi
|
|
|
|
echo $RESULT
|
|
|
|
}
|
|
|
|
|
|
|
|
prefix_real=$(installed_prefix "$0")
|
|
|
|
|
2013-08-01 15:32:49 +02:00
|
|
|
# Use sed to fix paths from their built-to locations to their installed-to
|
2017-09-27 07:45:06 +02: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 11:39:31 +01:00
|
|
|
VERSION="@VERSION@"
|
|
|
|
LIBM="@LIBM@"
|
|
|
|
LIBC="@LIBC@"
|
|
|
|
SYSLIBS="$LIBM $LIBC"
|
|
|
|
ABIFLAGS="@ABIFLAGS@"
|
2024-03-22 00:54:50 +01:00
|
|
|
LIBS="@MODULE_LDFLAGS@ @LIBS@ $SYSLIBS"
|
2019-05-23 03:30:23 +02:00
|
|
|
LIBS_EMBED="-lpython${VERSION}${ABIFLAGS} @LIBS@ $SYSLIBS"
|
2013-01-26 11:39:31 +01:00
|
|
|
BASECFLAGS="@BASECFLAGS@"
|
|
|
|
LDLIBRARY="@LDLIBRARY@"
|
|
|
|
OPT="@OPT@"
|
|
|
|
PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
|
|
|
|
LDVERSION="@LDVERSION@"
|
2017-09-27 07:45:06 +02:00
|
|
|
LIBDEST=${prefix_real}/lib/python${VERSION}
|
|
|
|
LIBPL=$(echo "@LIBPL@" | sed "s#$prefix#$prefix_real#")
|
2015-10-19 14:07:57 +02:00
|
|
|
SO="@EXT_SUFFIX@"
|
2013-01-26 11:39:31 +01:00
|
|
|
PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
|
|
|
|
INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
|
|
|
|
PLATINCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
|
2019-05-23 03:30:23 +02:00
|
|
|
PY_EMBED=0
|
2013-01-26 11:39:31 +01:00
|
|
|
|
|
|
|
# Scan for --help or unknown argument.
|
|
|
|
for ARG in $*
|
|
|
|
do
|
|
|
|
case $ARG in
|
|
|
|
--help)
|
|
|
|
exit_with_usage 0
|
|
|
|
;;
|
2019-05-23 03:30:23 +02:00
|
|
|
--embed)
|
|
|
|
PY_EMBED=1
|
|
|
|
;;
|
2013-01-26 11:39:31 +01:00
|
|
|
--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--abiflags|--configdir)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit_with_usage 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2019-05-23 03:30:23 +02:00
|
|
|
if [ $PY_EMBED = 1 ] ; then
|
|
|
|
LIBS="$LIBS_EMBED"
|
|
|
|
fi
|
|
|
|
|
2013-01-26 11:39:31 +01:00
|
|
|
for ARG in "$@"
|
|
|
|
do
|
|
|
|
case "$ARG" in
|
|
|
|
--prefix)
|
2017-09-27 07:45:06 +02:00
|
|
|
echo "$prefix_real"
|
2013-01-26 11:39:31 +01:00
|
|
|
;;
|
|
|
|
--exec-prefix)
|
2017-09-27 07:45:06 +02:00
|
|
|
echo "$exec_prefix_real"
|
2013-01-26 11:39:31 +01: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 18:12:44 +02:00
|
|
|
echo "$LIBPLUSED -L$libdir $LIBS"
|
2013-01-26 11:39:31 +01:00
|
|
|
;;
|
|
|
|
--extension-suffix)
|
|
|
|
echo "$SO"
|
|
|
|
;;
|
|
|
|
--abiflags)
|
|
|
|
echo "$ABIFLAGS"
|
|
|
|
;;
|
|
|
|
--configdir)
|
|
|
|
echo "$LIBPL"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|