2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 17:52:17 +00:00
Files
python/libs/python/configure.in
2000-12-06 19:18:05 +00:00

298 lines
11 KiB
Plaintext

AC_INIT(src/extension_class.cpp)
AC_PREFIX_DEFAULT([`pwd | sed 's?/libs/python$??'`])
AC_CONFIG_AUX_DIR(build)
AC_CANONICAL_SYSTEM
AC_CYGWIN
AC_MINGW32
CCFLAGS=-O
CXXFLAGS=-O
dnl AC_PROG_CC
AC_PROG_CXX
AC_DEFUN(AC_SHARED_LINKING,
[
dnl AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PROG_CXX])
AC_REQUIRE([AC_CYGWIN])
AC_REQUIRE([AC_MINGW32])
# try to guess the right configurations
if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
shared_library_extension=".dll"
else
shared_library_extension=".so"
fi
cxx_tmp="dummy $CXX dummy"
if test "$GXX" = "yes"; then # g++
shared_cxx_linker="$(CXX) -shared"
position_independent_code_flag="-fPIC"
elif test "$cxx_tmp[2]" = "como"; then # Comeau C++
shared_cxx_linker="como-dyn-link"
position_independent_code_flag="--pic"
elif test "$cxx_tmp[2]" = "cxx"; then # Compaq C++
case "$target" in
*dec*) shared_cxx_linker="$(CXX) -shared -expect_unresolved '*'"
position_independent_code_flag="";;
esac
elif test "$cxx_tmp[2]" = "CC"; then # native compilers
case "$target" in
*solaris*) shared_cxx_linker="$(CXX) -G"
position_independent_code_flag="-pic";;
*irix*) shared_cxx_linker="$(CXX) -shared"
position_independent_code_flag="";;
*hpux*) shared_cxx_linker="ld -b"
position_independent_code_flag="+z";;
esac
else
shared_c_linker=""
shared_cxx_linker=""
position_independent_code_flag=""
fi
ifelse( $1, "", [
AC_ARG_ENABLE(shared,
[ --enable-shared: build shared libraries. This activates default settings for
shared linking and position independent code generation (see below).],
, )], [enable_shared=$1])
if test "$enable_shared" != "no" ; then
AC_MSG_CHECKING(for shared library extension )
AC_ARG_WITH(shared-library-extension,
[ --with-shared-library-extension: file extension for shared libraries
(including the dot) [UNIX: .so | Win32: .dll] ],, )
if test "${with_shared_library_extension:+X}" != ""; then
shared_library_extension=$with_shared_library_extension
fi
AC_MSG_RESULT([$shared_library_extension])
AC_SUBST(shared_library_extension)
dnl AC_MSG_CHECKING(for shared linker for C objects )
dnl AC_ARG_WITH(shared-c-linker,
dnl [ --with-shared-c-linker: command for creating a shared library from C objects.
dnl [ gcc: $(CC) -shared
dnl SUN cc: $(CC) -G
dnl IRIX cc: $(CC) -shared ] ],
dnl , )
dnl if test "${with_shared_c_linker:+X}" != ""; then
dnl shared_c_linker=$with_shared_c_linker
dnl fi
dnl AC_MSG_RESULT([$shared_c_linker])
dnl CC_SHARED_LINKER="$shared_c_linker"
dnl AC_SUBST(CC_SHARED_LINKER)
AC_MSG_CHECKING(for shared linker for C++ objects )
AC_ARG_WITH(shared-cxx-linker,
[ --with-shared-cxx-linker: command for creating a shared library from C++ objects.
[ g++: $(CXX) -shared
Comeau C++: como-dyn-link
Compaq C++: $(CXX) -shared -expect_unresolved '*'
SUN CC: $(CXX) -G
IRIX CC: $(CXX) -shared
HP-UX aCC: ld -b ] ],
, )
if test "${with_shared_cxx_linker:+X}" != ""; then
shared_cxx_linker=$with_shared_cxx_linker
fi
AC_MSG_RESULT([$shared_cxx_linker])
CXX_SHARED_LINKER="$shared_cxx_linker"
AC_SUBST(CXX_SHARED_LINKER)
AC_MSG_CHECKING(for flag to create position independent code )
AC_ARG_WITH(position-independent-code-flag,
[ --with-position-independent-code-flag: flag that tells the compiler to generate
position independent code
[ gcc/g++: -fPIC
Comeau C++: --pic
Compaq C++: <empty>
SUN CC: $(CXX) -pic
IRIX CC: <empty>
HP-UX aCC: +z ] ],
, )
if test "${with_position_independent_code_flag:+X}" != ""; then
position_independent_code_flag=$with_position_independent_code_flag
fi
AC_MSG_RESULT([$position_independent_code_flag])
SCCFLAGS="$CCFLAGS $position_independent_code_flag"
SCXXFLAGS="$CXXFLAGS $position_independent_code_flag"
AC_SUBST(SCCFLAGS)
AC_SUBST(SCXXFLAGS)
fi
])
#########################################################
AC_DEFUN([AC_WITH_EXTRA_INCLUDES],
[
AC_ARG_WITH(extra-includes,
[ --with-extra-includes=\"dir1 dir2 ...\" : look in these directories for include files],,)
for i in $with_extra_includes; do
CINCLUDES="$CINCLUDES -I"$i
CXXINCLUDES="$CXXINCLUDES -I"$i
done
])
#########################################################
dnl AC_EXTRACT_REGEX(list, regEx)
dnl variable $regExResult returns the first entry in 'list' that matches the
dnl regular expression 'regEx', using the 'expr' utility
dnl $regExResult = "" if nothing is found
AC_DEFUN(AC_EXTRACT_REGEX,
[
regExResult=""
if test "$1" != ""; then
for i in $1; do
regExResult=`expr "$i" : "$2"`
if test "$regExResult" != ""; then
break
fi
done
fi
])
#########################################################
dnl AC_FIND_PACKAGE(packageName, packageLib, packageInc, packageComment, default)
dnl defines with_packageName=yes/no
dnl packageNamelib=<path>/not found
dnl packageNameinclude=<path>/not found
dnl and adds the paths to $LIBS, $CINCLUDES, and $CXXINCLUDES
dnl example:
dnl AC_FIND_PACKAGE(tiff, tiff, tiff.h, support import/export of tiff images, yes)
AC_DEFUN([AC_FIND_PACKAGE],
[
ifelse($5, "yes",
[AC_ARG_WITH([$1], [ --with-$1=dir : $4.
if dir=yes: $1 package files will be searched for
in some standard directories.
if dir is a directory: $1 package files will be searched for
using 'find' below dir.
alternatively, you can specify:], ,)],
[AC_ARG_WITH([$1], [ --with-$1=dir : $4.
if dir=yes (default): $1 package files will be searched for
in some standard directories.
if dir is a directory: $1 package files will be searched for
using 'find' below dir.
alternatively, you can specify:], ,)])
ifelse($2, "", ,[AC_ARG_WITH([$1lib], [ --with-$1lib=dir : the $1 package's lib directory], ,)])
ifelse($3, "", ,[AC_ARG_WITH([$1inc], [ --with-$1inc=dir : the $1 package's include directory], ,)])
[$1]lib="not found"
[$1]include="not found"
if test ${with_[$1]:-""} = "" -a ${with_[$1]lib:-""} = "" -a ${with_[$1]inc:-""} = ""; then
if test "[$5]" = ""; then
with_[$1]="no"
else
with_[$1]=[$5]
fi
fi
if test ${with_[$1]:-""} != "no"; then
if test ! [$2] = "" ; then # check for library
AC_MSG_CHECKING([for lib$2 ])
dirs=""
if test -f ${with_[$1]lib:-""}/lib[$2].so; then
dirs=${with_[$1]lib:-""}/lib[$2].so
elif test -f ${with_[$1]lib:-""}/lib[$2].a; then
dirs=${with_[$1]lib:-""}/lib[$2].a
elif test -d ${with_[$1]:-""}; then
dirs=`find $with_[$1] -name "lib[$2].so" -print; find $with_[$1] -name "lib[$2].a" -print`
elif test ${with_[$1]:-""} = "yes"; then
for i in /usr/local/lib /usr/local/gnu/lib /usr/local/[$1] /opt/lib /opt/gnu/lib /opt/[$1]; do
if test -d $i; then
dirs="$dirs "`find $i -name "lib[$2].so" -print; find $i -name "lib[$2].a" -print`
fi
done
fi
AC_EXTRACT_REGEX($dirs, \(.*lib\)/lib$2\.so)
if test "$regExResult" = ""; then
AC_EXTRACT_REGEX($dirs, \(.*lib\)/lib$2\.a)
fi
if test "$regExResult" = ""; then
AC_EXTRACT_REGEX($dirs, \(.*\)/lib$2\.so)
fi
if test "$regExResult" = ""; then
AC_EXTRACT_REGEX($dirs, \(.*\)/lib$2\.a)
fi
[$1]lib=${regExResult:-"not found"}
AC_MSG_RESULT($[$1]lib)
else
[$1]lib=""
fi
if test ! [$3] = "" ; then # check for header
AC_MSG_CHECKING([for $3 ])
if test -f ${with_[$1]inc:-""}/[$3]; then
dirs=$with_[$1]inc/[$3]
elif test -d ${with_[$1]:-""}; then
dirs=`find $with_[$1] -name patsubst([$3], .*/, ) -print`
elif test ${with_[$1]:-""} = "yes"; then
for i in /usr/local/include /usr/local/gnu/include /usr/local/[$1] \
/opt/include /opt/gnu/include /opt/[$1]; do
if test -d $i; then
dirs="$dirs "`find $i -name patsubst([$3], .*/, ) -print`
fi
done
fi
AC_EXTRACT_REGEX($dirs, \(.*include\)/patsubst([$3], \., \\.))
if test "$regExResult" = ""; then
AC_EXTRACT_REGEX($dirs, \(.*\)/patsubst([$3], \., \\.))
fi
[$1]include=${regExResult:-"not found"}
AC_MSG_RESULT($[$1]include)
else
[$1]include=""
fi
if test "$[$1]lib" = "not found" -o "$[$1]include" = "not found"; then
with_[$1]="no"
AC_MSG_WARN( Configuring without [$1] support)
else
with_[$1]="yes"
if test ! [$2] = "" ; then
LIBS="$LIBS -L$[$1]lib -l[$2]"
fi
if test ! [$3] = "" ; then
CINCLUDES="$CINCLUDES -I$[$1]include"
CXXINCLUDES="$CXXINCLUDES -I$[$1]include"
AC_SUBST(CXXINCLUDES)
fi
fi
fi
])
#########################################################
AC_WITH_EXTRA_INCLUDES
AC_SHARED_LINKING(yes)
#########################################################
AC_CHECK_PROG(python_prog, python, [yes], [not found])
if test "$python_prog" = "yes"; then
AC_FIND_PACKAGE(python, "", Python.h, Python includes (required!), yes)
else
with_python="no"
fi
if test "$with_python" = "no"; then
AC_MSG_ERROR(Python support required to install BPL)
fi
#########################################################
boost_includes=[-I`pwd | sed 's?/libs/python$??'`]
CXXINCLUDES="$CXXINCLUDES $boost_includes"
#########################################################
AC_OUTPUT(build/Makefile)