Ticket #38582: patch-liberally-configure.ac.diff

File patch-liberally-configure.ac.diff, 17.7 KB (added by cooljeanius (Eric Gallager), 11 years ago)

patch against 2.2 base's configure.ac that includes the changes from the more conservative patch, as well as other macros that I would like to include

  • configure.ac

    old new  
    1 dnl Process this file with autoconf to produce a configure script.
    2 dnl $Id$
    3 AC_PREREQ(2.63)
    4 AC_DEFUN([MACPORTS_VERSION_MACRO], [esyscmd(<config/macports_version tr -d '\n')])
     1dnl#                                               -*- Autoconf -*-
     2dnl# Process this file with autoconf to produce a configure script.
     3dnl# $Id$
     4
     5AC_PREREQ([2.69])
     6AC_DEFUN([MACPORTS_VERSION_MACRO],[esyscmd(<config/macports_version tr -d '\n')])
     7dnl# Square brackets cannot be put around the middle argument to AC_INIT here.
     8dnl# That would be how it is normally done, and it is what autoupdate
     9dnl# wants to do, but this cannot be done because of the following error:
     10dnl# configure.ac:7: error: m4_divert_push: cannot change diversion to `GROW' inside m4_expand
     11dnl# configure.ac:7: the top level
    512AC_INIT([MacPorts],MACPORTS_VERSION_MACRO,[macports-dev@lists.macosforge.org],[macports])
    613AC_CONFIG_SRCDIR([src/pextlib1.0/Pextlib.c])
    714AC_CONFIG_HEADERS([src/config.h])
     15AC_CONFIG_MACRO_DIR([m4])
    816
    917AC_CANONICAL_TARGET
     18AC_USE_SYSTEM_EXTENSIONS
     19AC_OBJEXT
     20AC_EXEEXT
    1021
    1122# Read in the MacPorts version from the base/config/macports_version file
    12 AC_MSG_CHECKING(MacPorts version)
     23AC_MSG_CHECKING([MacPorts version])
    1324MACPORTS_VERSION=MACPORTS_VERSION_MACRO
    1425AC_MSG_RESULT([$MACPORTS_VERSION])
    15 AC_SUBST(MACPORTS_VERSION)
     26AC_SUBST([MACPORTS_VERSION])
    1627
    1728# Check user PATH for MP paths, and remove as necessary.
    1829MP_PATH_SCAN
    1930
    20 AC_PATH_PROG(SW_VERS, sw_vers)
    21 AC_PATH_PROG(DEFAULTS, defaults)
    22 AC_PATH_PROG(XCODE_SELECT, xcode-select)
     31AC_PATH_PROG([SW_VERS],[sw_vers])
     32AC_PATH_PROG([DEFAULTS],[defaults])
     33AC_PATH_PROG([XCODE_SELECT],[xcode-select])
    2334
    2435if test "x$SW_VERS" != "x"; then
    25   AC_MSG_CHECKING(Mac OS X version)
     36  AC_MSG_CHECKING([Mac OS X version])
    2637  MACOSX_VERSION=`$SW_VERS -productVersion`
    2738  AC_MSG_RESULT([$MACOSX_VERSION])
    2839fi
    2940
    3041case "$MACOSX_VERSION" in
    3142  10.0*|10.1*|10.2*|10.3*)
    32     AC_MSG_ERROR([This version of Mac OS X is not supported
     43    AC_MSG_ERROR([This version of Mac OS X is not supported any more.
    3344                  Please upgrade at http://store.apple.com/])
    3445    ;;
    3546  10.4.[[0-9]]|10.4.10|10.5.[[0-7]]|10.6.[[0-7]]|10.7.[[0-4]]|10.8.[[0-3]])
    36     AC_MSG_WARN([This version of Mac OS X is out of date])
    37     AC_MSG_WARN([Please run Software Update to update it])
     47    AC_MSG_WARN([This version of Mac OS X is out of date.])
     48    AC_MSG_WARN([Please run Software Update to update it.])
    3849    ;;
    3950  10.4*|10.5*|10.6*|10.7*|10.8*)
    40     dnl Supported version
     51    dnl# Supported version
    4152    ;;
    4253  *)
    4354    ;;
    4455esac
    4556
    4657# locate currently selected Xcode path
    47 AC_MSG_CHECKING(Xcode location)
     58AC_MSG_CHECKING([Xcode location])
    4859if test "x$XCODE_SELECT" != "x"; then
    4960  DEVELOPER_DIR=`$XCODE_SELECT -print-path`
    5061fi
     
    5667    fi
    5768fi
    5869AC_MSG_RESULT([$DEVELOPER_DIR])
    59 AC_SUBST(DEVELOPER_DIR)
     70AC_SUBST([DEVELOPER_DIR])
    6071
    6172case "$DEVELOPER_DIR" in
    6273  *Xcode.app/Contents/Developer)
     
    8798    AC_MSG_WARN([Please consider upgrading as some ports fail compiling])
    8899    ;;
    89100  2.*|3.*|4.*)
    90     dnl Supported version
     101    dnl# Supported version
    91102    ;;
    92103  *)
    93104    ;;
    94105esac
    95106
    96107# Checks for programs.
    97 AC_PROG_CC
     108AC_PROG_AWK
     109if test "x$CC" = "x"; then
     110  AC_PROG_CC
     111else
     112  # The "test" is just a dummy to make sure that this "else" condition
     113  # is not empty, as sometimes `autoconf` removes the AC_SUBSTs...
     114  test ! -z "$CC"
     115  AC_SUBST([CC])
     116fi
     117AC_PROG_CPP
     118AC_PROG_CXX
     119AC_PROG_GCC_TRADITIONAL
    98120AC_PROG_INSTALL
    99121AC_PROG_LN_S
    100122AC_PROG_MAKE_SET
     123AC_PROG_RANLIB
     124AC_PROG_YACC
    101125AC_PROG_OBJC
    102126
    103 AC_PATH_PROGS(BSDMAKE, [bsdmake pmake], [])
    104 AC_PATH_PROG(BZIP2, [bzip2], [])
    105 AC_PATH_PROG(BZR, [bzr], [])
    106 AC_PATH_PROG(CHOWN, [chown], [], [$PATH:/usr/sbin])
    107 AC_PATH_PROG(CP, [cp], [])
    108 AC_PATH_PROG(CPIO, [cpio], [])
    109 AC_PATH_PROG(CVS, [cvs], [])
    110 AC_PATH_PROG(DIFF, [diff], [])
    111 AC_PATH_PROG(DSCL, [dscl], [])
    112 AC_PATH_PROG(DSEDITGROUP, [dseditgroup], [])
    113 AC_PATH_PROG(FILE, [file], [])
    114 AC_PATH_PROG(FIND, [find], [])
    115 AC_PATH_PROG(GIT, [git], [])
    116 AC_PATH_PROGS(GNUMAKE, [gnumake gmake], [], [$PATH:/usr/local/bin])
    117 AC_PATH_PROGS(GNUPATCH, [gnupatch gpatch], [], [$PATH:/usr/local/bin])
    118 AC_PATH_PROGS(GNUTAR, [gnutar gtar], [], [$PATH:/usr/local/bin])
    119 AC_PATH_PROG(GZIP, [gzip], [])
    120 AC_PATH_PROG(HDIUTIL, [hdiutil], [])
    121 AC_PATH_PROG(HG, [hg], [])
    122 AC_PATH_PROG(LAUNCHCTL, [launchctl], [])
    123 AC_PATH_PROG(LIPO, [lipo], [])
    124 AC_PATH_PROG(LSBOM, [lsbom], [])
    125 AC_PATH_PROG(LZMA, [lzma], [])
    126 AC_PATH_PROG(MAKE, [make])
    127 AC_PATH_PROG(MDFIND, [mdfind], [])
    128 AC_PATH_PROG(MDLS, [mdls], [])
    129 AC_PATH_PROG(MKBOM, [mkbom], [])
    130 AC_PATH_PROG(MTREE, [mtree], [], [$PATH:/usr/sbin])
    131 AC_PATH_PROG(OPEN, [open], [])
    132 AC_PATH_PROG(OPENSSL, [openssl], [])
    133 AC_PATH_PROG(PATCH, [patch], [])
    134 AC_PATH_PROG(PAX, [pax], [])
    135 AC_PATH_PROG(RMDIR, [rmdir], [])
    136 AC_PATH_PROG(RSYNC, [rsync], [])
    137 AC_PATH_PROG(SANDBOX_EXEC, [sandbox-exec], [], [/usr/bin])
    138 AC_PATH_PROG(SED, [sed])
    139 AC_PATH_PROG(SVN, [svn], [])
    140 AC_PATH_PROG(SWIG, [swig], [], [$PATH:/usr/local/bin])
    141 AC_PATH_PROG(TAR, [tar])
    142 AC_PATH_PROG(UNZIP, [unzip])
    143 AC_PATH_PROG(XAR, [xar], [])
    144 AC_PATH_PROG(XCODEBUILD, [xcodebuild], [])
    145 AC_PATH_PROG(XCRUN, [xcrun], [])
    146 AC_PATH_PROG(XZ, [xz], [])
    147 AC_PATH_PROG(ZIP, [zip])
     127# programs without specifically-crafted AC_* macros
     128AC_PATH_PROGS([BSDMAKE], [bsdmake pmake], [])
     129AC_PATH_PROG([BZIP2], [bzip2], [])
     130AC_PATH_PROG([BZR], [bzr], [])
     131AC_PATH_PROG([CHOWN], [chown], [], [$PATH:/usr/sbin])
     132AC_PATH_PROG([CHGRP], [chgrp], [], [$PATH:/usr/sbin])
     133AC_PATH_PROG([CHMOD], [chmod], [], [$PATH:/usr/sbin])
     134AC_PATH_PROG([CODESIGN], [codesign], [])
     135AC_PATH_PROG([CP], [cp], [])
     136AC_PATH_PROG([CPIO], [cpio], [])
     137AC_PATH_PROG([CVS], [cvs], [])
     138AC_PATH_PROG([DIFF], [diff], [])
     139AC_PATH_PROG([DOXYGEN], [doxygen], [])
     140AC_PATH_PROG([DSCL], [dscl], [])
     141AC_PATH_PROG([DSEDITGROUP], [dseditgroup], [])
     142AC_PATH_PROG([DYLIBBUNDLER], [dylibbundler], [])
     143AC_PATH_PROG([ED], [ed])
     144AC_PATH_PROG([FILE], [file], [])
     145AC_PATH_PROG([GIT], [git], [])
     146AC_PATH_PROGS([GNUMAKE], [gnumake gmake], [], [$PATH:/usr/local/bin])
     147AC_PATH_PROGS([GNUPATCH], [gnupatch], [], [$PATH:/usr/local/bin])
     148AC_PATH_PROGS([GNUTAR], [gnutar gtar], [], [$PATH:/usr/local/bin])
     149AC_PATH_PROG([GZIP], [gzip], [])
     150AC_PATH_PROG([HDIUTIL], [hdiutil], [])
     151AC_PATH_PROG([HG], [hg], [])
     152AC_PATH_PROG([LAUNCHCTL], [launchctl], [])
     153AC_PATH_PROG([LIPO], [lipo], [])
     154AC_PATH_PROG([LSBOM], [lsbom], [])
     155AC_PATH_PROG([LZMA], [lzma], [])
     156AC_PATH_PROG([MAKE], [make])
     157AC_PATH_PROG([MDFIND], [mdfind], [])
     158AC_PATH_PROG([MDLS], [mdls], [])
     159AC_PATH_PROG([MKBOM], [mkbom], [])
     160AC_PATH_PROG([MTREE], [mtree], [], [$PATH:/usr/sbin])
     161AC_PATH_PROG([OPEN], [open], [])
     162AC_PATH_PROG([OPENSSL], [openssl], [])
     163AC_PATH_PROG([PAX], [pax], [])
     164AC_PATH_PROG([PERL5], [perl], [])
     165AC_PATH_PROG([RMDIR], [rmdir], [])
     166AC_PATH_PROG([RSYNC], [rsync], [])
     167AC_PATH_PROG([SANDBOX_EXEC], [sandbox-exec], [], [/usr/bin])
     168AC_PATH_PROG([SED], [sed])
     169AC_PATH_PROG([SVN], [svn], [])
     170AC_PATH_PROG([TCLDOC], [tcldoc], [])
     171AC_SUBST([TCLDOC])
     172export TCLDOC
     173AC_PATH_PROG([UNZIP], [unzip])
     174AC_PATH_PROG([XATTR], [xattr], [])
     175AC_PATH_PROG([XAR], [xar], [])
     176AC_PATH_PROG([XARGS], [xargs], [])
     177AC_PATH_PROG([XCODEBUILD], [xcodebuild], [])
     178AC_PATH_PROG([XCRUN], [xcrun], [])
     179AC_PATH_PROG([XZ], [xz], [])
     180AC_PATH_PROG([ZIP], [zip])
    148181
    149 AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
     182AC_CHECK_PROG([HAVE_LAUNCHD], [launchd], [yes], [])
    150183
    151184# Define some precious variables allowing user to override PATH for some programs
    152 AC_ARG_VAR(BSDMAKE, [path to bsdmake/pmake command])
    153 AC_ARG_VAR(BZIP2, [path to bzip2 command])
    154 AC_ARG_VAR(CVS, [path to cvs command])
    155 AC_ARG_VAR(GNUMAKE, [path to gnumake command])
    156 AC_ARG_VAR(GNUTAR, [path to gnutar command])
    157 AC_ARG_VAR(LZMA, [path to lzma command])
    158 AC_ARG_VAR(MAKE, [path to make command])
    159 AC_ARG_VAR(MTREE, [path to mtree command])
    160 AC_ARG_VAR(OPEN, [path to open command])
    161 AC_ARG_VAR(OPENSSL, [path to openssl command])
    162 AC_ARG_VAR(RSYNC, [path to rsync command])
    163 AC_ARG_VAR(SED, [path to sed command])
    164 AC_ARG_VAR(SVN, [path to svn command])
    165 AC_ARG_VAR(SWIG, [path to swig command])
    166 AC_ARG_VAR(TAR, [path to tar command])
    167 AC_ARG_VAR(XAR, [path to xar command])
    168 AC_ARG_VAR(XZ, [path to xz command])
     185AC_ARG_VAR([BSDMAKE], [path to bsdmake/pmake command])
     186AC_ARG_VAR([BZIP2], [path to bzip2 command])
     187AC_ARG_VAR([CVS], [path to cvs command])
     188AC_ARG_VAR([GNUMAKE], [path to gnumake command])
     189AC_ARG_VAR([GNUTAR], [path to gnutar command])
     190AC_ARG_VAR([LZMA], [path to lzma command])
     191AC_ARG_VAR([MAKE], [path to make command])
     192AC_ARG_VAR([MTREE], [path to mtree command])
     193AC_ARG_VAR([OPEN], [path to open command])
     194AC_ARG_VAR([OPENSSL], [path to openssl command])
     195AC_ARG_VAR([RSYNC], [path to rsync command])
     196AC_ARG_VAR([SED], [path to sed command])
     197AC_ARG_VAR([SVN], [path to svn command])
     198AC_ARG_VAR([SWIG], [path to swig command])
     199AC_ARG_VAR([TCLSH], [path to tclsh command])
     200AC_ARG_VAR([TAR], [path to tar command])
     201AC_ARG_VAR([XAR], [path to xar command])
     202AC_ARG_VAR([XZ], [path to xz command])
    169203
    170204if test "x$MTREE" = "x"; then
    171     AC_MSG_ERROR([mtree not found])
     205    AC_MSG_ERROR([mtree not found; you can get a copy from http://opensource.apple.com/source/file_cmds/file_cmds-220.7/])
    172206fi
    173207
    174208MP_SED_EXTENDED_REGEXP
     
    181215        CFLAGS_QUICHEEATERS='-Wextra -Wall'
    182216        CFLAGS_PEDANTIC='-pedantic'
    183217fi
    184 AC_SUBST(CFLAGS_QUICHEEATERS)
    185 AC_SUBST(CFLAGS_PEDANTIC)
     218AC_SUBST([CFLAGS_QUICHEEATERS])
     219AC_SUBST([CFLAGS_PEDANTIC])
    186220MP_WERROR
    187221
    188222MP_COMPILER_ATTRIBUTE_UNUSED
     
    191225# Foundation checks
    192226ACX_PTHREAD
    193227MP_OBJC_RUNTIME
     228AC_MSG_CHECKING([for GNUStep system root])
     229if test "x$GNUSTEP_SYSTEM_ROOT" = "x"; then
     230  # TODO: move prefix-checking code above this step so that configured prefix
     231  # can be used instead of hardwiring /opt/local
     232  if test -d /opt/local/GNUStep/System; then
     233    export GNUSTEP_SYSTEM_ROOT=/opt/local/GNUSTEP/System
     234    AC_MSG_RESULT([using MacPorts GNUStep system root: $GNUSTEP_SYSTEM_ROOT])
     235    AC_SUBST([GNUSTEP_SYSTEM_ROOT])
     236  else
     237    # This had previously been in the other "else" condition, but I think
     238    # that was the wrong order...
     239    AC_MSG_RESULT([not found])
     240  fi
     241else
     242  AC_MSG_RESULT([using user-set GNUStep system root: $GNUSTEP_SYSTEM_ROOT])
     243  AC_SUBST([GNUSTEP_SYSTEM_ROOT])
     244fi
    194245MP_OBJC_FOUNDATION
    195246
    196247MP_PROG_DAEMONDO
    197248
    198 AC_SUBST(EXTRA_PROGS)
     249AC_SUBST([EXTRA_PROGS])
    199250
    200251# set default ports-directory
    201252PORTS_DIR_DEFAULT=`pwd | sed -e "s/base/ports/"`
    202253
    203254# Check for paths
    204 AC_PREFIX_DEFAULT(/opt/local)
    205 AC_ARG_WITH(
    206                 unsupported-prefix,
    207                 AS_HELP_STRING([--with-unsupported-prefix],
    208                 [Acknowledge that you accept the consequences of using an unsupported prefix.]),
     255AC_PREFIX_DEFAULT([/opt/local])
     256AC_ARG_WITH([unsupported-prefix],
     257                [AS_HELP_STRING([--with-unsupported-prefix],
     258                [Acknowledge that you accept the consequences of using an unsupported prefix.])],
    209259                [with_unsupported_prefix=$withval],
    210260                [with_unsupported_prefix=no])
    211261if test x$prefix = x/usr/local -o x$prefix = x/usr && test x$with_unsupported_prefix != xyes; then
     
    233283# Check for universal options
    234284MP_UNIVERSAL_OPTIONS
    235285
     286# Checks for libraries.
     287# FIXME: Replace `main' with a function in `-ltcl':
     288AC_CHECK_LIB([tcl], [main])
     289
    236290# Check for standard header files.
    237 AC_HEADER_STDC
     291# AC_HEADER_STDC is no longer needed by itself, as it automatically gets
     292# pulled in by other macros
    238293AC_HEADER_DIRENT
    239294AC_HEADER_SYS_WAIT
    240 AC_CHECK_HEADERS([limits.h paths.h sys/file.h crt_externs.h fcntl.h sys/fcntl.h sys/cdefs.h err.h sys/socket.h \
    241         sys/event.h sys/sysctl.h readline/readline.h readline/history.h pwd.h sys/paths.h utime.h])
     295AC_CHECK_HEADERS([crt_externs.h err.h fcntl.h limits.h mach/mach.h \
     296        netdb.h paths.h pwd.h readline/history.h readline/readline.h \
     297        stddef.h stdio.h sys/cdefs.h sys/event.h sys/fcntl.h sys/file.h \
     298        sys/ioctl.h sys/mount.h sys/param.h sys/paths.h sys/socket.h \
     299        sys/sysctl.h sys/time.h utime.h])
    242300
    243301INCLUDES="-I.. -I. $INCLUDES"
    244302
     303# Checks for typedefs, structures, and compiler characteristics.
     304AC_CHECK_HEADER_STDBOOL
     305AC_TYPE_UID_T
     306AC_C_BIGENDIAN
     307AC_C_INLINE
     308AC_TYPE_INTMAX_T
     309AC_TYPE_INTPTR_T
     310AC_TYPE_LONG_DOUBLE
     311AC_TYPE_MODE_T
     312AC_TYPE_OFF_T
     313AC_TYPE_PID_T
     314AC_C_PROTOTYPES
     315AC_C_RESTRICT
     316AC_TYPE_SIZE_T
     317AC_TYPE_SSIZE_T
     318AC_TYPE_UINT8_T
     319AC_TYPE_UINT32_T
     320AC_TYPE_UINTMAX_T
     321AC_TYPE_UINTPTR_T
     322AC_C_FLEXIBLE_ARRAY_MEMBER
     323AC_C_VARARRAYS
     324AC_CHECK_MEMBERS([Tcl_Interp.errorLine])
     325AC_CHECK_SIZEOF([long])
     326AC_CHECK_SIZEOF([uint8_t])
     327AC_CHECK_SIZEOF([uint32_t])
     328
    245329# Checks for library functions.
    246 AC_CHECK_FUNCS([bzero memset fgetln lockf flock setmode strcasecmp strncasecmp strlcpy strlcat copyfile clearenv sysctlbyname kqueue])
     330AC_FUNC_CHOWN
     331AC_FUNC_FORK
     332AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
     333AC_FUNC_MALLOC
     334AC_FUNC_MMAP
     335AC_FUNC_REALLOC
     336AC_CHECK_FUNCS([bzero clearenv copyfile dup2 fgetln flock getcwd lchown \
     337localtime_r lockf kqueue memmove memset mkdir munmap realpath regcomp \
     338rmdir select setenv setmode socket strcasecmp strchr strdup strerror \
     339strlcat strlcpy strncasecmp strrchr strstr strtol strtoul sysctlbyname \
     340utime])
    247341AC_SUBST(ac_cv_func_strlcat)
    248342
    249343MP_CHECK_READLINK_IS_P1003_1A
     
    252346AC_CHECK_HEADER([CommonCrypto/CommonDigest.h], [AC_DEFINE([HAVE_COMMONCRYPTO_COMMONDIGEST_H], [1], [Define if CommonCrypto is available.])], [MP_LIB_MD5])
    253347
    254348# Check for readline
    255 AC_ARG_ENABLE(readline, AS_HELP_STRING([--enable-readline],[Enable addition of readline support, if readline present.]),
     349AC_ARG_ENABLE([readline], [AS_HELP_STRING([--enable-readline],[Enable addition of readline support, if readline present.])],
    256350[
    257351        AC_CHECK_LIB([readline], [readline], [
    258352                                  READLINE_LIBS=-lreadline
     
    266360        #endif
    267361        ])
    268362])
    269 AC_SUBST(READLINE_LIBS)
     363AC_SUBST([READLINE_LIBS])
    270364
    271365# Lowest non-system-reserved uid and gid (Apple claims <500)
    272366AC_DEFINE([MIN_USABLE_UID], [500], [Lowest non-system-reserved UID.])
     
    276370SC_PATH_TCLCONFIG
    277371SC_LOAD_TCLCONFIG
    278372
    279 # Check for Tcl public headers
    280 dnl XXX hardwire CYGPATH (CYGPATH must be set for SC_PUBLIC_TCL_HEADERS)
     373# Check for Tcl public headers (and other Tcl-relevant headers)
     374dnl# XXX hardwire CYGPATH (CYGPATH must be set for SC_PUBLIC_TCL_HEADERS)
    281375CYGPATH=echo
    282376SC_PUBLIC_TCL_HEADERS
    283377
     
    292386
    293387## libcurl
    294388MP_LIBCURL_FLAGS
     389AC_CHECK_HEADERS([curl/curl.h curl/curlrules.h])
    295390
    296391## sqlite3
    297392MP_SQLITE3_FLAGS
    298393
    299 MP_CHECK_SQLITE_VERSION(3003011)
     394MP_CHECK_SQLITE_VERSION([3003011])
    300395if test "x${mp_sqlite_version_ge_3003011}" = "xno"; then
    301396        AC_DEFINE([sqlite3_prepare_v2], [sqlite3_prepare], [define sqlite3_prepare to sqlite_prepare_v2 if the latter is not available])
    302397fi
     
    305400OUR_INCLUDED_PACKAGES=
    306401
    307402## Thread package.
    308 AC_ARG_WITH(
    309                 included-tclthread,
    310                 AS_HELP_STRING([--with-included-tclthread],
    311                         [install included Thread package.]),
     403AC_ARG_WITH([included-tclthread],
     404                [AS_HELP_STRING([--with-included-tclthread],
     405                        [install included Thread package.])],
    312406                [with_included_tclthread=$withval],
    313407                [with_included_tclthread="unspecified"])
    314408
    315409# Check if thread package is already installed.
    316410if test "x$with_included_tclthread" = "xunspecified" ; then
    317         MP_TCL_PACKAGE(
    318                 [Thread],
     411        MP_TCL_PACKAGE([Thread],
    319412                [AC_MSG_RESULT([yes]); with_included_tclthread=no],
    320413                [AC_MSG_RESULT([no]); with_included_tclthread=yes])
    321414fi
     
    324417if test "$with_included_tclthread" = "yes"; then
    325418        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
    326419        AC_CONFIG_SUBDIRS([src/thread2.6])
    327         # Extract thread package
    328         (cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
    329         # Patch thread package (so thread2.6 is the vanilla distribution directory)
    330         patch -p0 < src/thread2.6.diff
     420        # Extract thread package (only if it has not already been extracted)
     421        if test ! -d src/thread2.6 ; then
     422                (cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
     423                # If extracting a fresh copy, we have to patch the thread package
     424                # (so that thread2.6 is the vanilla distribution directory)
     425                patch -p0 < src/thread2.6.diff
     426        fi
    331427fi
    332428
     429AH_TEMPLATE([TRACE_SDK],[SDK for SDK redirect in tracelib])
     430AC_ARG_WITH([trace-sdk],
     431        [AS_HELP_STRING([--with-trace-sdk=SDK],
     432                [SDK for redirection in trace lib (for example MacOSX10.4u.sdk)])],
     433        [test -d ${DEVELOPER_DIR}/SDKs/${withval} && AC_DEFINE_UNQUOTED([TRACE_SDK],["${withval}"])], [])
     434
    333435# Allows building of shared libraries
    334436SC_ENABLE_SHARED
    335437
     
    341443SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}
    342444SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX}
    343445
    344 AC_SUBST(INCLUDES)
    345 AC_SUBST(STLIB_LD)
    346 AC_SUBST(SHLIB_LD)
    347 AC_SUBST(SHLIB_CFLAGS)
    348 AC_SUBST(SHLIB_LDFLAGS)
    349 AC_SUBST(SHLIB_SUFFIX)
    350 AC_SUBST(TCL_DEFS)
    351 AC_SUBST(TCL_STUB_LIB_SPEC)
    352 AC_SUBST(TCL_CC)
    353 AC_SUBST(OUR_INCLUDED_PACKAGES)
     446AC_SUBST([INCLUDES])
     447AC_SUBST([STLIB_LD])
     448AC_SUBST([SHLIB_LD])
     449AC_SUBST([SHLIB_CFLAGS])
     450AC_SUBST([SHLIB_LDFLAGS])
     451AC_SUBST([SHLIB_SUFFIX])
     452AC_SUBST([TCL_DEFS])
     453AC_SUBST([TCL_STUB_LIB_SPEC])
     454AC_SUBST([TCL_CC])
     455AC_SUBST([OUR_INCLUDED_PACKAGES])
    354456
    355457# misc variables that need to be expanded for substitution into tcl
    356458
     
    363465MP_CHECK_OLDLAYOUT
    364466
    365467eval "prefix_expanded=$prefix"
    366 AC_SUBST(prefix_expanded)
     468AC_SUBST([prefix_expanded])
    367469# do this twice, since there is a nested variable of
    368470# ${prefix} inside of ${sysconfdir}
    369471eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
    370472eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
    371 AC_SUBST(MPCONFIGDIR_EXPANDED)
     473AC_SUBST([MPCONFIGDIR_EXPANDED])
    372474eval "localstatedir_expanded=$localstatedir"
    373 AC_SUBST(localstatedir_expanded)
     475AC_SUBST([localstatedir_expanded])
    374476eval "macports_tcl_dir=${datadir}/macports/Tcl"
    375477eval "macports_tcl_dir=$macports_tcl_dir"
    376 AC_SUBST(macports_tcl_dir)
     478AC_SUBST([macports_tcl_dir])
    377479
    378480prefix=$oldprefix
    379481
    380 dnl man page settings (compressed, links, etc)
    381 dnl
    382 dnl SC_CONFIG_MANPAGES
     482dnl# man page settings (compressed, links, etc)
     483dnl#
     484SC_CONFIG_MANPAGES
    383485
    384486# Output
    385487AC_CONFIG_FILES([