source: trunk/base/configure.ac @ 60262

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

we no longer use ditto

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.7 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2dnl $Id: configure.ac 60262 2009-11-07 15:37:14Z 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]])
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# Determine if we need to install some bundled packages
251OUR_INCLUDED_PACKAGES=
252
253## Thread package.
254AC_ARG_WITH(
255                included-tclthread,
256                AS_HELP_STRING([--with-included-tclthread],
257                        [install included Thread package.]),
258                [with_included_tclthread=$withval],
259                [with_included_tclthread="unspecified"])
260
261# Check if thread package is already installed.
262if test "x$with_included_tclthread" = "xunspecified" ; then
263        MP_TCL_PACKAGE(
264                [Thread],
265                [AC_MSG_RESULT([yes]); with_included_tclthread=no],
266                [AC_MSG_RESULT([no]); with_included_tclthread=yes])
267fi
268
269# If thread package isn't installed, configure and install thread package.
270if test "$with_included_tclthread" = "yes"; then
271        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
272        AC_CONFIG_SUBDIRS([src/thread2.6])
273        # Extract thread package
274        (cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
275        # Patch thread package (so thread2.6 is the vanilla distribution directory)
276        patch -p0 < src/thread2.6.diff
277fi
278
279## sqlite3 package.
280AC_ARG_WITH(
281                included-sqlite3,
282                AS_HELP_STRING([--with-included-sqlite3],
283                        [build using bundled sqlite3 package]),
284                [with_included_sqlite3=$withval],
285                [with_included_sqlite3="unspecified"])
286
287# Check if sqlite3 package is already installed.
288if test "x$with_included_sqlite3" = "xunspecified" ; then
289        AC_CHECK_LIB([sqlite3],[sqlite3_open],
290                [with_included_sqlite3=no],
291                [with_included_sqlite3=yes])
292fi
293
294AC_ARG_WITH(
295                tcl-sqlite3,
296                AS_HELP_STRING([--with-tcl-sqlite3=DIR],
297                        [directory for Tcl sqlite3 (default /usr/lib/sqlite3)]),
298                [mp_sqlite3_dir=$withval],
299                [mp_sqlite3_dir=/usr/lib/sqlite3])
300
301# If sqlite3 package isn't installed, configure and install sqlite3 package.
302if test "$with_included_sqlite3" = "yes"; then
303        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES sqlite-3.1.3"
304        INCLUDES="$INCLUDES -I../sqlite-3.1.3"
305        AC_CONFIG_SUBDIRS([src/sqlite-3.1.3])
306        # Extract sqlite3 package
307        (cd src/; gzip -d < sqlite-3.1.3.tar.gz | tar xf -)
308        # patch sqlite3 with desired configure options
309        patch -p0 < src/sqlite-3.1.3.diff
310        # the new tclinstaller.tcl needs to have substitution occur
311        mv src/sqlite-3.1.3/tclinstaller.tcl src/sqlite-3.1.3/tclinstaller.tcl.in
312        SQLITE3_LIBS=`pwd`"/src/sqlite-3.1.3/.libs/libsqlite3.a"
313        if test "x$prefix" = "xNONE" ; then
314                SQLITE3_DIR=$ac_default_prefix/share/macports/Tcl/sqlite3
315        else
316                SQLITE3_DIR=$prefix/share/macports/Tcl/sqlite3
317        fi
318else
319        SQLITE3_LIBS="-lsqlite3"
320
321        AC_CACHE_CHECK([for Tcl sqlite3 location], [mp_cv_sqlite3_dir],
322                [mp_cv_sqlite3_dir=
323                test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
324                ])
325
326        SQLITE3_DIR=$mp_cv_sqlite3_dir
327fi
328
329AC_SUBST(SQLITE3_LIBS)
330AC_SUBST(SQLITE3_DIR)
331
332AH_TEMPLATE([TRACE_SDK], [SDK for SDK redirect in tracelib])
333AC_ARG_WITH(
334        trace-sdk,
335        AS_HELP_STRING([--with-trace-sdk=SDK],
336                [SDK for redirection in trace lib (for example MacOSX10.4u.sdk)]),
337        [test -d ${DEVELOPER_DIR}/SDKs/$withval && AC_DEFINE_UNQUOTED([TRACE_SDK], "${withval}")], [])
338
339# Allows building of shared libraries
340SC_ENABLE_SHARED
341
342# Pull compiler / linker values from tclConfig.sh
343LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG}
344LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE}
345SHLIB_LD=${TCL_SHLIB_LD}
346STLIB_LD=${TCL_STLIB_LD}
347SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}
348SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX}
349
350AC_SUBST(INCLUDES)
351AC_SUBST(PATHCONF)
352AC_SUBST(STLIB_LD)
353AC_SUBST(SHLIB_LD)
354AC_SUBST(SHLIB_CFLAGS)
355AC_SUBST(SHLIB_LDFLAGS)
356AC_SUBST(SHLIB_SUFFIX)
357AC_SUBST(TCL_DEFS)
358AC_SUBST(TCL_STUB_LIB_SPEC)
359AC_SUBST(TCL_CC)
360AC_SUBST(OUR_INCLUDED_PACKAGES)
361
362# misc variables that need to be expanded for substitution into tcl
363
364oldprefix=$prefix
365if test "x$prefix" = "xNONE" ; then
366   prefix=$ac_default_prefix
367fi
368
369# Check if there's an existing DP/MP install too old to upgrade
370MP_CHECK_OLDLAYOUT
371
372eval "prefix_expanded=$prefix"
373AC_SUBST(prefix_expanded)
374# do this twice, since there is a nested variable of
375# ${prefix} inside of ${sysconfdir}
376eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
377eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
378AC_SUBST(MPCONFIGDIR_EXPANDED)
379eval "localstatedir_expanded=$localstatedir"
380AC_SUBST(localstatedir_expanded)
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/prefix.mtree
394        doc/macosx.mtree
395        doc/macports.conf
396        portmgr/freebsd/Makefile
397        src/Makefile
398        src/macports1.0/macports_autoconf.tcl
399        src/port1.0/port_autoconf.tcl
400        src/registry1.0/registry_autoconf.tcl
401        src/programs/Makefile
402        src/macports1.0/macports_fastload.tcl
403        setupenv.bash
404])
405
406AC_CONFIG_FILES([src/pkg_mkindex.sh], [chmod +x src/pkg_mkindex.sh])
407
408AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.