source: trunk/base/configure.ac @ 65055

Last change on this file since 65055 was 65055, checked in by jmr@…, 11 years ago

install macports1.0 next to the other Tcl packages and just put a link in the Tcl package dir if possible (#12943)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.2 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2dnl $Id: configure.ac 65055 2010-03-20 14:28:09Z jmr@macports.org $
3AC_PREREQ(2.63)
4AC_DEFUN([MACPORTS_VERSION_MACRO], [esyscmd(cat config/macports_version | tr -d '\n')])
5AC_INIT([MacPorts],MACPORTS_VERSION_MACRO,[macports-dev@lists.macosforge.org],[macports])
6AC_CONFIG_SRCDIR([src/pextlib1.0/Pextlib.c])
7AC_CONFIG_HEADERS([src/config.h])
8
9AC_CANONICAL_TARGET
10
11# Read in the MacPorts version from the base/config/macports_version file
12AC_MSG_CHECKING(MacPorts version)
13MACPORTS_VERSION=MACPORTS_VERSION_MACRO
14AC_MSG_RESULT([$MACPORTS_VERSION])
15AC_SUBST(MACPORTS_VERSION)
16
17# Check user PATH for MP paths, and remove as necessary.
18MP_PATH_SCAN
19
20AC_PATH_PROG(SW_VERS, sw_vers)
21AC_PATH_PROG(DEFAULTS, defaults)
22AC_PATH_PROG(XCODE_SELECT, xcode-select)
23
24if test "x$SW_VERS" != "x"; then
25  AC_MSG_CHECKING(Mac OS X version)
26  MACOSX_VERSION=`$SW_VERS -productVersion`
27  AC_MSG_RESULT([$MACOSX_VERSION])
28fi
29
30case "$MACOSX_VERSION" in
31  10.0*|10.1*|10.2*|10.3*)
32    AC_MSG_ERROR([This version of Mac OS X is not supported
33                  Please upgrade at http://store.apple.com/])
34    ;;
35  10.4.[[0-9]]|10.4.10|10.5.[[0-7]]|10.6.[[0-1]])
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])
38    ;;
39  10.4*|10.5*|10.6*)
40    dnl Supported version
41    ;;
42  *)
43    ;;
44esac
45
46# locate currently selected Xcode path
47if test "x$XCODE_SELECT" != "x"; then
48  AC_MSG_CHECKING(Xcode location)
49  DEVELOPER_DIR=`$XCODE_SELECT -print-path`
50  AC_MSG_RESULT([$DEVELOPER_DIR])
51else
52  DEVELOPER_DIR=/Developer
53fi
54AC_SUBST(DEVELOPER_DIR)
55
56XCODEPLIST=$DEVELOPER_DIR/Applications/Xcode.app/Contents/version.plist
57if test -r "$XCODEPLIST"; then
58  AC_MSG_CHECKING(Xcode version)
59  if test "x$DEFAULTS" != "x"; then
60    XCODE_VERSION=`$DEFAULTS read $DEVELOPER_DIR/Applications/Xcode.app/Contents/version CFBundleShortVersionString`
61  else
62    XCODE_VERSION=`tr -d '\r\n' < $XCODEPLIST | sed -e 's/.*<key>CFBundleShortVersionString<\/key>.<string>\([[0-9.]]*\)<\/string>.*/\1/'`
63  fi
64  AC_MSG_RESULT([$XCODE_VERSION])
65fi
66
67case "$XCODE_VERSION" in
68  1.*|2.[[0-1]]*)
69    AC_MSG_WARN([This version of Xcode Tools is not supported])
70    AC_MSG_WARN([Please upgrade at http://connect.apple.com/])
71    ;;
72  2.[[2-3]]*|3.[[0]]*)
73    AC_MSG_WARN([This version of Xcode Tools is out of date])
74    AC_MSG_WARN([Please consider upgrading as some ports fail compiling])
75    ;;
76  2.*|3.*)
77    dnl Supported version
78    ;;
79  *)
80    ;;
81esac
82
83# Checks for programs.
84AC_PROG_CC
85AC_PROG_OBJC
86AC_PROG_INSTALL
87AC_PROG_MAKE_SET
88AC_PROG_LN_S
89AC_PATH_PROG(MTREE, [mtree], [], [$PATH:/usr/sbin])
90AC_PATH_PROG(CHOWN, [chown], [], [$PATH:/usr/sbin])
91AC_PATH_PROG(CP, [cp], [])
92AC_PATH_PROG(CPIO, [cpio], [])
93AC_PATH_PROG(DIFF, [diff], [])
94AC_PATH_PROG(DSCL, [dscl], [])
95AC_PATH_PROG(FILE, [file], [])
96AC_PATH_PROG(CVS, [cvs], [])
97AC_PATH_PROG(SVN, [svn], [])
98AC_PATH_PROG(GIT, [git], [])
99AC_PATH_PROG(HG, [hg], [])
100AC_PATH_PROG(GZIP, [gzip], [])
101AC_PATH_PROG(LIPO, [lipo], [])
102AC_PATH_PROG(NICE, [nice], [])
103AC_PATH_PROG(PATCH, [patch], [])
104AC_PATH_PROG(RMDIR, [rmdir], [])
105AC_PATH_PROG(RSYNC, [rsync], [])
106AC_PATH_PROG(SED, [sed])
107AC_PATH_PROG(TAR, [tar])
108AC_PATH_PROG(UNZIP, [unzip])
109AC_PATH_PROG(ZIP, [zip])
110AC_PATH_PROGS(BSDMAKE, [bsdmake pmake], [])
111AC_PATH_PROG(MAKE, [make])
112AC_PATH_PROG(HDIUTIL, [hdiutil], [])
113AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
114AC_PATH_PROG(LAUNCHCTL, [launchctl], [])
115AC_PATH_PROG(XCODEBUILD, [xcodebuild], [])
116AC_PATH_PROGS(GNUTAR, [gnutar gtar], [], [$PATH:/usr/local/bin])
117AC_PATH_PROGS(GNUMAKE, [gnumake gmake], [], [$PATH:/usr/local/bin])
118AC_PATH_PROGS(GNUPATCH, [gnupatch gpatch], [], [$PATH:/usr/local/bin])
119AC_PATH_PROG(BZIP2, [bzip2], [])
120AC_PATH_PROG(LSBOM, [lsbom], [])
121AC_PATH_PROG(MKBOM, [mkbom], [])
122AC_PATH_PROG(PAX, [pax], [])
123AC_PATH_PROG(XAR, [xar], [])
124AC_PATH_PROG(OPEN, [open], [])
125
126# Define some precious variables allowing user to override PATH for some programs
127AC_ARG_VAR(MTREE, [path to mtree command])
128AC_ARG_VAR(CVS, [path to cvs command])
129AC_ARG_VAR(SVN, [path to svn command])
130AC_ARG_VAR(RSYNC, [path to rsync command])
131AC_ARG_VAR(SED, [path to sed command])
132AC_ARG_VAR(TAR, [path to tar command])
133AC_ARG_VAR(MAKE, [path to make command])
134AC_ARG_VAR(GNUTAR, [path to gnutar command])
135AC_ARG_VAR(BSDMAKE, [path to bsdmake/pmake command])
136AC_ARG_VAR(GNUMAKE, [path to gnumake command])
137AC_ARG_VAR(BZIP2, [path to bzip2 command])
138AC_ARG_VAR(XAR, [path to xar command])
139AC_ARG_VAR(OPEN, [path to open command])
140
141MP_SED_EXTENDED_REGEXP
142MP_TAR_NO_SAME_OWNER
143MP_PATCH_GNU_VERSION
144
145# Quiche eaters options.
146if test x$GCC = xyes; then
147        CFLAGS_QUICHEEATERS='-W -Wall -pedantic'
148fi
149AC_SUBST(CFLAGS_QUICHEEATERS)
150MP_WERROR
151
152MP_COMPILER_ATTRIBUTE_UNUSED
153MP_COMPILER_ATTRIBUTE_LF_PRIVATE
154
155# Foundation checks
156ACX_PTHREAD
157MP_OBJC_RUNTIME
158MP_OBJC_FOUNDATION
159
160MP_PROG_DAEMONDO
161
162AC_SUBST(EXTRA_PROGS)
163
164# set default ports-directory
165PORTS_DIR_DEFAULT=`pwd | sed -e "s/base/ports/"`
166
167# Check for paths
168AC_PREFIX_DEFAULT(/opt/local)
169if test x$prefix = x/usr/local; then
170    AC_MSG_ERROR([Installing MacPorts into /usr/local is not supported])
171fi
172MP_PATH_PORTSDIR([$PORTS_DIR_DEFAULT])
173MP_PATH_MPCONFIGDIR
174
175# Check whether to install without root privileges
176MP_CHECK_NOROOTPRIVILEGES
177
178# Check for install ownership
179MP_CHECK_INSTALLUSER
180MP_CHECK_INSTALLGROUP
181MP_CHECK_RUNUSER
182MP_DIRECTORY_MODE
183MP_SHARED_DIRECTORY
184
185# Check for default directories
186MP_PATH_APPLICATIONS
187MP_PATH_FRAMEWORKS
188
189# Check for universal options
190MP_UNIVERSAL_OPTIONS
191
192# Check for standard header files.
193AC_HEADER_STDC
194AC_HEADER_DIRENT
195AC_HEADER_SYS_WAIT
196AC_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 \
197        readline/readline.h readline/history.h pwd.h sys/paths.h utime.h])
198
199INCLUDES="-I.. -I. $INCLUDES"
200
201# Checks for library functions.
202AC_CHECK_FUNCS([bzero memset fgetln lockf flock setmode strcasecmp strncasecmp strlcpy copyfile clearenv])
203MP_CHECK_READLINK_IS_P1003_1A
204
205# Check for md5 implementation
206AC_CHECK_HEADER([CommonCrypto/CommonDigest.h], [AC_DEFINE([HAVE_COMMONCRYPTO_COMMONDIGEST_H], [1], [Define if CommonCrypto is available.])], [MP_LIB_MD5])
207
208# Check for readline
209AC_ARG_ENABLE(readline, AS_HELP_STRING([--enable-readline],[Enable addition of readline support, if readline present.]),
210[
211        AC_CHECK_LIB([readline], [readline], [
212                                  READLINE_LIBS=-lreadline
213                                  AC_DEFINE([HAVE_LIBREADLINE], [1], [Define to 1 if you have the `readline' library (-lreadline).])
214                                  ])
215        AC_CHECK_DECLS([rl_username_completion_function,rl_filename_completion_function,rl_completion_matches,username_completion_function,filename_completion_function,completion_matches], [], [],
216        [
217        #include <stdio.h>
218        #if HAVE_READLINE_READLINE_H
219        # include <readline/readline.h>
220        #endif
221        ])
222])
223AC_SUBST(READLINE_LIBS)
224
225# Lowest non-system-reserved uid and gid (Apple claims <500)
226AC_DEFINE([MIN_USABLE_UID], [500], [Lowest non-system-reserved UID.])
227AC_DEFINE([MIN_USABLE_GID], [500], [Lowest non-system-reserved GID.])
228
229# Load tclConfig.sh
230SC_PATH_TCLCONFIG
231SC_LOAD_TCLCONFIG
232
233# Check for Tcl public headers
234dnl XXX  hardwire CYGPATH (CYGPATH must be set for SC_PUBLIC_TCL_HEADERS)
235CYGPATH=echo
236SC_PUBLIC_TCL_HEADERS
237
238# Check for tclsh binary
239MP_PROG_TCLSH
240
241# Check for Tcl package path
242MP_TCL_PACKAGE_DIR
243
244# Check if thread is enabled.
245MP_TCL_THREAD_SUPPORT
246
247## libcurl
248MP_LIBCURL_FLAGS
249
250## sqlite3
251MP_SQLITE3_FLAGS
252
253# Determine if we need to install some bundled packages
254OUR_INCLUDED_PACKAGES=
255
256## Thread package.
257AC_ARG_WITH(
258                included-tclthread,
259                AS_HELP_STRING([--with-included-tclthread],
260                        [install included Thread package.]),
261                [with_included_tclthread=$withval],
262                [with_included_tclthread="unspecified"])
263
264# Check if thread package is already installed.
265if test "x$with_included_tclthread" = "xunspecified" ; then
266        MP_TCL_PACKAGE(
267                [Thread],
268                [AC_MSG_RESULT([yes]); with_included_tclthread=no],
269                [AC_MSG_RESULT([no]); with_included_tclthread=yes])
270fi
271
272# If thread package isn't installed, configure and install thread package.
273if test "$with_included_tclthread" = "yes"; then
274        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
275        AC_CONFIG_SUBDIRS([src/thread2.6])
276        # Extract thread package
277        (cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
278        # Patch thread package (so thread2.6 is the vanilla distribution directory)
279        patch -p0 < src/thread2.6.diff
280fi
281
282AH_TEMPLATE([TRACE_SDK], [SDK for SDK redirect in tracelib])
283AC_ARG_WITH(
284        trace-sdk,
285        AS_HELP_STRING([--with-trace-sdk=SDK],
286                [SDK for redirection in trace lib (for example MacOSX10.4u.sdk)]),
287        [test -d ${DEVELOPER_DIR}/SDKs/$withval && AC_DEFINE_UNQUOTED([TRACE_SDK], "${withval}")], [])
288
289# Allows building of shared libraries
290SC_ENABLE_SHARED
291
292# Pull compiler / linker values from tclConfig.sh
293LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG}
294LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE}
295SHLIB_LD=${TCL_SHLIB_LD}
296STLIB_LD=${TCL_STLIB_LD}
297SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}
298SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX}
299
300AC_SUBST(INCLUDES)
301AC_SUBST(PATHCONF)
302AC_SUBST(STLIB_LD)
303AC_SUBST(SHLIB_LD)
304AC_SUBST(SHLIB_CFLAGS)
305AC_SUBST(SHLIB_LDFLAGS)
306AC_SUBST(SHLIB_SUFFIX)
307AC_SUBST(TCL_DEFS)
308AC_SUBST(TCL_STUB_LIB_SPEC)
309AC_SUBST(TCL_CC)
310AC_SUBST(OUR_INCLUDED_PACKAGES)
311
312# misc variables that need to be expanded for substitution into tcl
313
314oldprefix=$prefix
315if test "x$prefix" = "xNONE" ; then
316   prefix=$ac_default_prefix
317fi
318
319# Check if there's an existing DP/MP install too old to upgrade
320MP_CHECK_OLDLAYOUT
321
322eval "prefix_expanded=$prefix"
323AC_SUBST(prefix_expanded)
324# do this twice, since there is a nested variable of
325# ${prefix} inside of ${sysconfdir}
326eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
327eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
328AC_SUBST(MPCONFIGDIR_EXPANDED)
329eval "localstatedir_expanded=$localstatedir"
330AC_SUBST(localstatedir_expanded)
331eval "macports_tcl_dir=${datadir}/macports/Tcl"
332eval "macports_tcl_dir=$macports_tcl_dir"
333AC_SUBST(macports_tcl_dir)
334
335prefix=$oldprefix
336
337dnl man page settings (compressed, links, etc)
338dnl
339dnl SC_CONFIG_MANPAGES
340
341# Output
342AC_CONFIG_FILES([
343        Doxyfile
344        Makefile
345        Mk/macports.autoconf.mk
346        doc/prefix.mtree
347        doc/macosx.mtree
348        doc/macports.conf
349        portmgr/freebsd/Makefile
350        src/Makefile
351        src/macports1.0/macports_autoconf.tcl
352        src/port1.0/port_autoconf.tcl
353        src/registry2.0/registry_autoconf.tcl
354        src/programs/Makefile
355        src/macports1.0/macports_fastload.tcl
356        setupenv.bash
357])
358
359AC_CONFIG_FILES([src/pkg_mkindex.sh], [chmod +x src/pkg_mkindex.sh])
360
361AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.