ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
- --with-rlm-python-version=[0-9].[0-9] Version of Python to use [2.2]"
-ac_help="$ac_help
--with-rlm-python-lib-dir=DIR Directory for Python library files []"
ac_help="$ac_help
--with-rlm-python-include-dir=DIR Directory for Python include files []"
fi
-# From configure.in Revision: 1.3
+# From configure.in Revision: 1.1
if test x$with_rlm_python != xno; then
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:539: checking for $ac_word" >&5
+echo "configure:537: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:569: checking for $ac_word" >&5
+echo "configure:567: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:620: checking for $ac_word" >&5
+echo "configure:618: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:652: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:650: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
cat > conftest.$ac_ext << EOF
-#line 663 "configure"
+#line 661 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:694: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:692: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:699: checking whether we are using GNU C" >&5
+echo "configure:697: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:708: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:706: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:727: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:725: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:759: checking how to run the C preprocessor" >&5
+echo "configure:757: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 774 "configure"
+#line 772 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:780: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:778: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 791 "configure"
+#line 789 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:797: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 808 "configure"
+#line 806 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
echo "$ac_t""$CPP" 1>&6
- rlm_python_version=2.2
- # Check whether --with-rlm-python-version or --without-rlm-python-version was given.
-if test "${with_rlm_python_version+set}" = set; then
- withval="$with_rlm_python_version"
- case "$withval" in
- no)
- { echo "configure: error: Need rlm-python-version" 1>&2; exit 1; }
- ;;
- yes)
- ;;
- *)
- rlm_python_version="$withval"
- ;;
- esac
-
-fi
-
-
- rlm_python_lib_dir=
+ PY_LIB_DIR=
# Check whether --with-rlm-python-lib-dir or --without-rlm-python-lib-dir was given.
if test "${with_rlm_python_lib_dir+set}" = set; then
withval="$with_rlm_python_lib_dir"
yes)
;;
*)
- rlm_python_lib_dir="$withval"
+ PY_LIB_DIR="$withval"
;;
esac
fi
- rlm_python_inc_dir=
+ PY_INC_DIR=
# Check whether --with-rlm-python-include-dir or --without-rlm-python-include-dir was given.
if test "${with_rlm_python_include_dir+set}" = set; then
withval="$with_rlm_python_include_dir"
yes)
;;
*)
- rlm_python_include_dir="$withval"
+ PY_INC_DIR="$withval"
;;
esac
fi
- smart_try_dir=$rlm_python_include_dir
+ PY_PREFIX=`python -c 'import sys ; print sys.prefix'`
+ PY_EXEC_PREFIX=`python -c 'import sys ; print sys.exec_prefix'`
+ PY_VERSION=`python -c 'import sys ; print sys.version[0:3]'`
+ PY_LIBS="-lpython$PY_VERSION"
+ PY_LIB_DIR="$PY_EXEC_PREFIX/lib/python$PY_VERSION/config"
+ PY_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PY_VERSION/config"
+ PY_INC_DIR="$PY_PREFIX/include/python$PY_VERSION"
+ PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION"
+ PY_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PY_VERSION/config/Makefile"
+ PY_LOCALMODLIBS=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $PY_MAKEFILE`
+ PY_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PY_MAKEFILE`
+ PY_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PY_MAKEFILE`
+ PY_EXTRA_LIBS="$PY_LOCALMODLIBS $PY_BASEMODLIBS $PY_OTHER_LIBS"
+
+ old_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $PY_CFLAGS"
+ smart_try_dir=$PY_INC_DIR
ac_safe=`echo "Python.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for Python.h""... $ac_c" 1>&6
-echo "configure:898: checking for Python.h" >&5
+echo "configure:894: checking for Python.h" >&5
smart_include=
smart_include_dir=
old_CFLAGS="$CFLAGS"
cat > conftest.$ac_ext <<EOF
-#line 905 "configure"
+#line 901 "configure"
#include "confdefs.h"
#include <Python.h>
int main() {
int a = 1;
; return 0; }
EOF
-if { (eval echo configure:912: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
smart_include=" "
else
CFLAGS="$old_CFLAGS -I$try"
cat > conftest.$ac_ext <<EOF
-#line 956 "configure"
+#line 952 "configure"
#include "confdefs.h"
#include <Python.h>
int main() {
int a = 1;
; return 0; }
EOF
-if { (eval echo configure:963: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:959: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
smart_include="-I$try"
else
echo "$ac_t""no" 1>&6
fi
+ CFLAGS=$old_CFLAGS
- smart_try_dir=$rlm_python_lib_dir
+ if test "x$ac_cv_header_Python_h" = "xyes"; then
+ python_cflags=$PY_CFLAGS
+ else
+ fail="$fail Python.h"
+ targetname=
+ fi
+
+ old_LIBS=$LIBS
+ LIBS="$LIBS $PY_LIB_LOC $PY_EXTRA_LIBS -lm"
+ smart_try_dir=$PY_LIB_DIR
-echo $ac_n "checking for Py_Initialize in -lpython$rlm_python_version""... $ac_c" 1>&6
-echo "configure:995: checking for Py_Initialize in -lpython$rlm_python_version" >&5
+echo $ac_n "checking for Py_Initialize in -lpython$PY_VERSION""... $ac_c" 1>&6
+echo "configure:1001: checking for Py_Initialize in -lpython$PY_VERSION" >&5
smart_lib=
smart_lib_dir=
-ac_safe=`echo "python$rlm_python_version" | sed 'y%./+-%__p_%'`
old_LIBS="$LIBS"
- LIBS="$LIBS -lpython$rlm_python_version"
+ LIBS="$LIBS -lpython$PY_VERSION"
cat > conftest.$ac_ext <<EOF
-#line 1004 "configure"
+#line 1009 "configure"
#include "confdefs.h"
extern char Py_Initialize();
int main() {
Py_Initialize()
; return 0; }
EOF
-if { (eval echo configure:1011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- smart_lib="-lpython$rlm_python_version"
+ smart_lib="-lpython$PY_VERSION"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
if test "x$LOCATE" != "x"; then
DIRS=
- file=libpython$rlm_python_version${libltdl_cv_shlibext}
+ file=libpython$PY_VERSION${libltdl_cv_shlibext}
for x in `${LOCATE} $file 2>/dev/null`; do
base=`echo $x | sed "s%/${file}%%"`
if test "x$LOCATE" != "x"; then
DIRS=
- file=libpython$rlm_python_version.a
+ file=libpython$PY_VERSION.a
for x in `${LOCATE} $file 2>/dev/null`; do
base=`echo $x | sed "s%/${file}%%"`
for try in $smart_try_dir $smart_lib_dir /usr/local/lib/ /opt/lib; do
- LIBS="$old_LIBS -L$try -lpython$rlm_python_version"
+ LIBS="$old_LIBS -L$try -lpython$PY_VERSION"
cat > conftest.$ac_ext <<EOF
-#line 1080 "configure"
+#line 1085 "configure"
#include "confdefs.h"
extern char Py_Initialize();
int main() {
Py_Initialize()
; return 0; }
EOF
-if { (eval echo configure:1087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- smart_lib="-L$try -lpython$rlm_python_version"
+ smart_lib="-L$try -lpython$PY_VERSION"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
if test "x$smart_lib" != "x"; then
echo "$ac_t""yes" 1>&6
- eval "ac_cv_lib_$ac_safe_Py_Initialize=yes"
+ eval "ac_cv_lib_python$PY_VERSION_Py_Initialize=yes"
LIBS="$old_LIBS $smart_lib"
SMART_LIBS="$SMART_LIBS $smart_lib"
else
echo "$ac_t""no" 1>&6
fi
+ LIBS=$old_LIBS
+
+ if test "x$ac_cv_lib_python" = "xyes"; then
+ python_ldflags="$PY_LIB_LOC $PY_EXTRA_LIBS -lm"
+ targetname=rlm_python
+ else
+ targetname=
+ fail="$fail libpython$PY_VERSION"
+ fi
- targetname=rlm_python
else
targetname=
echo \*\*\* module rlm_python is disabled.
AC_PROG_CC
AC_PROG_CPP
- dnl extra argument: --with-rlm-python-include-dir
- rlm_python_version=2.2
- AC_ARG_WITH(rlm-python-version,
- [ --with-rlm-python-version=[0-9].[0-9] Version of Python to use [2.2]],
- [ case "$withval" in
- no)
- AC_MSG_ERROR(Need rlm-python-version)
- ;;
- yes)
- ;;
- *)
- rlm_python_version="$withval"
- ;;
- esac ]
- )
-
dnl extra argument: --with-rlm-python-lib-dir
- rlm_python_lib_dir=
+ PY_LIB_DIR=
AC_ARG_WITH(rlm-python-lib-dir,
[ --with-rlm-python-lib-dir=DIR Directory for Python library files []],
[ case "$withval" in
yes)
;;
*)
- rlm_python_lib_dir="$withval"
+ PY_LIB_DIR="$withval"
;;
esac ]
)
dnl extra argument: --with-rlm-python-include-dir
- rlm_python_inc_dir=
+ PY_INC_DIR=
AC_ARG_WITH(rlm-python-include-dir,
[ --with-rlm-python-include-dir=DIR Directory for Python include files []],
[ case "$withval" in
yes)
;;
*)
- rlm_python_include_dir="$withval"
+ PY_INC_DIR="$withval"
;;
esac ]
)
- smart_try_dir=$rlm_python_include_dir
+ PY_PREFIX=`python -c 'import sys ; print sys.prefix'`
+ PY_EXEC_PREFIX=`python -c 'import sys ; print sys.exec_prefix'`
+ changequote(<<, >>)dnl
+ PY_VERSION=`python -c 'import sys ; print sys.version[0:3]'`
+ changequote([, ])dnl
+ PY_LIBS="-lpython$PY_VERSION"
+ PY_LIB_DIR="$PY_EXEC_PREFIX/lib/python$PY_VERSION/config"
+ PY_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PY_VERSION/config"
+ PY_INC_DIR="$PY_PREFIX/include/python$PY_VERSION"
+ PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION"
+ PY_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PY_VERSION/config/Makefile"
+ PY_LOCALMODLIBS=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $PY_MAKEFILE`
+ PY_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PY_MAKEFILE`
+ PY_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PY_MAKEFILE`
+ PY_EXTRA_LIBS="$PY_LOCALMODLIBS $PY_BASEMODLIBS $PY_OTHER_LIBS"
+
+ old_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $PY_CFLAGS"
+ smart_try_dir=$PY_INC_DIR
AC_SMART_CHECK_INCLUDE(Python.h)
+ CFLAGS=$old_CFLAGS
- smart_try_dir=$rlm_python_lib_dir
- AC_SMART_CHECK_LIB(python$rlm_python_version, Py_Initialize,
- [ python_ldflags="-L$smart_lib_dir -lpython$rlm_python_version $python_ldflags" ],
- [ fail=$fail" libpython$rlm_python_version" ],
- [ $python_ldflags ]
- )
+ if test "x$ac_cv_header_Python_h" = "xyes"; then
+ python_cflags=$PY_CFLAGS
+ else
+ fail="$fail Python.h"
+ targetname=
+ fi
+
+ old_LIBS=$LIBS
+ LIBS="$LIBS $PY_LIB_LOC $PY_EXTRA_LIBS -lm"
+ smart_try_dir=$PY_LIB_DIR
+ AC_SMART_CHECK_LIB(python$PY_VERSION, Py_Initialize)
+ LIBS=$old_LIBS
+
+ if test "x$ac_cv_lib_python" = "xyes"; then
+ python_ldflags="$PY_LIB_LOC $PY_EXTRA_LIBS -lm"
+ targetname=modname
+ else
+ targetname=
+ fail="$fail libpython$PY_VERSION"
+ fi
- targetname=modname
else
targetname=
echo \*\*\* module modname is disabled.