source: trunk/base/configure.ac @ 50558

Last change on this file since 50558 was 49072, checked in by toby@…, 12 years ago

typo

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.5 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2dnl $Id: configure.ac 49072 2009-04-03 02:06:33Z toby@macports.org $
3AC_PREREQ(2.52)
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])
8AC_CANONICAL_SYSTEM
9
10# Read in the MacPorts version from the base/config/macports_version file
11AC_MSG_CHECKING(MacPorts version)
12MACPORTS_VERSION=MACPORTS_VERSION_MACRO
13AC_MSG_RESULT([$MACPORTS_VERSION])
14AC_SUBST(MACPORTS_VERSION)
15
16# Check user PATH for MP paths, and remove as necessary.
17MP_PATH_SCAN
18
19AC_CHECK_PROGS(SW_VERS, sw_vers)
20if test "x$SW_VERS" != "x"; then
21  AC_MSG_CHECKING(Mac OS X version)
22  MACOSX_VERSION=`$SW_VERS -productVersion`
23  AC_MSG_RESULT([$MACOSX_VERSION])
24fi
25
26case "$MACOSX_VERSION" in
27  10.0*|10.1*|10.2*)
28    AC_WARN(This version of Mac OS X is not supported)
29    AC_WARN(Please upgrade at http://store.apple.com/)
30    ;;
31  10.1.[[0-4]]|10.2.[[0-7]]|10.3.[[0-8]]|10.4.[[0-9]]|10.4.10|10.5.[[0-4]])
32    AC_WARN(This version of Mac OS X is out of date)
33    AC_WARN(Please run Software Update to update it)
34    ;;
35  10.3*|10.4*|10.5*)
36    dnl Supported version
37    ;;
38  *)
39    ;;
40esac
41
42XCODEPLIST=/Developer/Applications/Xcode.app/Contents/version.plist
43if test -r "$XCODEPLIST"; then
44  AC_MSG_CHECKING(Xcode version)
45  XCODE_VERSION=`tr -d '\r\n' < $XCODEPLIST | sed -e 's/.*<key>CFBundleShortVersionString<\/key>.<string>\([[0-9.]]*\)<\/string>.*/\1/'`
46  AC_MSG_RESULT([$XCODE_VERSION])
47fi
48
49case "$XCODE_VERSION" in
50  1.[[0-1]]*|2.[[0-1]]*)
51    AC_WARN(This version of Xcode Tools is not supported)
52    AC_WARN(Please upgrade at http://connect.apple.com/)
53    ;;
54  1.[[2-4]]*|2.[[2-3]]*)
55    AC_WARN(This version of Xcode Tools is out of date)
56    AC_WARN(Please consider upgrading as some ports fail compiling)
57    ;;
58  1.5*|2.4*|3.*)
59    dnl Supported version
60    ;;
61  *)
62    ;;
63esac
64
65# Checks for programs.
66AC_PROG_CC
67AC_PROG_OBJC
68AC_PROG_INSTALL
69AC_PROG_MAKE_SET
70AC_PROG_LN_S
71AC_PATH_PROG(MTREE, [mtree], [], [$PATH:/usr/sbin])
72AC_PATH_PROG(CVS, [cvs], [])
73AC_PATH_PROG(SVN, [svn], [])
74AC_PATH_PROG(GIT, [git], [])
75AC_PATH_PROG(RSYNC, [rsync], [])
76AC_PATH_PROG(SED, [sed])
77AC_PATH_PROG(TAR, [tar])
78AC_PATH_PROG(MAKE, [make])
79AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
80AC_PATH_PROG(LAUNCHCTL, [launchctl], [])
81AC_PATH_PROG(XCODEBUILD, [xcodebuild], [])
82AC_PATH_PROGS(GNUTAR, [gnutar gtar], [], [$PATH:/usr/local/bin])
83AC_PATH_PROGS(GNUMAKE, [gnumake gmake], [], [$PATH:/usr/local/bin])
84AC_PATH_PROG(BZIP2, [bzip2], [])
85AC_PATH_PROG(XAR, [xar], [])
86AC_PATH_PROG(OPEN, [open], [])
87
88# Define some precious variables allowing user to override PATH for some programs
89AC_ARG_VAR(MTREE, [path to mtree command])
90AC_ARG_VAR(CVS, [path to cvs command])
91AC_ARG_VAR(SVN, [path to svn command])
92AC_ARG_VAR(RSYNC, [path to rsync command])
93AC_ARG_VAR(SED, [path to sed command])
94AC_ARG_VAR(TAR, [path to tar command])
95AC_ARG_VAR(MAKE, [path to make command])
96AC_ARG_VAR(GNUTAR, [path to gnutar command])
97AC_ARG_VAR(GNUMAKE, [path to gnumake command])
98AC_ARG_VAR(BZIP2, [path to bzip2 command])
99AC_ARG_VAR(XAR, [path to xar command])
100AC_ARG_VAR(OPEN, [path to open command])
101
102MP_SED_EXTENDED_REGEXP
103MP_TAR_NO_SAME_OWNER
104
105# Quiche eaters options.
106if test x$GCC = xyes; then
107        CFLAGS_QUICHEEATERS='-W -Wall -pedantic'
108fi
109AC_SUBST(CFLAGS_QUICHEEATERS)
110MP_WERROR
111
112MP_COMPILER_ATTRIBUTE_UNUSED
113MP_COMPILER_ATTRIBUTE_LF_PRIVATE
114
115# Determine if we want to install conditional packages
116CONDITIONAL_PACKAGES=
117
118# Foundation checks
119ACX_PTHREAD
120MP_OBJC_RUNTIME
121MP_OBJC_FOUNDATION
122
123# tclobjc requires objc (runtime and foundation) support
124if test x$OBJC_RUNTIME != xnone -a x$OBJC_FOUNDATION != xnone; then
125        CONDITIONAL_PACKAGES="tclobjc1.0 $CONDITIONAL_PACKAGES"
126fi
127
128MP_PROG_DAEMONDO
129#MP_PROG_XAR
130
131AC_SUBST(REPLACEMENT_PROGS)
132AC_SUBST(EXTRA_PROGS)
133
134# set default ports-directory
135PORTS_DIR_DEFAULT=`pwd | sed -e "s/base/ports/"`
136
137# Check for paths
138AC_PREFIX_DEFAULT(/opt/local)
139MP_PATH_PORTSDIR([$PORTS_DIR_DEFAULT])
140MP_PATH_MPCONFIGDIR
141
142# Check whether to install without root privileges
143MP_CHECK_NOROOTPRIVILEGES
144
145# Check for install ownership
146MP_CHECK_INSTALLUSER
147MP_CHECK_INSTALLGROUP
148MP_CHECK_RUNUSER
149MP_DIRECTORY_MODE
150MP_SHARED_DIRECTORY
151
152# Check for default directories
153MP_PATH_APPLICATIONS
154MP_PATH_FRAMEWORKS
155
156# Check for universal options
157MP_UNIVERSAL_OPTIONS
158
159# Check for standard header files.
160AC_HEADER_STDC
161AC_HEADER_DIRENT
162AC_HEADER_SYS_WAIT
163AC_HEADER_STAT
164AC_CHECK_HEADERS([limits.h paths.h sys/file.h crt_externs.h fcntl.h sys/fcntl.h sys/cdefs.h err.h libgen.h sys/socket.h \
165        readline/readline.h readline/history.h pwd.h sys/paths.h utime.h])
166
167INCLUDES="-I.. -I. $INCLUDES"
168
169# Checks for library functions.
170AC_FUNC_CLOSEDIR_VOID
171AC_FUNC_FORK
172AC_FUNC_STRERROR_R
173AC_CHECK_FUNCS([bzero memset dup2 regcomp strdup strerror strtol fgetln lockf flock setmode strcasecmp strncasecmp strlcpy copyfile clearenv])
174MP_CHECK_READLINK_IS_P1003_1A
175
176AC_ARG_WITH(x11-prefix, [AC_HELP_STRING([--with-x11-prefix=PREFIX], [use PREFIX as the X11 base dir (default autodetect)])], [ x11prefix="$withval" ] )
177case "$x11prefix" in
178  "")
179    # default to traditional value
180    x11prefix=/usr/X11R6
181    ;;
182  *)
183    x_includes=$x11prefix/include
184    x_libraries=$x11prefix/lib
185    ;;
186esac
187
188# Check for md5 implementation
189MP_LIB_MD5
190# Check for X11 and paraphernalia
191MP_CHECK_X11
192
193AC_MSG_CHECKING(for X11 prefix)
194X_INCLUDES_PREFIX=`echo "$x_includes" | sed "s,/include,,"`
195X_LIBRARIES_PREFIX=`echo "$x_libraries" | sed "s,/lib,,"`
196if test "x$have_x" = "xyes" -a "x$X_INCLUDES_PREFIX" = "x$X_LIBRARIES_PREFIX" -a "x$X_LIBRARIES_PREFIX" != x; then
197    x11prefix=$X_LIBRARIES_PREFIX
198fi
199AC_MSG_RESULT([$x11prefix])
200AC_SUBST(x11prefix)
201
202# Check for readline
203AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [Enable addition of readline support, if readline present.]),
204[
205        AC_CHECK_LIB([readline], [readline], [
206                                  READLINE_LIBS=-lreadline
207                                  AC_DEFINE([HAVE_LIBREADLINE], [1], [Define to 1 if you have the `readline' library (-lreadline).])
208                                  ])
209        AC_CHECK_DECLS([rl_username_completion_function,rl_filename_completion_function,rl_completion_matches,username_completion_function,filename_completion_function,completion_matches], [], [],
210        [
211        #include <stdio.h>
212        #if HAVE_READLINE_READLINE_H
213        # include <readline/readline.h>
214        #endif
215        ])
216])
217AC_SUBST(READLINE_LIBS)
218
219# Lowest non-system-reserved uid and gid (Apple claims <500)
220AC_DEFINE([MIN_USABLE_UID], [500], [Lowest non-system-reserved UID.])
221AC_DEFINE([MIN_USABLE_GID], [500], [Lowest non-system-reserved GID.])
222
223# Load tclConfig.sh
224SC_PATH_TCLCONFIG
225SC_LOAD_TCLCONFIG
226
227# Check for Tcl public headers
228dnl XXX  hardwire CYGPATH (CYGPATH must be set for SC_PUBLIC_TCL_HEADERS)
229CYGPATH=echo
230SC_PUBLIC_TCL_HEADERS
231
232# Check for tclsh binary
233MP_PROG_TCLSH
234
235# Check for Tcl package path
236MP_TCL_PACKAGE_DIR
237
238# Check if thread is enabled.
239MP_TCL_THREAD_SUPPORT
240
241## libcurl
242MP_LIBCURL_FLAGS
243
244# Do we have curl_easy_strerror?
245AH_TEMPLATE([HAVE_CURL_EASY_STRERROR],
246               [Define to 1 if you have the curl_easy_strerror function.])
247AC_CHECK_LIB([curl], [curl_easy_strerror],
248        [AC_DEFINE([HAVE_CURL_EASY_STRERROR])],[],
249        [$LDFLAGS_LIBCURL])
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/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(CONDITIONAL_PACKAGES)
362AC_SUBST(OUR_INCLUDED_PACKAGES)
363
364# misc variables that need to be expanded for substitution into tcl
365
366oldprefix=$prefix
367if test "x$prefix" = "xNONE" ; then
368   prefix=$ac_default_prefix
369fi
370
371eval "prefix_expanded=$prefix"
372AC_SUBST(prefix_expanded)
373# do this twice, since there is a nested variable of
374# ${prefix} inside of ${sysconfdir}
375eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
376eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
377AC_SUBST(MPCONFIGDIR_EXPANDED)
378eval "localstatedir_expanded=$localstatedir"
379AC_SUBST(localstatedir_expanded)
380
381prefix=$oldprefix
382
383dnl man page settings (compressed, links, etc)
384dnl
385dnl SC_CONFIG_MANPAGES
386
387# Output
388AC_CONFIG_FILES([
389        Doxyfile
390        Makefile
391        Mk/macports.autoconf.mk
392        doc/prefix.mtree
393        doc/macosx.mtree
394        doc/macports.conf
395        portmgr/freebsd/Makefile
396        portmgr/fedora/macports.spec
397        src/Makefile
398        src/macports1.0/macports_autoconf.tcl
399        src/tclobjc1.0/Makefile
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_OUTPUT
Note: See TracBrowser for help on using the repository browser.