forked from macports/macports-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
447 lines (395 loc) · 13.9 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.63)
AC_DEFUN([MACPORTS_VERSION_MACRO], [esyscmd(<config/macports_version tr -d '\n')])
AC_INIT([MacPorts],MACPORTS_VERSION_MACRO,[[email protected]],[macports])
AC_CONFIG_SRCDIR([src/pextlib1.0/Pextlib.c])
AC_CONFIG_HEADERS([src/config.h])
AC_CANONICAL_TARGET
# Read in the MacPorts version from the base/config/macports_version file
AC_MSG_CHECKING(MacPorts version)
MACPORTS_VERSION=MACPORTS_VERSION_MACRO
AC_MSG_RESULT([$MACPORTS_VERSION])
AC_SUBST(MACPORTS_VERSION)
# Check user PATH for MP paths, and remove as necessary.
MP_PATH_SCAN
MP_FLAGS_SCAN
AC_PATH_PROG(SW_VERS, sw_vers)
AC_PATH_PROG(DEFAULTS, defaults)
AC_PATH_PROG(XCODE_SELECT, xcode-select)
if test "x$SW_VERS" != "x"; then
AC_MSG_CHECKING(Mac OS X version)
MACOSX_VERSION=`$SW_VERS -productVersion`
AC_MSG_RESULT([$MACOSX_VERSION])
fi
case "$MACOSX_VERSION" in
10.0*|10.1|10.1.*|10.2*|10.3*)
AC_MSG_ERROR([This version of Mac OS X is not supported
Please upgrade at http://store.apple.com/])
;;
10.4.[[0-9]]|10.4.10|10.5.[[0-7]]|10.6.[[0-7]]|10.7.[[0-4]]|10.8.[[0-4]]|10.9.[[0-4]]|10.10.[[0-4]]|10.11.[[0-5]]|10.12.[[0-5]])
AC_MSG_WARN([This version of Mac OS X is out of date])
AC_MSG_WARN([Please run Software Update to update it])
;;
10.4*|10.5*|10.6*|10.7*|10.8*|10.9*|10.10*|10.11*|10.12*|10.13*)
dnl Supported version
;;
*)
;;
esac
# locate currently selected Xcode path
AC_MSG_CHECKING(Xcode location)
if test "x$XCODE_SELECT" != "x"; then
DEVELOPER_DIR=`$XCODE_SELECT -print-path`
fi
if test -z "$DEVELOPER_DIR" -o ! -d "$DEVELOPER_DIR" ; then
if test -d /Applications/Xcode.app/Contents/Developer ; then
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
else
DEVELOPER_DIR=/Developer
fi
fi
AC_MSG_RESULT([$DEVELOPER_DIR])
AC_SUBST(DEVELOPER_DIR)
case "$DEVELOPER_DIR" in
*Xcode.app/Contents/Developer)
XCODEPLIST_BASE=`dirname $DEVELOPER_DIR`/version
;;
*)
XCODEPLIST_BASE=$DEVELOPER_DIR/Applications/Xcode.app/Contents/version
;;
esac
XCODEPLIST=${XCODEPLIST_BASE}.plist
if test -r "$XCODEPLIST"; then
AC_MSG_CHECKING(Xcode version)
if test "x$DEFAULTS" != "x"; then
XCODE_VERSION=`$DEFAULTS read $XCODEPLIST_BASE CFBundleShortVersionString`
else
XCODE_VERSION=`tr -d '\r\n' < $XCODEPLIST | sed -e 's/.*<key>CFBundleShortVersionString<\/key>.<string>\([[0-9.]]*\)<\/string>.*/\1/'`
fi
AC_MSG_RESULT([$XCODE_VERSION])
fi
case "$XCODE_VERSION" in
1.*|2.[[0-1]]*)
AC_MSG_WARN([This version of Xcode Tools is not supported])
AC_MSG_WARN([Please upgrade at https://developer.apple.com/downloads/])
;;
2.[[2-3]]*|3.[[0]]*)
AC_MSG_WARN([This version of Xcode Tools is out of date])
AC_MSG_WARN([Please consider upgrading as some ports fail compiling])
;;
2.*|3.*|4.*|5.*|6.*|7.*|8.*|9.*)
dnl Supported version
;;
*)
;;
esac
# Checks for programs.
AC_PROG_CC([clang cc gcc])
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_OBJC([clang cc gcc])
# Check for user-supplied paths before searching
dnl Beware of conflicts between the variables you set and any tools executed in
dnl the configure context. Some tools interpret an environment variable with
dnl their own name as default flags and will fail if it is set to a path. For
dnl example, these include BZIP2 and GZIP, which is the reason why they are
dnl named with a _BIN suffix here.
MP_TOOL_PATH(BSDMAKE, [bsdmake/pmake])
MP_TOOL_PATH(BZIP2_BIN, [bzip2])
MP_TOOL_PATH(CVS, [cvs])
MP_TOOL_PATH(GNUMAKE, [gnumake])
MP_TOOL_PATH(GNUTAR, [gnutar])
MP_TOOL_PATH(LZMA, [lzma])
MP_TOOL_PATH(MAKE, [make])
MP_TOOL_PATH(MTREE, [mtree])
MP_TOOL_PATH(OPEN, [open])
MP_TOOL_PATH(OPENSSL, [openssl])
MP_TOOL_PATH(RSYNC, [rsync])
MP_TOOL_PATH(SED, [sed])
MP_TOOL_PATH(SVN, [svn])
MP_TOOL_PATH(SWIG, [swig])
MP_TOOL_PATH(TAR, [tar])
MP_TOOL_PATH(XAR, [xar])
MP_TOOL_PATH(XZ, [xz])
# Search for tool paths. Any set above (via --with-pkg=PATH) will be retained
AC_PATH_PROGS(BSDMAKE, [bsdmake pmake], [])
AC_PATH_PROG(BZIP2_BIN, [bzip2], [])
AC_PATH_PROG(BZR, [bzr], [])
AC_PATH_PROG(CHOWN, [chown], [], [$PATH:/usr/sbin])
AC_PATH_PROG(CP, [cp], [])
AC_PATH_PROG(CPIO, [cpio], [])
AC_PATH_PROG(CVS, [cvs], [])
AC_PATH_PROG(DIFF, [diff], [])
AC_PATH_PROG(DSCL, [dscl], [])
AC_PATH_PROG(DSEDITGROUP, [dseditgroup], [], [$PATH:/usr/sbin])
AC_PATH_PROG(FILE, [file], [])
AC_PATH_PROG(FIND, [find], [])
AC_PATH_PROG(GIT, [git], [])
AC_PATH_PROGS(GNUMAKE, [gnumake gmake], [])
AC_PATH_PROGS(GNUPATCH, [gnupatch gpatch], [])
AC_PATH_PROGS(GNUTAR, [gnutar gtar], [])
AC_PATH_PROG(GZIP_BIN, [gzip], [])
AC_PATH_PROG(HDIUTIL, [hdiutil], [])
AC_PATH_PROG(HG, [hg], [])
AC_PATH_PROG(LAUNCHCTL, [launchctl], [])
AC_PATH_PROG(LIPO, [lipo], [])
AC_PATH_PROG(LSBOM, [lsbom], [])
AC_PATH_PROG(LZMA, [lzma], [])
AC_PATH_PROG(MAKE, [make])
AC_PATH_PROG(MAN, [man])
AC_PATH_PROG(MDFIND, [mdfind], [])
AC_PATH_PROG(MDLS, [mdls], [])
AC_PATH_PROG(MKBOM, [mkbom], [])
AC_PATH_PROGS(MTREE, [mtree fmtree], [], [$PATH:/usr/sbin])
AC_PATH_PROG(OPEN, [open], [])
AC_PATH_PROG(OPENSSL, [openssl], [])
AC_PATH_PROG(PATCH, [patch], [])
AC_PATH_PROG(PAX, [pax], [])
AC_PATH_PROG(RMDIR, [rmdir], [])
AC_PATH_PROG(RSYNC, [rsync], [])
AC_PATH_PROG(SANDBOX_EXEC, [sandbox-exec], [], [/usr/bin])
AC_PATH_PROG(SED, [sed])
AC_PATH_PROG(SVN, [svn], [])
AC_PATH_PROG(SWIG, [swig], [])
AC_PATH_PROG(TAR, [tar])
AC_PATH_PROG(UNZIP, [unzip])
AC_PATH_PROG(XAR, [xar], [])
AC_PATH_PROG(XCODEBUILD, [xcodebuild], [])
AC_PATH_PROG(XCRUN, [xcrun], [])
AC_PATH_PROG(XZ, [xz], [])
AC_PATH_PROG(ZIP, [zip])
if test "x$MTREE" = "x"; then
AC_MSG_ERROR([mtree not found])
fi
MP_TAR_FAST_READ
MP_TAR_NO_SAME_OWNER
MP_PATCH_GNU_VERSION
# Quiche eaters options.
if test x$GCC = xyes; then
CFLAGS_QUICHEEATERS='-Wextra -Wall'
CFLAGS_PEDANTIC='-pedantic'
fi
AC_SUBST(CFLAGS_QUICHEEATERS)
AC_SUBST(CFLAGS_PEDANTIC)
MP_WERROR
MP_COMPILER_ATTRIBUTE_UNUSED
MP_PROG_DAEMONDO
AC_SUBST(EXTRA_PROGS)
# Check for paths
AC_PREFIX_DEFAULT(/opt/local)
AC_ARG_WITH(
unsupported-prefix,
AS_HELP_STRING([--with-unsupported-prefix],
[acknowledge that you accept the consequences of using an unsupported prefix]),
[with_unsupported_prefix=$withval],
[with_unsupported_prefix=no])
if test x$prefix = x/usr/local -o x$prefix = x/usr && test x$with_unsupported_prefix != xyes; then
AC_MSG_ERROR([Installing MacPorts into $prefix is not supported. If \
you understand this and wish to do so anyway, pass --with-unsupported-prefix \
to configure.])
fi
MP_PATH_MPCONFIGDIR
# Check whether to install without root privileges
MP_CHECK_NOROOTPRIVILEGES
# Check for install ownership
MP_CHECK_INSTALLUSER
MP_CHECK_INSTALLGROUP
MP_CHECK_RUNUSER
MP_DIRECTORY_MODE
MP_SHARED_DIRECTORY
# Check for default directories
MP_PATH_APPLICATIONS
MP_PATH_FRAMEWORKS
MP_CHECK_STARTUPITEMS
# Check for universal options
MP_UNIVERSAL_OPTIONS
# Check for standard header files.
AC_CHECK_HEADERS([crt_externs.h err.h fcntl.h libkern/OSAtomic.h libproc.h limits.h paths.h pwd.h \
readline/history.h readline/readline.h stdatomic.h spawn.h sys/cdefs.h sys/event.h \
sys/fcntl.h sys/file.h sys/paths.h sys/socket.h sys/sysctl.h utime.h])
# Checks for library functions.
AC_CHECK_FUNCS([OSAtomicCompareAndSwap32 OSAtomicCompareAndSwap64 \
OSAtomicCompareAndSwapPtr __getdirentries64 clearenv copyfile \
flock fls kqueue posix_spawn setmode \
sysctlbyname])
# Check for library functions, replacements are in pextlib1.0/compat/
AC_CHECK_FUNCS([getline getdelim strlcat strlcpy])
AC_SUBST(HAVE_GETDELIM, $ac_cv_func_getdelim)
AC_SUBST(HAVE_GETLINE, $ac_cv_func_getline)
AC_SUBST(HAVE_STRLCAT, $ac_cv_func_strlcat)
AC_SUBST(HAVE_STRLCPY, $ac_cv_func_strlcpy)
AC_CHECK_DECLS([atomic_compare_exchange_strong_explicit], [], [], [[#include <stdatomic.h>]])
# Check for md5 implementation
AC_CHECK_HEADER([CommonCrypto/CommonDigest.h], [AC_DEFINE([HAVE_COMMONCRYPTO_COMMONDIGEST_H], [1], [Define if CommonCrypto is available.])], [MP_LIB_MD5])
# Check for readline
AC_ARG_ENABLE(readline, AS_HELP_STRING([--enable-readline],[enable readline support, if readline present]),
[
AC_CHECK_LIB([readline], [readline], [
READLINE_LIBS=-lreadline
AC_DEFINE([HAVE_LIBREADLINE], [1], [Define to 1 if you have the 'readline' library (-lreadline).])
])
AC_CHECK_DECLS([rl_username_completion_function,rl_filename_completion_function,rl_completion_matches,username_completion_function,filename_completion_function,completion_matches], [], [],
[
#include <stdio.h>
#if HAVE_READLINE_READLINE_H
# include <readline/readline.h>
#endif
])
])
AC_SUBST(READLINE_LIBS)
# Lowest non-system-reserved uid and gid (Apple claims <500)
AC_DEFINE([MIN_USABLE_UID], [500], [Lowest non-system-reserved UID.])
AC_DEFINE([MIN_USABLE_GID], [500], [Lowest non-system-reserved GID.])
# Substitute platform for base compatibility check
MP_PLATFORM
## libcurl
MP_LIBCURL_FLAGS
## sqlite3
MP_SQLITE3_FLAGS
MP_CHECK_SQLITE_VERSION(3003011)
if test "x${mp_sqlite_version_ge_3003011}" = "xno"; then
AC_DEFINE([sqlite3_prepare_v2], [sqlite3_prepare], [define sqlite3_prepare to sqlite_prepare_v2 if the latter is not available])
fi
# check whether trace mode is supported on this platform
MP_TRACEMODE_SUPPORT
# misc variables that need to be expanded for substitution into tcl
oldprefix=$prefix
oldexec_prefix=$exec_prefix
if test "x$prefix" = "xNONE" ; then
prefix=$ac_default_prefix
fi
if test "x$exec_prefix" = "xNONE" ; then
exec_prefix=$prefix
fi
eval "prefix_expanded=$prefix"
eval "exec_prefix_expanded=$exec_prefix"
AC_SUBST(prefix_expanded)
# Define a path where our trace mode workaround for SIP-protected binaries on
# >= 10.11 puts copies
eval DARWINTRACE_SIP_WORKAROUND_PATH="${prefix}/var/macports/sip-workaround"
AC_SUBST(DARWINTRACE_SIP_WORKAROUND_PATH)
AC_DEFINE_UNQUOTED(
[DARWINTRACE_SIP_WORKAROUND_PATH],
["$DARWINTRACE_SIP_WORKAROUND_PATH"],
[Absolute path to a directory used by darwintrace to copy SIP-protected files before executing])
# do this twice, since there is a nested variable of
# ${prefix} inside of ${sysconfdir}
eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
AC_SUBST(MPCONFIGDIR_EXPANDED)
eval "localstatedir_expanded=$localstatedir"
AC_SUBST(localstatedir_expanded)
# Compute the libexec dir for the vendor packages
eval "macports_libexec_dir=${libexecdir}/macports"
eval "macports_libexec_dir=$macports_libexec_dir"
prefix=$oldprefix
exec_prefix=$oldexec_prefix
## Tcl package
MP_CONFIG_SUBDIR([vendor/tcl/unix], [--prefix=${macports_libexec_dir} --enable-threads])
VENDOR_TCL_SUBDIR=tcl/unix
VENDOR_TCL_INSTALL="install-binaries install-libraries"
AC_SUBST(VENDOR_TCL_SUBDIR)
AC_SUBST(VENDOR_TCL_INSTALL)
# Set up some variables needed by MacPorts' Tcl setup
VENDOR_DESTROOT=vendor/vendor-destroot
AC_SUBST(VENDOR_DESTROOT)
## Tcl Thread package
# Tcl supports Threads internally, but to use threads from Tcl code we need
# this package
MP_CONFIG_SUBDIR([vendor/thread], [--prefix=${macports_libexec_dir}])
VENDOR_TCLTHREAD_SUBDIR=thread
VENDOR_TCLTHREAD_INSTALL="install-binaries install-libraries"
AC_SUBST(VENDOR_TCLTHREAD_SUBDIR)
AC_SUBST(VENDOR_TCLTHREAD_INSTALL)
## TclX package
# TclX is required for signal handling
MP_CONFIG_SUBDIR([vendor/tclx], [--prefix=${macports_libexec_dir}])
VENDOR_TCLX_SUBDIR=tclx
VENDOR_TCLX_INSTALL="install-binaries install-libraries"
AC_SUBST(VENDOR_TCLX_SUBDIR)
AC_SUBST(VENDOR_TCLX_INSTALL)
## Tcllib package
# Note that Tcllib needs a Tcl interpreter during installation; it will *not*
# be the one we configure above, because that one isn't built yet. That's not
# a problem, though -- it's only used during installation.
MP_CONFIG_SUBDIR([vendor/tcllib], [--prefix=${macports_libexec_dir}])
VENDOR_TCLLIB_SUBDIR=tcllib
VENDOR_TCLLIB_INSTALL="install-libraries"
AC_SUBST(VENDOR_TCLLIB_SUBDIR)
AC_SUBST(VENDOR_TCLLIB_INSTALL)
# Load tclConfig.sh from our private install of Tcl
AC_MSG_CHECKING([for Tcl configuration])
TCL_BIN_DIR=`(cd vendor/tcl${tcl_version}/unix; pwd)`
AC_MSG_RESULT([found $TCL_BIN_DIR/tclConfig.sh])
SC_LOAD_TCLCONFIG
SC_ENABLE_SHARED
# Pull compiler/linker values from tclConfig.sh
SHLIB_LD=${TCL_SHLIB_LD}
STLIB_LD=${TCL_STLIB_LD}
SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}
SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX}
TCLSH=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION}
INTREE_TCLSH=`(cd vendor; pwd)`/tclsh
# strip possible whitespace at the end of TCL_PACKAGE_PATH
eval "TCL_PACKAGE_PATH=${TCL_PACKAGE_PATH}"
AC_SUBST(SHLIB_LD)
AC_SUBST(STLIB_LD)
AC_SUBST(SHLIB_CFLAGS)
AC_SUBST(SHLIB_SUFFIX)
AC_SUBST(TCL_PREFIX)
AC_SUBST(TCL_VERSION)
AC_SUBST(TCL_PACKAGE_PATH)
AC_SUBST(TCL_STUB_LIB_SPEC)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TCL_BIN_DIR)
AC_SUBST(TCLSH)
AC_SUBST(INTREE_TCLSH)
INCLUDES="-I.. -I. $INCLUDES"
AC_SUBST(INCLUDES)
# Check if there's an existing DP/MP install too old to upgrade
MP_CHECK_OLDLAYOUT
# Output
AC_CONFIG_FILES([
Doxyfile
Makefile
Mk/macports.autoconf.mk
doc/Makefile
doc/base.mtree
doc/macosx.mtree
doc/macports.conf
doc/prefix.mtree
doc/pubkeys.conf
portmgr/dmg/postflight
setupenv.bash
src/Makefile
src/cregistry/Makefile
src/compat/Makefile
src/darwintracelib1.0/Makefile
src/machista1.0/Makefile
src/macports1.0/Makefile
src/macports1.0/macports_autoconf.tcl
src/macports1.0/macports_test_autoconf.tcl
src/mpcommon1.0/Makefile
src/package1.0/Makefile
src/package1.0/package_test_autoconf.tcl
src/pextlib1.0/Makefile
src/port/Makefile
src/port1.0/Makefile
src/port1.0/port_autoconf.tcl
src/port1.0/port_test_autoconf.tcl
src/programs/Makefile
src/registry2.0/Makefile
src/registry2.0/registry_autoconf.tcl
tests/Makefile
tests/test.tcl
tests/test/library.tcl
tests/test/trace/test.tcl
vendor/Makefile
])
AC_CONFIG_FILES([vendor/tclsh], [chmod +x vendor/tclsh])
AC_CONFIG_FILES([src/dedup_portfiles.tcl], [chmod +x src/dedup_portfiles.tcl])
AC_CONFIG_FILES([src/images_to_archives.tcl], [chmod +x src/images_to_archives.tcl])
AC_CONFIG_FILES([src/pkg_mkindex.sh], [chmod +x src/pkg_mkindex.sh])
AC_CONFIG_FILES([src/upgrade_sources_conf_default.tcl], [chmod +x src/upgrade_sources_conf_default.tcl])
AC_OUTPUT