source: trunk/base/configure.ac @ 58137

Last change on this file since 58137 was 58137, checked in by toby@…, 9 years ago

base: prefer CommonCrypto, use libmd otherwise. no libcrypto

  • 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 58137 2009-09-22 21:40:23Z toby@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(DITTO, [ditto], [])
95AC_PATH_PROG(DSCL, [dscl], [])
96AC_PATH_PROG(FILE, [file], [])
97AC_PATH_PROG(CVS, [cvs], [])
98AC_PATH_PROG(SVN, [svn], [])
99AC_PATH_PROG(GIT, [git], [])
100AC_PATH_PROG(HG, [hg], [])
101AC_PATH_PROG(GZIP, [gzip], [])
102AC_PATH_PROG(LIPO, [lipo], [])
103AC_PATH_PROG(NICE, [nice], [])
104AC_PATH_PROG(PATCH, [patch], [])
105AC_PATH_PROG(RMDIR, [rmdir], [])
106AC_PATH_PROG(RSYNC, [rsync], [])
107AC_PATH_PROG(SED, [sed])
108AC_PATH_PROG(TAR, [tar])
109AC_PATH_PROG(UNZIP, [unzip])
110AC_PATH_PROG(ZIP, [zip])
111AC_PATH_PROGS(BSDMAKE, [bsdmake pmake], [])
112AC_PATH_PROG(MAKE, [make])
113AC_PATH_PROG(HDIUTIL, [hdiutil], [])
114AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
115AC_PATH_PROG(LAUNCHCTL, [launchctl], [])
116AC_PATH_PROG(XCODEBUILD, [xcodebuild], [])
117AC_PATH_PROGS(GNUTAR, [gnutar gtar], [], [$PATH:/usr/local/bin])
118AC_PATH_PROGS(GNUMAKE, [gnumake gmake], [], [$PATH:/usr/local/bin])
119AC_PATH_PROGS(GNUPATCH, [gnupatch gpatch], [], [$PATH:/usr/local/bin])
120AC_PATH_PROG(BZIP2, [bzip2], [])
121AC_PATH_PROG(LSBOM, [lsbom], [])
122AC_PATH_PROG(MKBOM, [mkbom], [])
123AC_PATH_PROG(PAX, [pax], [])
124AC_PATH_PROG(XAR, [xar], [])
125AC_PATH_PROG(OPEN, [open], [])
126
127# Define some precious variables allowing user to override PATH for some programs
128AC_ARG_VAR(MTREE, [path to mtree command])
129AC_ARG_VAR(CVS, [path to cvs command])
130AC_ARG_VAR(SVN, [path to svn command])
131AC_ARG_VAR(RSYNC, [path to rsync command])
132AC_ARG_VAR(SED, [path to sed command])
133AC_ARG_VAR(TAR, [path to tar command])
134AC_ARG_VAR(MAKE, [path to make command])
135AC_ARG_VAR(GNUTAR, [path to gnutar command])
136AC_ARG_VAR(BSDMAKE, [path to bsdmake/pmake command])
137AC_ARG_VAR(GNUMAKE, [path to gnumake command])
138AC_ARG_VAR(BZIP2, [path to bzip2 command])
139AC_ARG_VAR(XAR, [path to xar command])
140AC_ARG_VAR(OPEN, [path to open command])
141
142MP_SED_EXTENDED_REGEXP
143MP_TAR_NO_SAME_OWNER
144MP_PATCH_GNU_VERSION
145
146# Quiche eaters options.
147if test x$GCC = xyes; then
148        CFLAGS_QUICHEEATERS='-W -Wall -pedantic'
149fi
150AC_SUBST(CFLAGS_QUICHEEATERS)
151MP_WERROR
152
153MP_COMPILER_ATTRIBUTE_UNUSED
154MP_COMPILER_ATTRIBUTE_LF_PRIVATE
155
156# Foundation checks
157ACX_PTHREAD
158MP_OBJC_RUNTIME
159MP_OBJC_FOUNDATION
160
161MP_PROG_DAEMONDO
162
163AC_SUBST(EXTRA_PROGS)
164
165# set default ports-directory
166PORTS_DIR_DEFAULT=`pwd | sed -e "s/base/ports/"`
167
168# Check for paths
169AC_PREFIX_DEFAULT(/opt/local)
170if test x$prefix = x/usr/local; then
171    AC_MSG_ERROR([Installing MacPorts into /usr/local is not supported])
172fi
173MP_PATH_PORTSDIR([$PORTS_DIR_DEFAULT])
174MP_PATH_MPCONFIGDIR
175
176# Check whether to install without root privileges
177MP_CHECK_NOROOTPRIVILEGES
178
179# Check for install ownership
180MP_CHECK_INSTALLUSER
181MP_CHECK_INSTALLGROUP
182MP_CHECK_RUNUSER
183MP_DIRECTORY_MODE
184MP_SHARED_DIRECTORY
185
186# Check for default directories
187MP_PATH_APPLICATIONS
188MP_PATH_FRAMEWORKS
189
190# Check for universal options
191MP_UNIVERSAL_OPTIONS
192
193# Check for standard header files.
194AC_HEADER_STDC
195AC_HEADER_DIRENT
196AC_HEADER_SYS_WAIT
197AC_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 \
198        readline/readline.h readline/history.h pwd.h sys/paths.h utime.h])
199
200INCLUDES="-I.. -I. $INCLUDES"
201
202# Checks for library functions.
203AC_CHECK_FUNCS([bzero memset fgetln lockf flock setmode strcasecmp strncasecmp strlcpy copyfile clearenv])
204MP_CHECK_READLINK_IS_P1003_1A
205
206# Check for md5 implementation
207AC_CHECK_HEADER([CommonCrypto/CommonDigest.h], [AC_DEFINE([HAVE_COMMONCRYPTO_COMMONDIGEST_H], [1], [Define if CommonCrypto is available.])], [MP_LIB_MD5])
208
209# Check for readline
210AC_ARG_ENABLE(readline, AS_HELP_STRING([--enable-readline],[Enable addition of readline support, if readline present.]),
211[
212        AC_CHECK_LIB([readline], [readline], [
213                                  READLINE_LIBS=-lreadline
214                                  AC_DEFINE([HAVE_LIBREADLINE], [1], [Define to 1 if you have the `readline' library (-lreadline).])
215                                  ])
216        AC_CHECK_DECLS([rl_username_completion_function,rl_filename_completion_function,rl_completion_matches,username_completion_function,filename_completion_function,completion_matches], [], [],
217        [
218        #include <stdio.h>
219        #if HAVE_READLINE_READLINE_H
220        # include <readline/readline.h>
221        #endif
222        ])
223])
224AC_SUBST(READLINE_LIBS)
225
226# Lowest non-system-reserved uid and gid (Apple claims <500)
227AC_DEFINE([MIN_USABLE_UID], [500], [Lowest non-system-reserved UID.])
228AC_DEFINE([MIN_USABLE_GID], [500], [Lowest non-system-reserved GID.])
229
230# Load tclConfig.sh
231SC_PATH_TCLCONFIG
232SC_LOAD_TCLCONFIG
233
234# Check for Tcl public headers
235dnl XXX  hardwire CYGPATH (CYGPATH must be set for SC_PUBLIC_TCL_HEADERS)
236CYGPATH=echo
237SC_PUBLIC_TCL_HEADERS
238
239# Check for tclsh binary
240MP_PROG_TCLSH
241
242# Check for Tcl package path
243MP_TCL_PACKAGE_DIR
244
245# Check if thread is enabled.
246MP_TCL_THREAD_SUPPORT
247
248## libcurl
249MP_LIBCURL_FLAGS
250
251# Determine if we need to install some bundled packages
252OUR_INCLUDED_PACKAGES=
253
254## Thread package.
255AC_ARG_WITH(
256                included-tclthread,
257                AS_HELP_STRING([--with-included-tclthread],
258                        [install included Thread package.]),
259                [with_included_tclthread=$withval],
260                [with_included_tclthread="unspecified"])
261
262# Check if thread package is already installed.
263if test "x$with_included_tclthread" = "xunspecified" ; then
264        MP_TCL_PACKAGE(
265                [Thread],
266                [AC_MSG_RESULT([yes]); with_included_tclthread=no],
267                [AC_MSG_RESULT([no]); with_included_tclthread=yes])
268fi
269
270# If thread package isn't installed, configure and install thread package.
271if test "$with_included_tclthread" = "yes"; then
272        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
273        AC_CONFIG_SUBDIRS([src/thread2.6])
274        # Extract thread package
275        (cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
276        # Patch thread package (so thread2.6 is the vanilla distribution directory)
277        patch -p0 < src/thread2.6.diff
278fi
279
280## sqlite3 package.
281AC_ARG_WITH(
282                included-sqlite3,
283                AS_HELP_STRING([--with-included-sqlite3],
284                        [build using bundled sqlite3 package]),
285                [with_included_sqlite3=$withval],
286                [with_included_sqlite3="unspecified"])
287
288# Check if sqlite3 package is already installed.
289if test "x$with_included_sqlite3" = "xunspecified" ; then
290        AC_CHECK_LIB([sqlite3],[sqlite3_open],
291                [with_included_sqlite3=no],
292                [with_included_sqlite3=yes])
293fi
294
295AC_ARG_WITH(
296                tcl-sqlite3,
297                AS_HELP_STRING([--with-tcl-sqlite3=DIR],
298                        [directory for Tcl sqlite3 (default /usr/lib/sqlite3)]),
299                [mp_sqlite3_dir=$withval],
300                [mp_sqlite3_dir=/usr/lib/sqlite3])
301
302# If sqlite3 package isn't installed, configure and install sqlite3 package.
303if test "$with_included_sqlite3" = "yes"; then
304        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES sqlite-3.1.3"
305        INCLUDES="$INCLUDES -I../sqlite-3.1.3"
306        AC_CONFIG_SUBDIRS([src/sqlite-3.1.3])
307        # Extract sqlite3 package
308        (cd src/; gzip -d < sqlite-3.1.3.tar.gz | tar xf -)
309        # patch sqlite3 with desired configure options
310        patch -p0 < src/sqlite-3.1.3.diff
311        # the new tclinstaller.tcl needs to have substitution occur
312        mv src/sqlite-3.1.3/tclinstaller.tcl src/sqlite-3.1.3/tclinstaller.tcl.in
313        SQLITE3_LIBS=`pwd`"/src/sqlite-3.1.3/.libs/libsqlite3.a"
314        if test "x$prefix" = "xNONE" ; then
315                SQLITE3_DIR=$ac_default_prefix/share/macports/Tcl/sqlite3
316        else
317                SQLITE3_DIR=$prefix/share/macports/Tcl/sqlite3
318        fi
319else
320        SQLITE3_LIBS="-lsqlite3"
321
322        AC_CACHE_CHECK([for Tcl sqlite3 location], [mp_cv_sqlite3_dir],
323                [mp_cv_sqlite3_dir=
324                test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
325                ])
326
327        SQLITE3_DIR=$mp_cv_sqlite3_dir
328fi
329
330AC_SUBST(SQLITE3_LIBS)
331AC_SUBST(SQLITE3_DIR)
332
333AH_TEMPLATE([TRACE_SDK], [SDK for SDK redirect in tracelib])
334AC_ARG_WITH(
335        trace-sdk,
336        AS_HELP_STRING([--with-trace-sdk=SDK],
337                [SDK for redirection in trace lib (for example MacOSX10.4u.sdk)]),
338        [test -d ${DEVELOPER_DIR}/SDKs/$withval && AC_DEFINE_UNQUOTED([TRACE_SDK], "${withval}")], [])
339
340# Allows building of shared libraries
341SC_ENABLE_SHARED
342
343# Pull compiler / linker values from tclConfig.sh
344LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG}
345LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE}
346SHLIB_LD=${TCL_SHLIB_LD}
347STLIB_LD=${TCL_STLIB_LD}
348SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}
349SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX}
350
351AC_SUBST(INCLUDES)
352AC_SUBST(PATHCONF)
353AC_SUBST(STLIB_LD)
354AC_SUBST(SHLIB_LD)
355AC_SUBST(SHLIB_CFLAGS)
356AC_SUBST(SHLIB_LDFLAGS)
357AC_SUBST(SHLIB_SUFFIX)
358AC_SUBST(TCL_DEFS)
359AC_SUBST(TCL_STUB_LIB_SPEC)
360AC_SUBST(TCL_CC)
361AC_SUBST(OUR_INCLUDED_PACKAGES)
362
363# misc variables that need to be expanded for substitution into tcl
364
365oldprefix=$prefix
366if test "x$prefix" = "xNONE" ; then
367   prefix=$ac_default_prefix
368fi
369
370# Check if there's an existing DP/MP install too old to upgrade
371MP_CHECK_OLDLAYOUT
372
373eval "prefix_expanded=$prefix"
374AC_SUBST(prefix_expanded)
375# do this twice, since there is a nested variable of
376# ${prefix} inside of ${sysconfdir}
377eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
378eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
379AC_SUBST(MPCONFIGDIR_EXPANDED)
380eval "localstatedir_expanded=$localstatedir"
381AC_SUBST(localstatedir_expanded)
382
383prefix=$oldprefix
384
385dnl man page settings (compressed, links, etc)
386dnl
387dnl SC_CONFIG_MANPAGES
388
389# Output
390AC_CONFIG_FILES([
391        Doxyfile
392        Makefile
393        Mk/macports.autoconf.mk
394        doc/prefix.mtree
395        doc/macosx.mtree
396        doc/macports.conf
397        portmgr/freebsd/Makefile
398        src/Makefile
399        src/macports1.0/macports_autoconf.tcl
400        src/port1.0/port_autoconf.tcl
401        src/registry1.0/registry_autoconf.tcl
402        src/programs/Makefile
403        src/macports1.0/macports_fastload.tcl
404        setupenv.bash
405])
406
407AC_CONFIG_FILES([src/pkg_mkindex.sh], [chmod +x src/pkg_mkindex.sh])
408
409AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.