diff options
author | das <das> | 2005-05-24 04:21:31 (GMT) |
---|---|---|
committer | das <das> | 2005-05-24 04:21:31 (GMT) |
commit | b0fdc226a3f785fcf390544a5546be0cfd1e7458 (patch) | |
tree | ba20400bcdbf394be0258f6dc603b703b1a34d56 /unix/configure.in | |
parent | 5be843b40e45bf4ee2b4cb252a4d877ed85b8563 (diff) | |
download | tk-b0fdc226a3f785fcf390544a5546be0cfd1e7458.zip tk-b0fdc226a3f785fcf390544a5546be0cfd1e7458.tar.gz tk-b0fdc226a3f785fcf390544a5546be0cfd1e7458.tar.bz2 |
* macosx/Makefile:
* macosx/README:
* macosx/Tk-Info.plist.in (new file):
* macosx/Wish-Info.plist.in (new file):
* unix/Makefile.in:
* unix/configure.in:
* unix/tcl.m4:
* unix/tkUnixInit.c: moved all Darwin framework and TkAqua build
support from macosx/Wish.pbproj and macosx/Makefile into the standard
unix configure/make buildsystem, the project and macosx/Makefile are
no longer required to build Tk.framework and/or TkAqua. TkAqua is now
enabled by the --enable-aqua configure option, and static and
non-framework builds of TkAqua are now available via the standard
configure switches. Tk/X11 can also be built as a framework. The
macosx/Makefile now wraps the unix buildsystem and no longer uses the
projects, embedded builds are still only available via this Makefile,
but for other builds it is not longer required (but its current
functionality is still available for backwards compatibility). The
projects currently do not call through to the Makefile to build
(unlike Tcl.pbproj) so project builds may differ from makefile builds.
Due to issues with spaces in pathnames, 'Wish Shell.app' has been
renamed to 'Wish.app', the macosx/Makefile installs backwards
compatibility symlinks for the old name.
* macosx/tkMacOSXInit.c (TkpInit): added support for Tk resource file
in non-framework and static builds: the resource file is copied into a
__tk_rsrc MachO segment of the library or executable at link time and
extracted into a temporary location at initialization.
* unix/configure: autoconf-2.13
Diffstat (limited to 'unix/configure.in')
-rw-r--r-- | unix/configure.in | 258 |
1 files changed, 195 insertions, 63 deletions
diff --git a/unix/configure.in b/unix/configure.in index 841f948..94a4ee1 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.83.2.14 2005/05/07 00:03:05 hobbs Exp $ +# RCS: @(#) $Id: configure.in,v 1.83.2.15 2005/05/24 04:21:34 das Exp $ AC_INIT(../generic/tk.h) AC_PREREQ(2.13) @@ -38,8 +38,6 @@ fi if test "${exec_prefix}" = "NONE"; then exec_prefix=$prefix fi -# libdir must be a fully qualified path and (not ${exec_prefix}/lib) -eval libdir="$libdir" # Make sure srcdir is fully qualified! srcdir=`cd $srcdir ; pwd` TK_SRC_DIR=`cd $srcdir/..; pwd` @@ -63,10 +61,10 @@ AC_PROG_CC AC_HAVE_HEADERS([unistd.h limits.h]) -#------------------------------------------------------------------------------ +#------------------------------------------------------------------------ # If we're using GCC, see if the compiler understands -pipe. If so, use it. # It makes compiling go faster. (This is only a performance feature.) -#------------------------------------------------------------------------------ +#------------------------------------------------------------------------ if test -z "$no_pipe"; then if test -n "$GCC"; then @@ -89,12 +87,14 @@ SC_ENABLE_THREADS # Add the threads support libraries LIBS="$LIBS$THREADS_LIBS" +SC_ENABLE_SHARED + #-------------------------------------------------------------------- -# Recompute the necessary flags to run the compiler +# The statements below define a collection of compile flags. This +# macro depends on the value of SHARED_BUILD, and should be called +# after SC_ENABLE_SHARED checks the configure switches. #-------------------------------------------------------------------- -SC_ENABLE_SHARED - SC_CONFIG_CFLAGS SC_ENABLE_SYMBOLS @@ -226,15 +226,44 @@ if test $tk_ok = yes; then fi #-------------------------------------------------------------------- -# Locate the X11 header files and the X11 library archive. Try -# the ac_path_x macro first, but if it doesn't find the X stuff -# (e.g. because there's no xmkmf program) then check through -# a list of possible directories. Under some conditions the -# autoconf macro will return an include directory that contains -# no include files, so double-check its result just to be safe. +# On Mac OS X, we can build either with X11 or with Aqua #-------------------------------------------------------------------- -SC_PATH_X +if test "`uname -s`" = "Darwin" ; then + AC_ARG_ENABLE(aqua, [ --enable-aqua enable Aqua windowingsystem on Mac OS X [--disable-aqua]], + [tk_aqua=$enableval], [tk_aqua=no]) + if test $tk_aqua = yes; then + if test $tcl_corefoundation = no; then + AC_MSG_WARN("Aqua can only be used when CoreFoundation is available") + tk_aqua=no + elif test ! -d /System/Library/Frameworks/Carbon.framework; then + AC_MSG_WARN("Aqua can only be used when Carbon is available") + tk_aqua=no + fi + fi +else + tk_aqua=no +fi + +if test $tk_aqua = yes; then + AC_DEFINE(MAC_OSX_TK) + LIBS="$LIBS -framework Carbon" + CFLAGS="$CFLAGS -fpascal-strings" + AC_CHECK_FUNCS(_dyld_get_image_header_containing_address) + TK_WINDOWINGSYSTEM=AQUA +else + #-------------------------------------------------------------------- + # Locate the X11 header files and the X11 library archive. Try + # the ac_path_x macro first, but if it doesn't find the X stuff + # (e.g. because there's no xmkmf program) then check through + # a list of possible directories. Under some conditions the + # autoconf macro will return an include directory that contains + # no include files, so double-check its result just to be safe. + #-------------------------------------------------------------------- + + SC_PATH_X + TK_WINDOWINGSYSTEM=X11 +fi #-------------------------------------------------------------------- # Various manipulations on the search path used at runtime to @@ -347,58 +376,138 @@ SC_BUGGY_STRTOD # building libtk as a shared library instead of a static library. #-------------------------------------------------------------------- -eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}" eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}" +eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}" +eval "TK_LIB_FILE=libtk${LIB_SUFFIX}" + +# tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed +# so that the backslashes quoting the DBX braces are dropped. + +# Trick to replace DBGX with TK_DBGX +DBGX='${TK_DBGX}' +eval "TK_LIB_FILE=${TK_LIB_FILE}" if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \${TCL_STUB_LIB_SPEC}" TCL_STUB_FLAGS="-DUSE_TCL_STUBS" -else - TCL_STUB_FLAGS="" fi -TK_LIB_FILE=libtk${LIB_SUFFIX} -eval "TK_LIB_FILE=${TK_LIB_FILE}" + +TK_LIBRARY='$(prefix)/lib/tk$(VERSION)' +PRIVATE_INCLUDE_DIR='$(includedir)' +HTML_DIR='$(DISTDIR)/html' +TK_PKG_DIR='tk$(VERSION)$(TK_DBGX)' +TK_RSRC_FILE='tk$(VERSION).rsrc' +WISH_RSRC_FILE='wish$(VERSION).rsrc' # Note: in the following variable, it's important to use the absolute # path name of the Tcl directory rather than "..": this is because # AIX remembers this path and will attempt to use it at run-time to look # up the Tcl library. -if test "$SHARED_BUILD" = 0 -o $TCL_NEEDS_EXP_FILE = 0; then - if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then - eval TK_LIB_FLAG="-ltk${VERSION}\${TK_DBGX}" - else - eval TK_LIB_FLAG="-ltk`echo ${VERSION} | tr -d .`\${TK_DBGX}" +if test "`uname -s`" = "Darwin" ; then + SC_ENABLE_FRAMEWORK + TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version ${TK_VERSION}`echo ${TK_PATCH_LEVEL} | awk ['{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}']`" + TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name ${DYLIB_INSTALL_DIR}/${TK_LIB_FILE} -seg1addr 0xb000000 -unexported_symbols_list $$(f=$(TCL_STUB_LIB_FILE).E && nm -gjp $(TCL_BIN_DIR)/$(TCL_STUB_LIB_FILE) | tail +3 > $$f && echo $$f)' +fi + +if test "$FRAMEWORK_BUILD" = "1" ; then + AC_DEFINE(TK_FRAMEWORK) + tk_config_files="${tk_config_files} [Tk-Info.plist:../macosx/Tk-Info.plist.in]" + # Construct a fake local framework structure to make linking with + # '-framework Tk' and running of tktest work + AC_OUTPUT_COMMANDS([n=Tk && echo "creating $n.framework" && + f=$n.framework && v=Versions/$VERSION && + rm -rf $f && mkdir -p $f/$v/Resources && + ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v && + ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist && + if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi && + unset n f v + ], VERSION=${TK_VERSION} && tk_aqua=${tk_aqua}) + LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH" + if test "${libdir}" = '${exec_prefix}/lib'; then + # override libdir default + libdir="/Library/Frameworks" + fi + TK_LIB_FILE="Tk" + TK_LIB_FLAG="-framework Tk" + TK_BUILD_LIB_SPEC="-F`pwd` -framework Tk" + TK_LIB_SPEC="-F${libdir} -framework Tk" + libdir="${libdir}/Tk.framework/Versions/\${VERSION}" + TK_LIBRARY="${libdir}/Resources/Scripts" + TK_PKG_DIR="Resources/Scripts" + TK_RSRC_FILE="Tk.rsrc" + WISH_RSRC_FILE="Wish.rsrc" + includedir="${libdir}/Headers" + PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders" + HTML_DIR="${libdir}/Resources/Documentation/Reference/Tk" + EXTRA_INSTALL="install-private-headers html-tk" + EXTRA_BUILD_HTML='@ln -fs contents.htm $(HTML_INSTALL_DIR)/TkTOC.html' + EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"' + if test $tk_aqua = yes; then + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${TK_RSRC_FILE} to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "${TK_RSRC_FILE}" "$(LIB_INSTALL_DIR)/Resources"' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'" && mkdir -p "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"' + bindir="${libdir}/Resources/Wish.app/Contents/MacOS" + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "'\$\(MAC\_OSX_DIR\)'/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources"' + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"' fi - TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}" - TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" - TK_BUILD_EXP_FILE="" - TK_EXP_FILE="" + EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" "$(STUB_LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done' + TK_YEAR="`date +%Y`" + # Don't use AC_DEFINE for the following as the framework version define + # needs to go into the Makefile even when using autoheader, so that we + # can pick up a potential make override of VERSION. Also, don't put this + # into CFLAGS as it should not go into tkConfig.sh + EXTRA_CC_SWITCHES='-DTK_FRAMEWORK_VERSION=\"$(VERSION)\"' else - TK_BUILD_EXP_FILE="lib.exp" - eval "TK_EXP_FILE=libtk${TCL_EXPORT_FILE_SUFFIX}" - - if test "$GCC" = "yes" ; then - TK_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TK_BUILD_EXP_FILE} -L`pwd`" - TK_LIB_SPEC="-Wl,-bI:${libdir}/${TK_EXP_FILE} -L`pwd`" + # libdir must be a fully qualified path and not ${exec_prefix}/lib + eval libdir="$libdir" + if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then + if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then + eval TK_LIB_FLAG="-ltk${VERSION}\${TK_DBGX}" + else + eval TK_LIB_FLAG="-ltk`echo ${VERSION} | tr -d .`\${TK_DBGX}" + fi + TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}" + TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" else - TK_BUILD_LIB_SPEC="-bI:`pwd`/${TK_BUILD_EXP_FILE}" - TK_LIB_SPEC="-bI:${libdir}/${TK_EXP_FILE}" + TK_BUILD_EXP_FILE="lib.exp" + eval "TK_EXP_FILE=libtk${TCL_EXPORT_FILE_SUFFIX}" + + if test "$GCC" = "yes" ; then + TK_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TK_BUILD_EXP_FILE} -L`pwd`" + TK_LIB_SPEC="-Wl,-bI:${libdir}/${TK_EXP_FILE} -L`pwd`" + else + TK_BUILD_LIB_SPEC="-bI:`pwd`/${TK_BUILD_EXP_FILE}" + TK_LIB_SPEC="-bI:${libdir}/${TK_EXP_FILE}" + fi + fi +fi + +# Support for building the Aqua resource files +if test $tk_aqua = yes; then + tk_config_files="${tk_config_files} [Wish-Info.plist:../macosx/Wish-Info.plist.in]" + EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist' + LIB_RSRC_FILE='${TK_RSRC_FILE}' + APP_RSRC_FILE='${WISH_RSRC_FILE}' + REZ=/Developer/Tools/Rez + REZ_FLAGS='-d "SystemSevenOrLater=1" -useDF' + if test "$SHARED_BUILD" = 0; then + EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)" && $(INSTALL_DATA) $(TK_RSRC_FILE) $(LIB_INSTALL_DIR)' + TK_BUILD_LIB_SPEC="$TK_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd`/\${TK_RSRC_FILE}" + TK_LIB_SPEC="$TK_LIB_SPEC -sectcreate __TEXT __tk_rsrc ${libdir}/\${TK_RSRC_FILE}" + elif test "$FRAMEWORK_BUILD" = "0"; then + TK_SHLIB_LD_EXTRAS="$TK_SHLIB_LD_EXTRAS -sectcreate __TEXT __tk_rsrc \${TK_RSRC_FILE}" fi fi -TK_SHARED_BUILD=${SHARED_BUILD} #-------------------------------------------------------------------- -# The statements below define various symbols relating to creating -# the stub'd version of the Tk library -# -# For now, linking to Tcl stubs is not supported with Tk. It causes -# too many problems with linking. When Tk is a fully loadable -# extension, linking the the Tcl stubs will be supported. +# The statements below define various symbols relating to Tk +# stub support. #-------------------------------------------------------------------- # Replace ${VERSION} with contents of ${TK_VERSION} eval "TK_STUB_LIB_FILE=libtkstub${TK_UNSHARED_LIB_SUFFIX}" +eval "TK_STUB_LIB_DIR=${libdir}" if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then eval TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}\${TK_DBGX}" @@ -407,43 +516,66 @@ else fi TK_BUILD_STUB_LIB_SPEC="-L`pwd` ${TK_STUB_LIB_FLAG}" -TK_STUB_LIB_SPEC="-L${libdir} ${TK_STUB_LIB_FLAG}" +TK_STUB_LIB_SPEC="-L${TK_STUB_LIB_DIR} ${TK_STUB_LIB_FLAG}" TK_BUILD_STUB_LIB_PATH="`pwd`/${TK_STUB_LIB_FILE}" -TK_STUB_LIB_PATH="${libdir}/${TK_STUB_LIB_FILE}" +TK_STUB_LIB_PATH="${TK_STUB_LIB_DIR}/${TK_STUB_LIB_FILE}" -eval "TK_LIB_FILE=${TK_LIB_FILE}" +#------------------------------------------------------------------------ +# tkConfig.sh refers to this by a different name +#------------------------------------------------------------------------ + +TK_SHARED_BUILD=${SHARED_BUILD} AC_SUBST(TK_VERSION) AC_SUBST(TK_MAJOR_VERSION) AC_SUBST(TK_MINOR_VERSION) AC_SUBST(TK_PATCH_LEVEL) -AC_SUBST(TK_DBGX) +AC_SUBST(TK_YEAR) +AC_SUBST(TK_LIB_FILE) +AC_SUBST(TK_LIB_FLAG) +AC_SUBST(TK_LIB_SPEC) AC_SUBST(TK_STUB_LIB_FILE) AC_SUBST(TK_STUB_LIB_FLAG) -AC_SUBST(TK_BUILD_STUB_LIB_SPEC) AC_SUBST(TK_STUB_LIB_SPEC) -AC_SUBST(TK_BUILD_STUB_LIB_PATH) AC_SUBST(TK_STUB_LIB_PATH) -AC_SUBST(TK_STUB_FLAGS) -AC_SUBST(TK_BUILD_EXP_FILE) -AC_SUBST(TK_EXP_FILE) +AC_SUBST(TK_BUILD_STUB_LIB_SPEC) +AC_SUBST(TK_BUILD_STUB_LIB_PATH) -AC_SUBST(TCL_STUB_FLAGS) -AC_SUBST(TK_BUILD_EXP_FILE) -AC_SUBST(TK_EXP_FILE) +AC_SUBST(TK_SRC_DIR) +AC_SUBST(TK_DBGX) +AC_SUBST(TK_SHARED_BUILD) AC_SUBST(LD_LIBRARY_PATH_VAR) -AC_SUBST(MATH_LIBS) AC_SUBST(TK_BUILD_LIB_SPEC) -AC_SUBST(TK_LIB_FILE) -AC_SUBST(TK_LIB_FLAG) -AC_SUBST(TK_LIB_SPEC) -AC_SUBST(TK_SRC_DIR) +AC_SUBST(TK_BUILD_EXP_FILE) +AC_SUBST(TK_EXP_FILE) + +AC_SUBST(TCL_STUB_FLAGS) +AC_SUBST(MATH_LIBS) AC_SUBST(XINCLUDES) AC_SUBST(XLIBSW) -AC_SUBST(TK_SHARED_BUILD) AC_SUBST(LOCALES) -AC_OUTPUT(Makefile tkConfig.sh) +AC_SUBST(TK_WINDOWINGSYSTEM) +AC_SUBST(TK_PKG_DIR) +AC_SUBST(TK_LIBRARY) +AC_SUBST(PRIVATE_INCLUDE_DIR) +AC_SUBST(HTML_DIR) + +AC_SUBST(EXTRA_CC_SWITCHES) +AC_SUBST(EXTRA_INSTALL) +AC_SUBST(EXTRA_INSTALL_BINARIES) +AC_SUBST(EXTRA_BUILD_HTML) +AC_SUBST(EXTRA_WISH_LIBS) + +AC_SUBST(TK_RSRC_FILE) +AC_SUBST(WISH_RSRC_FILE) +AC_SUBST(LIB_RSRC_FILE) +AC_SUBST(APP_RSRC_FILE) +AC_SUBST(REZ) +AC_SUBST(REZ_FLAGS) + +tk_config_files="${tk_config_files} [Makefile tkConfig.sh]" +AC_OUTPUT([${tk_config_files}]) |