source: trunk/base/configure.ac @ 84088

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

split -pedantic into a separate variable so it can be turned off individually, and use -Wextra instead of -W

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