From e5ec0d0c71b94533932c4bcfa17c35340480cd7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20K=C3=B6the?= Date: Wed, 6 Dec 2000 19:18:05 +0000 Subject: [PATCH] improved configuration of shared library creation [SVN r8397] --- libs/python/README | 17 +-- libs/python/build/Makefile.in | 6 +- libs/python/build/gcc.mak | 22 ++-- libs/python/configure | 209 ++++++++++++++++++++-------------- libs/python/configure.in | 181 +++++++++++++++++++---------- libs/python/doc/building.html | 16 ++- 6 files changed, 280 insertions(+), 171 deletions(-) diff --git a/libs/python/README b/libs/python/README index c2942a77..d216b116 100644 --- a/libs/python/README +++ b/libs/python/README @@ -22,16 +22,16 @@ To build using another compiler: > > ./configure \ --with-pythoninc=/usr/local/include/python1.5 \ - --enable-shared-linker=-G \ - --enable-position-independent-code=-pic + --with-shared-cxx-linker="$CXX -G" \ + --with-position-independent-code-flag=-pic > > make install where --with-pythoninc: as above - --enable-shared-linker: flag that tells the compiler to build a - shared library (needed for Python modules) - --enable-position-independent-code: flag that tells the compiler + --with-shared-cxx-linker: command to build a shared library from C++ + object files (needed for Python modules) + --with-position-independent-code-flag: flag that tells the compiler to create position independent code (needed for shared linking) @@ -43,6 +43,9 @@ more options: of particular interest are: --libdir: the install directory for 'libboostpython.a' - --enable-shared-library-extension: the file extension for shared libraries + --with-shared-library-extension: the file extension for shared libraries -for most options, configure provides reaonable defaults, given in brackets +For most options, configure provides reasonable defaults, given in brackets. +In particular, it is able to guess the right settings for shared library +creation and linking on some common systems. Likewise, it tries to find Python +in some standard directories if you don't specify a path explicitly. diff --git a/libs/python/build/Makefile.in b/libs/python/build/Makefile.in index dee7947c..25320ced 100644 --- a/libs/python/build/Makefile.in +++ b/libs/python/build/Makefile.in @@ -1,5 +1,5 @@ CXXINCLUDES = @CXXINCLUDES@ -CXXFLAGS = @CXXFLAGS@ +SCXXFLAGS = @SCXXFLAGS@ CXX = @CXX@ CXX_SHARED_LINKER = @CXX_SHARED_LINKER@ @@ -11,11 +11,11 @@ TARGET_LIBFILENAME = lib$(TARGET_LIBNAME).a MODULE_EXTENSION = @shared_library_extension@ %.o: %.cpp - $(CXX) $(CXXFLAGS) $(CXXINCLUDES) -c $*.cpp + $(CXX) $(SCXXFLAGS) $(CXXINCLUDES) -c $*.cpp %.d: %.cpp @echo creating $@ - @set -e; $(CXX) -M $(CXXFLAGS) $(CXXINCLUDES) -c $*.cpp \ + @set -e; $(CXX) -M $(SCXXFLAGS) $(CXXINCLUDES) -c $*.cpp \ | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ [ -s $@ ] || rm -f $@ diff --git a/libs/python/build/gcc.mak b/libs/python/build/gcc.mak index d0b42548..7e844d8a 100644 --- a/libs/python/build/gcc.mak +++ b/libs/python/build/gcc.mak @@ -1,3 +1,9 @@ +BOOST_INLUDES = /local/boost/boost +PYTHON_INCLUDES = /local/python/include/python1.5 +USER_INCLUDES = /local/include +LIBDIR = ../../../lib + + LIBSRC = \ classes.cpp \ conversions.cpp \ @@ -11,26 +17,24 @@ LIBSRC = \ LIBOBJ = $(LIBSRC:.cpp=.o) OBJ = $(LIBOBJ) - ifeq "$(OS)" "Windows_NT" PYTHON_LIB=c:/tools/python/libs/python15.lib INC = -Ic:/cygnus/usr/include/g++-3 -Ic:/cygnus/usr/include -Ic:/boost -Ic:/tools/python/include MODULE_EXTENSION=dll else -INC = -I/usr/local/include/python1.5 +INC = -I$(USER_INCLUDES) -I$(BOOST_INLUDES) -I$(PYTHON_INCLUDES) MODULE_EXTENSION=so endif %.o: ../src/%.cpp g++ -fPIC -Wall -W $(INC) -o $*.o -c $< - + %.d: ../src/%.cpp @echo creating $@ @set -e; g++ -M $(INC) -c $< \ | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ [ -s $@ ] || rm -f $@ - example1: example1.o libpycpp.a g++ -shared -o ../example/hellomodule.$(MODULE_EXTENSION) $(PYHTON_LIB) example1.o -L. -lpycpp python ../example/test_example1.py @@ -38,16 +42,6 @@ example1: example1.o libpycpp.a example1.o: ../example/example1.cpp g++ -fPIC -Wall -W $(INC) -o $*.o -c $< - clean: rm -rf *.o *.$(MODULE_EXTENSION) *.a *.d *.pyc *.bak a.out -libpycpp.a: $(LIBOBJ) - rm -f libpycpp.a - ar cq libpycpp.a $(LIBOBJ) - -DEP = $(OBJ:.o=.d) - -ifneq "$(MAKECMDGOALS)" "clean" -include $(DEP) -endif diff --git a/libs/python/configure b/libs/python/configure index 5d12b7f7..dca1a775 100755 --- a/libs/python/configure +++ b/libs/python/configure @@ -15,18 +15,29 @@ ac_default_prefix=`pwd | sed 's?/libs/python$??'` ac_help="$ac_help --with-extra-includes=\"dir1 dir2 ...\" : look in these directories for include files" ac_help="$ac_help - --enable-shared-linker: which flag tells the compiler to create a shared library ? - [-shared] " + --with-shared-library-extension: file extension for shared libraries + (including the dot) [UNIX: .so | Win32: .dll] " ac_help="$ac_help - --enable-position-independent-code: which flag tells the compiler to create - position independent code ? [-fPIC] " + --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 ] " ac_help="$ac_help - --enable-shared-library-extension: file extension for shared libraries - (including the dot) [UNIX: .so | Win32: .dll] " + --with-position-independent-code-flag: flag that tells the compiler to generate + position independent code + [ gcc/g++: -fPIC + Comeau C++: --pic + Compaq C++: + SUN CC: $(CXX) -pic + IRIX CC: + HP-UX aCC: +z ] " ac_help="$ac_help --with-python=dir : Python includes (required!). - if dir=yes: python package files will be searched for in - some standard directories. + if dir=yes (default): python package files will be searched for + in some standard directories. if dir is a directory: python package files will be searched for using 'find' below dir. alternatively, you can specify:" @@ -592,7 +603,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:596: checking host system type" >&5 +echo "configure:607: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -613,7 +624,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:617: checking target system type" >&5 +echo "configure:628: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -631,7 +642,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:635: checking build system type" >&5 +echo "configure:646: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -655,12 +666,12 @@ test "$host_alias" != "$target_alias" && echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:659: checking for Cygwin environment" >&5 +echo "configure:670: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:686: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -688,19 +699,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:692: checking for mingw32 environment" >&5 +echo "configure:703: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:715: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -724,7 +735,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:728: checking for $ac_word" >&5 +echo "configure:739: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -756,7 +767,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:760: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:771: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -767,12 +778,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 771 "configure" +#line 782 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -798,12 +809,12 @@ if test $ac_cv_prog_cxx_works = no; 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 ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:802: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:813: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:807: checking whether we are using GNU C++" >&5 +echo "configure:818: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -812,7 +823,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -831,7 +842,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:835: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:846: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -863,18 +874,8 @@ else fi -######################################################### - -######################################################### - - - -######################################################### - - - ######################################################### @@ -903,60 +904,94 @@ fi done - # Check whether --enable-shared-linker or --disable-shared-linker was given. -if test "${enable_shared_linker+set}" = set; then - enableval="$enable_shared_linker" - : -else - enable_shared_linker="-shared" -fi - - echo $ac_n "checking for how to build shared libraries ""... $ac_c" 1>&6 -echo "configure:916: checking for how to build shared libraries " >&5 - if test ! "$enable_shared_linker" = "no"; then - CC_SHARED_LINKER="$(CC) $enable_shared_linker" - CXX_SHARED_LINKER="$(CXX) $enable_shared_linker" - - - echo "$ac_t""$(CC) $enable_shared_linker" 1>&6 - else - echo "$ac_t"""disabled"" 1>&6 - fi - - - # Check whether --enable-position-independent-code or --disable-position-independent-code was given. -if test "${enable_position_independent_code+set}" = set; then - enableval="$enable_position_independent_code" - : -else - enable_position_independent_code="-fPIC" -fi - - echo $ac_n "checking for how to create position independent code ""... $ac_c" 1>&6 -echo "configure:937: checking for how to create position independent code " >&5 - if test ! "$enable_position_independent_code" = "no"; then - CCFLAGS="$CCFLAGS $enable_position_independent_code" - CXXFLAGS="$CXXFLAGS $enable_position_independent_code" - echo "$ac_t""$enable_position_independent_code" 1>&6 - else - echo "$ac_t"""disabled"" 1>&6 - fi - - + + + # try to guess the right configurations if test "$CYGWIN" = yes || test "$MINGW32" = yes; then shared_library_extension=".dll" else shared_library_extension=".so" fi - # Check whether --enable-shared-library-extension or --disable-shared-library-extension was given. -if test "${enable_shared_library_extension+set}" = set; then - enableval="$enable_shared_library_extension" + + cxx_tmp="dummy $CXX dummy" + if test "$GXX" = "yes"; then # g++ + shared_cxx_linker="$(CXX) -shared" + position_independent_code_flag="-fPIC" + elif test "$cxx_tmp2" = "como"; then # Comeau C++ + shared_cxx_linker="como-dyn-link" + position_independent_code_flag="--pic" + elif test "$cxx_tmp2" = "cxx"; then # Compaq C++ + case "$target" in + *dec*) shared_cxx_linker="$(CXX) -shared -expect_unresolved '*'" + position_independent_code_flag="";; + esac + elif test "$cxx_tmp2" = "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 + + enable_shared=yes + + if test "$enable_shared" != "no" ; then + echo $ac_n "checking for shared library extension ""... $ac_c" 1>&6 +echo "configure:950: checking for shared library extension " >&5 + # Check whether --with-shared-library-extension or --without-shared-library-extension was given. +if test "${with_shared_library_extension+set}" = set; then + withval="$with_shared_library_extension" : fi + if test "${with_shared_library_extension:+X}" != ""; then + shared_library_extension=$with_shared_library_extension + fi + echo "$ac_t""$shared_library_extension" 1>&6 + + + echo $ac_n "checking for shared linker for C++ objects ""... $ac_c" 1>&6 +echo "configure:965: checking for shared linker for C++ objects " >&5 + # Check whether --with-shared-cxx-linker or --without-shared-cxx-linker was given. +if test "${with_shared_cxx_linker+set}" = set; then + withval="$with_shared_cxx_linker" + : +fi + + if test "${with_shared_cxx_linker:+X}" != ""; then + shared_cxx_linker=$with_shared_cxx_linker + fi + echo "$ac_t""$shared_cxx_linker" 1>&6 + CXX_SHARED_LINKER="$shared_cxx_linker" + + + echo $ac_n "checking for flag to create position independent code ""... $ac_c" 1>&6 +echo "configure:980: checking for flag to create position independent code " >&5 + # Check whether --with-position-independent-code-flag or --without-position-independent-code-flag was given. +if test "${with_position_independent_code_flag+set}" = set; then + withval="$with_position_independent_code_flag" + : +fi + + if test "${with_position_independent_code_flag:+X}" != ""; then + position_independent_code_flag=$with_position_independent_code_flag + fi + echo "$ac_t""$position_independent_code_flag" 1>&6 + SCCFLAGS="$CCFLAGS $position_independent_code_flag" + SCXXFLAGS="$CXXFLAGS $position_independent_code_flag" + + + fi ######################################################### @@ -964,7 +999,7 @@ fi # Extract the first word of "python", so it can be a program name with args. set dummy python; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:968: checking for $ac_word" >&5 +echo "configure:1003: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_python_prog'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -999,6 +1034,7 @@ if test "${with_python+set}" = set; then : fi + # Check whether --with-pythoninc or --without-pythoninc was given. if test "${with_pythoninc+set}" = set; then @@ -1011,13 +1047,17 @@ fi pythoninclude="not found" if test ${with_python:-""} = "" -a ${with_pythonlib:-""} = "" -a ${with_pythoninc:-""} = ""; then - with_python="no" + if test "yes" = ""; then + with_python="no" + else + with_python=yes + fi fi if test ${with_python:-""} != "no"; then if test ! "" = "" ; then # check for library echo $ac_n "checking for lib"" ""... $ac_c" 1>&6 -echo "configure:1021: checking for lib"" " >&5 +echo "configure:1061: checking for lib"" " >&5 dirs="" if test -f ${with_pythonlib:-""}/lib"".so; then dirs=${with_pythonlib:-""}/lib"".so @@ -1090,7 +1130,7 @@ echo "configure:1021: checking for lib"" " >&5 if test ! Python.h = "" ; then # check for header echo $ac_n "checking for Python.h ""... $ac_c" 1>&6 -echo "configure:1094: checking for Python.h " >&5 +echo "configure:1134: checking for Python.h " >&5 if test -f ${with_pythoninc:-""}/Python.h; then dirs=$with_pythoninc/Python.h elif test -d ${with_python:-""}; then @@ -1324,9 +1364,10 @@ s%@build_cpu@%$build_cpu%g s%@build_vendor@%$build_vendor%g s%@build_os@%$build_os%g s%@CXX@%$CXX%g -s%@CC_SHARED_LINKER@%$CC_SHARED_LINKER%g -s%@CXX_SHARED_LINKER@%$CXX_SHARED_LINKER%g s%@shared_library_extension@%$shared_library_extension%g +s%@CXX_SHARED_LINKER@%$CXX_SHARED_LINKER%g +s%@SCCFLAGS@%$SCCFLAGS%g +s%@SCXXFLAGS@%$SCXXFLAGS%g s%@python_prog@%$python_prog%g s%@CXXINCLUDES@%$CXXINCLUDES%g diff --git a/libs/python/configure.in b/libs/python/configure.in index 9fdd7778..7cfc36ff 100644 --- a/libs/python/configure.in +++ b/libs/python/configure.in @@ -10,23 +10,118 @@ AC_MINGW32 CCFLAGS=-O CXXFLAGS=-O +dnl AC_PROG_CC AC_PROG_CXX -######################################################### - -AC_DEFUN(AC_SHARED_LIBRARY_EXTENSION, +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 - AC_ARG_ENABLE(shared-library-extension, - [ --enable-shared-library-extension: file extension for shared libraries - (including the dot) [UNIX: .so | Win32: .dll] ],, ) - AC_SUBST(shared_library_extension) + + 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++: + SUN CC: $(CXX) -pic + IRIX CC: + 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 ]) ######################################################### @@ -44,44 +139,6 @@ AC_DEFUN([AC_WITH_EXTRA_INCLUDES], ######################################################### -AC_DEFUN([AC_ENABLE_SHARED_LINKER], -[ - AC_ARG_ENABLE(shared-linker, - [ --enable-shared-linker: which flag tells the compiler to create a shared library ? - [-shared] ], - , [enable_shared_linker="-shared"]) - AC_MSG_CHECKING(for how to build shared libraries ) - if test ! "$enable_shared_linker" = "no"; then - CC_SHARED_LINKER="$(CC) $enable_shared_linker" - CXX_SHARED_LINKER="$(CXX) $enable_shared_linker" - AC_SUBST(CC_SHARED_LINKER) - AC_SUBST(CXX_SHARED_LINKER) - AC_MSG_RESULT([$(CC) $enable_shared_linker]) - else - AC_MSG_RESULT("disabled") - fi -]) - -######################################################### - -AC_DEFUN([AC_ENABLE_POSITION_INDEPENDENT_CODE], -[ - AC_ARG_ENABLE(position-independent-code, - [ --enable-position-independent-code: which flag tells the compiler to create - position independent code ? [-fPIC] ], - , [enable_position_independent_code="-fPIC"]) - AC_MSG_CHECKING(for how to create position independent code ) - if test ! "$enable_position_independent_code" = "no"; then - CCFLAGS="$CCFLAGS $enable_position_independent_code" - CXXFLAGS="$CXXFLAGS $enable_position_independent_code" - AC_MSG_RESULT([$enable_position_independent_code]) - else - AC_MSG_RESULT("disabled") - fi -]) - -######################################################### - 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 @@ -101,21 +158,29 @@ AC_DEFUN(AC_EXTRACT_REGEX, ######################################################### -dnl AC_FIND_PACKAGE(packageName, packageLib, packageInc, packageComment) +dnl AC_FIND_PACKAGE(packageName, packageLib, packageInc, packageComment, default) dnl defines with_packageName=yes/no dnl packageNamelib=/not found dnl packageNameinclude=/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) +dnl AC_FIND_PACKAGE(tiff, tiff, tiff.h, support import/export of tiff images, yes) AC_DEFUN([AC_FIND_PACKAGE], [ - AC_ARG_WITH([$1], [ --with-$1=dir : $4. - if dir=yes: $1 package files will be searched for in - some standard directories. + 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:], ,) + 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], ,)]) @@ -123,7 +188,11 @@ AC_DEFUN([AC_FIND_PACKAGE], [$1]include="not found" if test ${with_[$1]:-""} = "" -a ${with_[$1]lib:-""} = "" -a ${with_[$1]inc:-""} = ""; then - with_[$1]="no" + if test "[$5]" = ""; then + with_[$1]="no" + else + with_[$1]=[$5] + fi fi if test ${with_[$1]:-""} != "no"; then @@ -203,16 +272,14 @@ AC_DEFUN([AC_FIND_PACKAGE], ######################################################### -AC_WITH_EXTRA_INCLUDES() -AC_ENABLE_SHARED_LINKER() -AC_ENABLE_POSITION_INDEPENDENT_CODE() -AC_SHARED_LIBRARY_EXTENSION() +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!)) + AC_FIND_PACKAGE(python, "", Python.h, Python includes (required!), yes) else with_python="no" fi diff --git a/libs/python/doc/building.html b/libs/python/doc/building.html index b363a50d..62d1ee08 100644 --- a/libs/python/doc/building.html +++ b/libs/python/doc/building.html @@ -45,8 +45,8 @@ where > > ./configure \ --with-pythoninc=/usr/local/include/python1.5 \ - --enable-shared-linker=-G \ - --enable-position-independent-code=-pic + --with-shared-cxx-linker="$CXX -G" \ + --with-position-independent-code-flag=-pic > > make install @@ -54,9 +54,9 @@ where where
 --with-pythoninc: as above
---enable-shared-linker: flag that tells the compiler to build a
-        shared library (needed for Python modules)
---enable-position-independent-code: flag that tells the compiler 
+--with-shared-cxx-linker: command to build a shared library from C++
+        object files (needed for Python modules)
+--with-position-independent-code-flag: flag that tells the compiler 
         to create position independent code (needed for shared linking)
 
@@ -68,7 +68,6 @@ after invoking > ./configure --help - Reasonable defaults for each option are givem in brackets. Of particular interest are the following options:
@@ -76,6 +75,11 @@ after invoking
 --enable-shared-library-extension: the file extension for shared libraries  
 
+ For most options, configure provides reasonable defaults, given in + brackets. In particular, it is able to guess the right settings for + shared library creation and linking on some common systems. Likewise, + it tries to find Python in some standard directories if you don't + specify a path explicitly.

If this build process doesn't work for you, you must compile the source files manually. The BPL source files are: