source: trunk/base/configure.ac @ 92404

Last change on this file since 92404 was 91520, checked in by jmr@…, 9 years ago

fail in configure if mtree is not present, rather than later in the build (see #32531)

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