source: trunk/base/configure.ac @ 33499

Last change on this file since 33499 was 33499, checked in by afb@…, 13 years ago

add placeholder configuration for applications/frameworks installation directory

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.8 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2dnl $Id: configure.ac 33499 2008-01-28 08:15:07Z afb@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_vesion file
11AC_MSG_CHECKING(MacPorts version)
12MACPORTS_VERSION=MACPORTS_VERSION_MACRO
13AC_MSG_RESULT([$MACPORTS_VERSION])
14AC_SUBST(MACPORTS_VERSION)
15# Read the old, floating point format version, which we still use internally, and export it for the $macports::autoconf::macports_version variable
16MP_VERSION=$(cat config/mp_version | tr -d '\n')
17AC_SUBST(MP_VERSION)
18
19# Check user PATH for MP paths, and remove as necessary.
20MP_PATH_SCAN
21
22AC_CHECK_PROGS(SW_VERS, sw_vers)
23if test "x$SW_VERS" != "x"; then
24  AC_MSG_CHECKING(Mac OS X version)
25  MACOSX_VERSION=`$SW_VERS -productVersion | cut -f 1-3 -d.`
26  AC_MSG_RESULT([$MACOSX_VERSION])
27fi
28
29case "$MACOSX_VERSION" in
30  10.0*|10.1*|10.2*)
31    AC_WARN(This version of Mac OS X is not supported)
32    AC_WARN(Please upgrade at http://store.apple.com/)
33    ;;
34  10.1.[[0-4]]|10.2.[[0-7]]|10.3.[[0-8]]|10.4.[[0-8]])
35    AC_WARN(This version of Mac OS X is out of date)
36    AC_WARN(Please run Software Update to update it)
37    ;;
38  10.3*|10.4*|10.5*)
39    dnl Supported version
40    ;;
41  *)
42    ;;
43esac
44
45XCODEPLIST=/Developer/Applications/Xcode.app/Contents/version.plist
46if test -r "$XCODEPLIST"; then
47  AC_MSG_CHECKING(Xcode version)
48  XCODE_VERSION=`tr -d '\r\n' < $XCODEPLIST | sed -e 's/.*<key>CFBundleShortVersionString<\/key>.<string>\([[0-9.]]*\)<\/string>.*/\1/'`
49  AC_MSG_RESULT([$XCODE_VERSION])
50fi
51
52case "$XCODE_VERSION" in
53  1.[[0-1]]*|2.[[0-1]]*)
54    AC_WARN(This version of Xcode Tools is not supported)
55    AC_WARN(Please upgrade at http://connect.apple.com/)
56    ;;
57  1.[[2-4]]*|2.[[2-3]]*)
58    AC_WARN(This version of Xcode Tools is out of date)
59    AC_WARN(Please consider upgrading as some ports fail compiling)
60    ;;
61  1.5*|2.4*|3.*)
62    dnl Supported version
63    ;;
64  *)
65    ;;
66esac
67
68# Checks for programs.
69AC_PROG_CC
70AC_PROG_OBJC
71AC_PROG_INSTALL
72AC_PROG_MAKE_SET
73AC_PROG_LN_S
74AC_PATH_PROG(MTREE, [mtree], [], [$PATH:/usr/sbin])
75AC_PATH_PROG(CVS, [cvs], [])
76AC_PATH_PROG(SVN, [svn], [])
77AC_PATH_PROG(RSYNC, [rsync], [])
78AC_PATH_PROG(SED, [sed])
79AC_PATH_PROG(TAR, [tar])
80AC_PATH_PROG(MAKE, [make])
81AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
82AC_PATH_PROG(LAUNCHCTL, [launchctl], [])
83AC_PATH_PROG(XCODEBUILD, [xcodebuild], [])
84AC_PATH_PROGS(GNUTAR, [gnutar gtar], [], [$PATH:/usr/local/bin])
85AC_PATH_PROGS(GNUMAKE, [gnumake gmake], [], [$PATH:/usr/local/bin])
86AC_PATH_PROG(BZIP2, [bzip2], [])
87AC_PATH_PROG(XAR, [xar], [])
88AC_PATH_PROG(OPEN, [open], [])
89
90# Define some precious variables allowing user to override PATH for some programs
91AC_ARG_VAR(MTREE, [path to mtree command])
92AC_ARG_VAR(CVS, [path to cvs command])
93AC_ARG_VAR(SVN, [path to svn command])
94AC_ARG_VAR(RSYNC, [path to rsync command])
95AC_ARG_VAR(SED, [path to sed command])
96AC_ARG_VAR(TAR, [path to tar command])
97AC_ARG_VAR(MAKE, [path to make command])
98AC_ARG_VAR(GNUTAR, [path to gnutar command])
99AC_ARG_VAR(GNUMAKE, [path to gnumake command])
100AC_ARG_VAR(BZIP2, [path to bzip2 command])
101AC_ARG_VAR(XAR, [path to xar command])
102AC_ARG_VAR(OPEN, [path to open command])
103
104MP_SED_EXTENDED_REGEXP
105MP_TAR_NO_SAME_OWNER
106
107# Quiche eaters options.
108if test x$GCC = xyes; then
109        CFLAGS_QUICHEEATERS='-W -Wall -pedantic'
110fi
111AC_SUBST(CFLAGS_QUICHEEATERS)
112MP_WERROR
113
114MP_COMPILER_ATTRIBUTE_UNUSED
115MP_COMPILER_ATTRIBUTE_LF_PRIVATE
116
117# Foundation checks
118ACX_PTHREAD
119MP_OBJC_RUNTIME
120MP_OBJC_FOUNDATION
121
122MP_PROG_DAEMONDO
123#MP_PROG_XAR
124
125AC_SUBST(REPLACEMENT_PROGS)
126AC_SUBST(EXTRA_PROGS)
127
128# set default ports-directory
129PORTS_DIR_DEFAULT=`pwd | sed -e "s/base/ports/"`
130
131# Check for paths
132AC_PREFIX_DEFAULT(/opt/local)
133MP_PATH_PORTSDIR([$PORTS_DIR_DEFAULT])
134MP_PATH_MPCONFIGDIR
135
136# Check for install ownership
137MP_CHECK_INSTALLUSER
138MP_CHECK_INSTALLGROUP
139MP_DIRECTORY_MODE
140
141# Check for default directories
142MP_PATH_APPLICATIONS
143MP_PATH_FRAMEWORKS
144
145# Check for standard header files.
146AC_HEADER_STDC
147AC_HEADER_DIRENT
148AC_HEADER_SYS_WAIT
149AC_HEADER_STAT
150AC_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 \
151        readline/readline.h readline/history.h pwd.h sys/paths.h utime.h])
152
153INCLUDES="-I.. -I. $INCLUDES"
154
155# Checks for library functions.
156AC_FUNC_CLOSEDIR_VOID
157AC_FUNC_FORK
158AC_FUNC_STRERROR_R
159AC_CHECK_FUNCS([bzero memset dup2 regcomp strdup strerror strtol fgetln lockf flock setmode strcasecmp strncasecmp strlcpy copyfile])
160MP_CHECK_READLINK_IS_P1003_1A
161
162AC_ARG_WITH(x11-prefix, [AC_HELP_STRING([--with-x11-prefix=PREFIX], [use PREFIX as the X11 base dir (default autodetect)])], [ x11prefix="$withval" ] )
163case "$x11prefix" in
164  "")
165    # default to traditional value
166    x11prefix=/usr/X11R6
167    ;;
168  *)
169    x_includes=$x11prefix/include
170    x_libraries=$x11prefix/lib
171    ;;
172esac
173
174# Check for md5 implementation
175MP_LIB_MD5
176# Check for X11 and paraphernalia
177MP_CHECK_X11
178
179AC_MSG_CHECKING(for X11 prefix)
180X_INCLUDES_PREFIX=`echo "$x_includes" | sed "s,/include,,"`
181X_LIBRARIES_PREFIX=`echo "$x_libraries" | sed "s,/lib,,"`
182if test "x$have_x" = "xyes" -a "x$X_INCLUDES_PREFIX" = "x$X_LIBRARIES_PREFIX"; then
183    x11prefix=$X_LIBRARIES_PREFIX
184fi
185AC_MSG_RESULT([$x11prefix])
186AC_SUBST(x11prefix)
187
188# Check for readline
189AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [Enable addition of readline support, if readline present.]),
190[
191        AC_CHECK_LIB([readline], [readline], [
192                                  READLINE_LIBS=-lreadline
193                                  AC_DEFINE([HAVE_LIBREADLINE], [1], [Define to 1 if you have the `readline' library (-lreadline).])
194                                  ])
195        AC_CHECK_DECLS([rl_username_completion_function,rl_filename_completion_function,rl_completion_matches,username_completion_function,filename_completion_function,completion_matches], [], [],
196        [
197        #include <stdio.h>
198        #if HAVE_READLINE_READLINE_H
199        # include <readline/readline.h>
200        #endif
201        ])
202])
203AC_SUBST(READLINE_LIBS)
204
205# Lowest non-system-reserved uid and gid (Apple claims <500)
206AC_DEFINE([MIN_USABLE_UID], [500], [Lowest non-system-reserved UID.])
207AC_DEFINE([MIN_USABLE_GID], [500], [Lowest non-system-reserved GID.])
208
209# Load tclConfig.sh
210SC_PATH_TCLCONFIG
211SC_LOAD_TCLCONFIG
212
213# Check for Tcl public headers
214dnl XXX  hardwire CYGPATH (CYGPATH must be set for SC_PUBLIC_TCL_HEADERS)
215CYGPATH=echo
216SC_PUBLIC_TCL_HEADERS
217
218# Check for tclsh binary
219MP_PROG_TCLSH
220
221# Check for Tcl package path
222MP_TCL_PACKAGE_DIR
223
224# Check if thread is enabled.
225MP_TCL_THREAD_SUPPORT
226
227## libcurl
228MP_LIBCURL_FLAGS
229
230# Do we have curl_easy_strerror?
231AH_TEMPLATE([HAVE_CURL_EASY_STRERROR],
232               [Define to 1 if you have the curl_easy_strerror function.])
233AC_CHECK_LIB([curl], [curl_easy_strerror],
234        [AC_DEFINE([HAVE_CURL_EASY_STRERROR])],[],
235        [$LDFLAGS_LIBCURL])
236
237# Determine if we need to install some bundled packages
238OUR_INCLUDED_PACKAGES=
239
240## Thread package.
241AC_ARG_WITH(
242                included-tclthread,
243                AS_HELP_STRING([--with-included-tclthread],
244                        [install included Thread package.]),
245                [with_included_tclthread=$withval],
246                [with_included_tclthread="unspecified"])
247
248# Check if thread package is already installed.
249if test "x$with_included_tclthread" = "xunspecified" ; then
250        MP_TCL_PACKAGE(
251                [Thread],
252                [AC_MSG_RESULT([yes]); with_included_tclthread=no],
253                [AC_MSG_RESULT([no]); with_included_tclthread=yes])
254fi
255
256# If thread package isn't installed, configure and install thread package.
257if test "$with_included_tclthread" = "yes"; then
258        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
259        AC_CONFIG_SUBDIRS([src/thread2.6])
260        # Extract thread package
261        (cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
262        # Patch thread package (so thread2.6 is the vanilla distribution directory)
263        patch -p0 < src/thread2.6.diff
264fi
265
266## sqlite3 package.
267AC_ARG_WITH(
268                included-sqlite3,
269                AS_HELP_STRING([--with-included-sqlite3],
270                        [build using bundled sqlite3 package]),
271                [with_included_sqlite3=$withval],
272                [with_included_sqlite3="unspecified"])
273
274# Check if sqlite3 package is already installed.
275if test "x$with_included_sqlite3" = "xunspecified" ; then
276        AC_CHECK_LIB([sqlite3],[sqlite3_open],
277                [with_included_sqlite3=no],
278                [with_included_sqlite3=yes])
279fi
280
281AC_ARG_WITH(
282                tcl-sqlite3,
283                AS_HELP_STRING([--with-tcl-sqlite3=DIR],
284                        [directory for Tcl sqlite3 (default /usr/lib/sqlite3)]),
285                [mp_sqlite3_dir=$withval],
286                [mp_sqlite3_dir=/usr/lib/sqlite3])
287
288# If sqlite3 package isn't installed, configure and install sqlite3 package.
289if test "$with_included_sqlite3" = "yes"; then
290        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES sqlite-3.1.3"
291        INCLUDES="$INCLUDES -I../sqlite-3.1.3"
292        AC_CONFIG_SUBDIRS([src/sqlite-3.1.3])
293        # Extract sqlite3 package
294        (cd src/; gzip -d < sqlite-3.1.3.tar.gz | tar xf -)
295        # patch sqlite3 with desired configure options
296        patch -p0 < src/sqlite-3.1.3.diff
297        # the new tclinstaller.tcl needs to have substitution occur
298        mv src/sqlite-3.1.3/tclinstaller.tcl src/sqlite-3.1.3/tclinstaller.tcl.in
299        SQLITE3_LIBS=`pwd`"/src/sqlite-3.1.3/.libs/libsqlite3.a"
300        if test "x$prefix" = "xNONE" ; then
301                SQLITE3_DIR=$ac_default_prefix/share/macports/Tcl/sqlite3
302        else
303                SQLITE3_DIR=$prefix/share/macports/Tcl/sqlite3
304        fi
305else
306        SQLITE3_LIBS="-lsqlite3"
307
308        AC_CACHE_CHECK([for Tcl sqlite3 location], [mp_cv_sqlite3_dir],
309                [mp_cv_sqlite3_dir=
310                test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
311                ])
312
313        SQLITE3_DIR=$mp_cv_sqlite3_dir
314fi
315
316AC_SUBST(SQLITE3_LIBS)
317AC_SUBST(SQLITE3_DIR)
318
319AH_TEMPLATE([TRACE_SDK], [SDK for SDK redirect in tracelib])
320AC_ARG_WITH(
321        trace-sdk,
322        AS_HELP_STRING([--with-trace-sdk=SDK],
323                [SDK for redirection in trace lib (for example MacOSX10.4u.sdk)]),
324        [test -d /Developer/SDKs/$withval && AC_DEFINE_UNQUOTED([TRACE_SDK], "${withval}")], [])
325       
326       
327# If /etc/paths.d and /etc/manpaths.d then we can install our path configuration
328AC_MSG_CHECKING(whether to install MacPorts paths into /etc/paths.d and /etc/manpaths.d)
329mpprefix=$prefix
330test "x$mpprefix" = "xNONE" && mpprefix=$ac_default_prefix
331if test -d /etc/paths.d -a -d /etc/manpaths.d -a "$mpprefix" = "$ac_default_prefix"; then
332        PATHCONF=pathconf
333        AC_MSG_RESULT([yes])
334else
335        AC_MSG_RESULT([no])
336fi
337
338
339# Allows building of shared libraries
340SC_ENABLE_SHARED
341
342# Pull compiler / linker values from tclConfig.sh
343CFLAGS_DEBUG=${TCL_CFLAGS_DEBUG}
344CFLAGS_OPTIMIZE=${TCL_CFLAGS_OPTIMIZE}
345LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG}
346LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE}
347SHLIB_LD=${TCL_SHLIB_LD}
348STLIB_LD=${TCL_STLIB_LD}
349SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}
350SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX}
351
352AC_SUBST(INCLUDES)
353AC_SUBST(CFLAGS_DEBUG)
354AC_SUBST(CFLAGS_OPTIMIZE)
355AC_SUBST(PATHCONF)
356AC_SUBST(STLIB_LD)
357AC_SUBST(SHLIB_LD)
358AC_SUBST(SHLIB_CFLAGS)
359AC_SUBST(SHLIB_LDFLAGS)
360AC_SUBST(SHLIB_SUFFIX)
361AC_SUBST(TCL_DEFS)
362AC_SUBST(TCL_STUB_LIB_SPEC)
363AC_SUBST(TCL_CC)
364AC_SUBST(OUR_INCLUDED_PACKAGES)
365
366# misc variables that need to be expanded for substitution into tcl
367
368oldprefix=$prefix
369if test "x$prefix" = "xNONE" ; then
370   prefix=$ac_default_prefix
371fi
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        Makefile
392        Mk/macports.autoconf.mk
393        doc/prefix.mtree
394        doc/macosx.mtree
395        doc/macports.conf
396        portmgr/freebsd/Makefile
397        portmgr/fedora/macports.spec
398        src/Makefile
399        src/macports1.0/macports_autoconf.tcl
400        src/tclobjc1.0/Makefile
401        src/pathconf/Makefile
402        src/pathconf/paths
403        src/pathconf/manpaths
404        src/port1.0/port_autoconf.tcl
405        src/registry1.0/registry_autoconf.tcl
406        src/programs/Makefile
407        src/macports1.0/macports_fastload.tcl
408])
409
410AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.