comparison src/configure.in @ 4841:81dedcd64821 v7.3.1167

updated for version 7.3.1167 Problem: Python configure check doesn't reject Python 2 when requesting Python 3. Some systems need -pthreads instead of -pthread. Solution: Adjust configure accordingly. (Andrei Olsen)
author Bram Moolenaar <bram@vim.org>
date Tue, 11 Jun 2013 19:53:45 +0200
parents 70b1178dec79
children ed47632fd149
comparison
equal deleted inserted replaced
4840:1a93b399dd6f 4841:81dedcd64821
984 test "$GCC" = yes && threadsafe_flag="-pthread" 984 test "$GCC" = yes && threadsafe_flag="-pthread"
985 if test "`(uname) 2>/dev/null`" = FreeBSD; then 985 if test "`(uname) 2>/dev/null`" = FreeBSD; then
986 threadsafe_flag="-D_THREAD_SAFE" 986 threadsafe_flag="-D_THREAD_SAFE"
987 thread_lib="-pthread" 987 thread_lib="-pthread"
988 fi 988 fi
989 if test "`(uname) 2>/dev/null`" = SunOS; then
990 threadsafe_flag="-pthreads"
991 fi
989 fi 992 fi
990 libs_save_old=$LIBS 993 libs_save_old=$LIBS
991 if test -n "$threadsafe_flag"; then 994 if test -n "$threadsafe_flag"; then
992 cflags_save=$CFLAGS 995 cflags_save=$CFLAGS
993 CFLAGS="$CFLAGS $threadsafe_flag" 996 CFLAGS="$CFLAGS $threadsafe_flag"
1020 PYTHON_SRC= 1023 PYTHON_SRC=
1021 PYTHON_OBJ= 1024 PYTHON_OBJ=
1022 PYTHON_LIBS= 1025 PYTHON_LIBS=
1023 PYTHON_CFLAGS= 1026 PYTHON_CFLAGS=
1024 fi 1027 fi
1025
1026 fi 1028 fi
1027 else 1029 else
1028 AC_MSG_RESULT(too old) 1030 AC_MSG_RESULT(too old)
1029 fi 1031 fi
1030 fi 1032 fi
1056 AC_CACHE_CHECK(Python version,vi_cv_var_python3_version, 1058 AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
1057 [[vi_cv_var_python3_version=` 1059 [[vi_cv_var_python3_version=`
1058 ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'` 1060 ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
1059 ]]) 1061 ]])
1060 1062
1061 dnl -- get abiflags for python 3.2 or higher (PEP 3149) 1063 dnl -- it must be at least version 3
1062 AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags, 1064 AC_MSG_CHECKING(Python is 3.0 or better)
1063 [ 1065 if ${vi_cv_path_python3} -c \
1064 vi_cv_var_python3_abiflags= 1066 "import sys; sys.exit(${vi_cv_var_python3_version} < 3.0)"
1065 if ${vi_cv_path_python3} -c \ 1067 then
1066 "import sys; sys.exit(${vi_cv_var_python3_version} < 3.2)" 1068 AC_MSG_RESULT(yep)
1067 then 1069
1068 vi_cv_var_python3_abiflags=`${vi_cv_path_python3} -c \ 1070 dnl -- get abiflags for python 3.2 or higher (PEP 3149)
1069 "import sys; print(sys.abiflags)"` 1071 AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags,
1070 fi ])
1071
1072 dnl -- find where python3 thinks it was installed
1073 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
1074 [ vi_cv_path_python3_pfx=`
1075 ${vi_cv_path_python3} -c \
1076 "import sys; print(sys.prefix)"` ])
1077
1078 dnl -- and where it thinks it runs
1079 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
1080 [ vi_cv_path_python3_epfx=`
1081 ${vi_cv_path_python3} -c \
1082 "import sys; print(sys.exec_prefix)"` ])
1083
1084 dnl -- python3's internal library path
1085
1086 AC_CACHE_VAL(vi_cv_path_python3path,
1087 [ vi_cv_path_python3path=`
1088 unset PYTHONPATH;
1089 ${vi_cv_path_python3} -c \
1090 "import sys, string; print(':'.join(sys.path))"` ])
1091
1092 dnl -- where the Python implementation library archives are
1093
1094 AC_ARG_WITH(python3-config-dir,
1095 [ --with-python3-config-dir=PATH Python's config directory],
1096 [ vi_cv_path_python3_conf="${withval}" ] )
1097
1098 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
1099 [
1100 vi_cv_path_python3_conf=
1101 config_dir="config"
1102 if test "${vi_cv_var_python3_abiflags}" != ""; then
1103 config_dir="${config_dir}-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
1104 fi
1105 d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"`
1106 if test -d "$d" && test -f "$d/config.c"; then
1107 vi_cv_path_python3_conf="$d"
1108 else
1109 for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
1110 for subdir in lib64 lib share; do
1111 d="${path}/${subdir}/python${vi_cv_var_python3_version}/${config_dir}"
1112 if test -d "$d" && test -f "$d/config.c"; then
1113 vi_cv_path_python3_conf="$d"
1114 fi
1115 done
1116 done
1117 fi
1118 ])
1119
1120 PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
1121
1122 if test "X$PYTHON3_CONFDIR" = "X"; then
1123 AC_MSG_RESULT([can't find it!])
1124 else
1125
1126 dnl -- we need to examine Python's config/Makefile too
1127 dnl see what the interpreter is built from
1128 AC_CACHE_VAL(vi_cv_path_python3_plibs,
1129 [ 1072 [
1130 pwd=`pwd` 1073 vi_cv_var_python3_abiflags=
1131 tmp_mkf="$pwd/config-PyMake$$" 1074 if ${vi_cv_path_python3} -c \
1132 cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}" 1075 "import sys; sys.exit(${vi_cv_var_python3_version} < 3.2)"
1076 then
1077 vi_cv_var_python3_abiflags=`${vi_cv_path_python3} -c \
1078 "import sys; print(sys.abiflags)"`
1079 fi ])
1080
1081 dnl -- find where python3 thinks it was installed
1082 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
1083 [ vi_cv_path_python3_pfx=`
1084 ${vi_cv_path_python3} -c \
1085 "import sys; print(sys.prefix)"` ])
1086
1087 dnl -- and where it thinks it runs
1088 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
1089 [ vi_cv_path_python3_epfx=`
1090 ${vi_cv_path_python3} -c \
1091 "import sys; print(sys.exec_prefix)"` ])
1092
1093 dnl -- python3's internal library path
1094
1095 AC_CACHE_VAL(vi_cv_path_python3path,
1096 [ vi_cv_path_python3path=`
1097 unset PYTHONPATH;
1098 ${vi_cv_path_python3} -c \
1099 "import sys, string; print(':'.join(sys.path))"` ])
1100
1101 dnl -- where the Python implementation library archives are
1102
1103 AC_ARG_WITH(python3-config-dir,
1104 [ --with-python3-config-dir=PATH Python's config directory],
1105 [ vi_cv_path_python3_conf="${withval}" ] )
1106
1107 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
1108 [
1109 vi_cv_path_python3_conf=
1110 config_dir="config"
1111 if test "${vi_cv_var_python3_abiflags}" != ""; then
1112 config_dir="${config_dir}-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
1113 fi
1114 d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"`
1115 if test -d "$d" && test -f "$d/config.c"; then
1116 vi_cv_path_python3_conf="$d"
1117 else
1118 for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
1119 for subdir in lib64 lib share; do
1120 d="${path}/${subdir}/python${vi_cv_var_python3_version}/${config_dir}"
1121 if test -d "$d" && test -f "$d/config.c"; then
1122 vi_cv_path_python3_conf="$d"
1123 fi
1124 done
1125 done
1126 fi
1127 ])
1128
1129 PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
1130
1131 if test "X$PYTHON3_CONFDIR" = "X"; then
1132 AC_MSG_RESULT([can't find it!])
1133 else
1134
1135 dnl -- we need to examine Python's config/Makefile too
1136 dnl see what the interpreter is built from
1137 AC_CACHE_VAL(vi_cv_path_python3_plibs,
1138 [
1139 pwd=`pwd`
1140 tmp_mkf="$pwd/config-PyMake$$"
1141 cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
1133 __: 1142 __:
1134 @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'" 1143 @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'"
1135 @echo "python3_LIBS='$(LIBS)'" 1144 @echo "python3_LIBS='$(LIBS)'"
1136 @echo "python3_SYSLIBS='$(SYSLIBS)'" 1145 @echo "python3_SYSLIBS='$(SYSLIBS)'"
1137 @echo "python3_DLLLIBRARY='$(DLLLIBRARY)'" 1146 @echo "python3_DLLLIBRARY='$(DLLLIBRARY)'"
1138 @echo "python3_INSTSONAME='$(INSTSONAME)'" 1147 @echo "python3_INSTSONAME='$(INSTSONAME)'"
1139 eof 1148 eof
1140 dnl -- delete the lines from make about Entering/Leaving directory 1149 dnl -- delete the lines from make about Entering/Leaving directory
1141 eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`" 1150 eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1142 rm -f -- "${tmp_mkf}" 1151 rm -f -- "${tmp_mkf}"
1143 vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}" 1152 vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
1144 vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS}" 1153 vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS}"
1145 dnl remove -ltermcap, it can conflict with an earlier -lncurses 1154 dnl remove -ltermcap, it can conflict with an earlier -lncurses
1146 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//` 1155 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//`
1147 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//` 1156 vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//`
1148 ]) 1157 ])
1149 1158
1150 if test "X$python3_DLLLIBRARY" != "X"; then 1159 if test "X$python3_DLLLIBRARY" != "X"; then
1151 python3_INSTSONAME="$python3_DLLLIBRARY" 1160 python3_INSTSONAME="$python3_DLLLIBRARY"
1152 fi 1161 fi
1153 PYTHON3_LIBS="${vi_cv_path_python3_plibs}" 1162 PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
1154 if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then 1163 if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
1155 PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\"" 1164 PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
1156 else 1165 else
1157 PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\"" 1166 PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\""
1158 fi 1167 fi
1159 PYTHON3_SRC="if_python3.c" 1168 PYTHON3_SRC="if_python3.c"
1160 PYTHON3_OBJ="objects/if_python3.o" 1169 PYTHON3_OBJ="objects/if_python3.o"
1161 1170
1162 dnl On FreeBSD linking with "-pthread" is required to use threads. 1171 dnl On FreeBSD linking with "-pthread" is required to use threads.
1163 dnl _THREAD_SAFE must be used for compiling then. 1172 dnl _THREAD_SAFE must be used for compiling then.
1164 dnl The "-pthread" is added to $LIBS, so that the following check for 1173 dnl The "-pthread" is added to $LIBS, so that the following check for
1165 dnl sigaltstack() will look in libc_r (it's there in libc!). 1174 dnl sigaltstack() will look in libc_r (it's there in libc!).
1166 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC 1175 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
1167 dnl will then define target-specific defines, e.g., -D_REENTRANT. 1176 dnl will then define target-specific defines, e.g., -D_REENTRANT.
1168 dnl Don't do this for Mac OSX, -pthread will generate a warning. 1177 dnl Don't do this for Mac OSX, -pthread will generate a warning.
1169 AC_MSG_CHECKING([if -pthread should be used]) 1178 AC_MSG_CHECKING([if -pthread should be used])
1170 threadsafe_flag= 1179 threadsafe_flag=
1171 thread_lib= 1180 thread_lib=
1172 dnl if test "x$MACOSX" != "xyes"; then 1181 dnl if test "x$MACOSX" != "xyes"; then
1173 if test "`(uname) 2>/dev/null`" != Darwin; then 1182 if test "`(uname) 2>/dev/null`" != Darwin; then
1174 test "$GCC" = yes && threadsafe_flag="-pthread" 1183 test "$GCC" = yes && threadsafe_flag="-pthread"
1175 if test "`(uname) 2>/dev/null`" = FreeBSD; then 1184 if test "`(uname) 2>/dev/null`" = FreeBSD; then
1176 threadsafe_flag="-D_THREAD_SAFE" 1185 threadsafe_flag="-D_THREAD_SAFE"
1177 thread_lib="-pthread" 1186 thread_lib="-pthread"
1187 fi
1188 if test "`(uname) 2>/dev/null`" = SunOS; then
1189 threadsafe_flag="-pthreads"
1190 fi
1191 fi
1192 libs_save_old=$LIBS
1193 if test -n "$threadsafe_flag"; then
1194 cflags_save=$CFLAGS
1195 CFLAGS="$CFLAGS $threadsafe_flag"
1196 LIBS="$LIBS $thread_lib"
1197 AC_TRY_LINK(,[ ],
1198 AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
1199 AC_MSG_RESULT(no); LIBS=$libs_save_old
1200 )
1201 CFLAGS=$cflags_save
1202 else
1203 AC_MSG_RESULT(no)
1204 fi
1205
1206 dnl check that compiling a simple program still works with the flags
1207 dnl added for Python.
1208 AC_MSG_CHECKING([if compile and link flags for Python 3 are sane])
1209 cflags_save=$CFLAGS
1210 libs_save=$LIBS
1211 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1212 LIBS="$LIBS $PYTHON3_LIBS"
1213 AC_TRY_LINK(,[ ],
1214 AC_MSG_RESULT(yes); python3_ok=yes,
1215 AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
1216 CFLAGS=$cflags_save
1217 LIBS=$libs_save
1218 if test "$python3_ok" = yes; then
1219 AC_DEFINE(FEAT_PYTHON3)
1220 else
1221 LIBS=$libs_save_old
1222 PYTHON3_SRC=
1223 PYTHON3_OBJ=
1224 PYTHON3_LIBS=
1225 PYTHON3_CFLAGS=
1178 fi 1226 fi
1179 fi 1227 fi
1180 libs_save_old=$LIBS 1228 else
1181 if test -n "$threadsafe_flag"; then 1229 AC_MSG_RESULT(too old)
1182 cflags_save=$CFLAGS
1183 CFLAGS="$CFLAGS $threadsafe_flag"
1184 LIBS="$LIBS $thread_lib"
1185 AC_TRY_LINK(,[ ],
1186 AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
1187 AC_MSG_RESULT(no); LIBS=$libs_save_old
1188 )
1189 CFLAGS=$cflags_save
1190 else
1191 AC_MSG_RESULT(no)
1192 fi
1193
1194 dnl check that compiling a simple program still works with the flags
1195 dnl added for Python.
1196 AC_MSG_CHECKING([if compile and link flags for Python 3 are sane])
1197 cflags_save=$CFLAGS
1198 libs_save=$LIBS
1199 CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1200 LIBS="$LIBS $PYTHON3_LIBS"
1201 AC_TRY_LINK(,[ ],
1202 AC_MSG_RESULT(yes); python3_ok=yes,
1203 AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
1204 CFLAGS=$cflags_save
1205 LIBS=$libs_save
1206 if test "$python3_ok" = yes; then
1207 AC_DEFINE(FEAT_PYTHON3)
1208 else
1209 LIBS=$libs_save_old
1210 PYTHON3_SRC=
1211 PYTHON3_OBJ=
1212 PYTHON3_LIBS=
1213 PYTHON3_CFLAGS=
1214 fi
1215 fi 1230 fi
1216 fi 1231 fi
1217 fi 1232 fi
1218 1233
1219 AC_SUBST(PYTHON3_CONFDIR) 1234 AC_SUBST(PYTHON3_CONFDIR)
2440 CPPFLAGS="$CPPFLAGS $X_CFLAGS" 2455 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2441 if test "$zOSUnix" = "yes"; then 2456 if test "$zOSUnix" = "yes"; then
2442 xmheader="Xm/Xm.h" 2457 xmheader="Xm/Xm.h"
2443 else 2458 else
2444 xmheader="Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h 2459 xmheader="Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h
2445 Xm/UnhighlightT.h Xm/Notebook.h" 2460 Xm/UnhighlightT.h Xm/Notebook.h"
2446 fi 2461 fi
2447 AC_CHECK_HEADERS($xmheader) 2462 AC_CHECK_HEADERS($xmheader)
2448 2463
2449 if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then 2464 if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then
2450 dnl Solaris uses XpmAttributes_21, very annoying. 2465 dnl Solaris uses XpmAttributes_21, very annoying.
3354 AC_MSG_CHECKING(for sysinfo.mem_unit) 3369 AC_MSG_CHECKING(for sysinfo.mem_unit)
3355 AC_TRY_COMPILE( 3370 AC_TRY_COMPILE(
3356 [#include <sys/types.h> 3371 [#include <sys/types.h>
3357 #include <sys/sysinfo.h>], 3372 #include <sys/sysinfo.h>],
3358 [ struct sysinfo sinfo; 3373 [ struct sysinfo sinfo;
3359 sinfo.mem_unit = 1; 3374 sinfo.mem_unit = 1;
3360 ], 3375 ],
3361 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT), 3376 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
3362 AC_MSG_RESULT(no)) 3377 AC_MSG_RESULT(no))
3363 3378
3364 dnl sysconf() may exist but not support what we want to use 3379 dnl sysconf() may exist but not support what we want to use