source: branches/gsoc09-logging/base/configure.ac @ 51231

Last change on this file since 51231 was 51135, checked in by jmr@…, 11 years ago

make findBinary available in port1.0 and use autoconf paths for a bunch of stuff (see #18149)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.4 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2dnl $Id: configure.ac 51135 2009-05-19 03:59:01Z jmr@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*)
32    AC_MSG_WARN([This version of Mac OS X is not supported])
33    AC_MSG_WARN([Please upgrade at http://store.apple.com/])
34    ;;
35  10.1.[[0-4]]|10.2.[[0-7]]|10.3.[[0-8]]|10.4.[[0-9]]|10.4.10|10.5.[[0-5]])
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.3*|10.4*|10.5*)
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])
51fi
52
53XCODEPLIST=$DEVELOPER_DIR/Applications/Xcode.app/Contents/version.plist
54if test -r "$XCODEPLIST"; then
55  AC_MSG_CHECKING(Xcode version)
56  if test "x$DEFAULTS" != "x"; then
57    XCODE_VERSION=`$DEFAULTS read $DEVELOPER_DIR/Applications/Xcode.app/Contents/version CFBundleShortVersionString`
58  else
59    XCODE_VERSION=`tr -d '\r\n' < $XCODEPLIST | sed -e 's/.*<key>CFBundleShortVersionString<\/key>.<string>\([[0-9.]]*\)<\/string>.*/\1/'`
60  fi
61  AC_MSG_RESULT([$XCODE_VERSION])
62fi
63
64case "$XCODE_VERSION" in
65  1.[[0-1]]*|2.[[0-1]]*)
66    AC_MSG_WARN([This version of Xcode Tools is not supported])
67    AC_MSG_WARN([Please upgrade at http://connect.apple.com/])
68    ;;
69  1.[[2-4]]*|2.[[2-3]]*|3.[[0]]*)
70    AC_MSG_WARN([This version of Xcode Tools is out of date])
71    AC_MSG_WARN([Please consider upgrading as some ports fail compiling])
72    ;;
73  1.5*|2.4*|3.*)
74    dnl Supported version
75    ;;
76  *)
77    ;;
78esac
79
80# Checks for programs.
81AC_PROG_CC
82AC_PROG_OBJC
83AC_PROG_INSTALL
84AC_PROG_MAKE_SET
85AC_PROG_LN_S
86AC_PATH_PROG(MTREE, [mtree], [], [$PATH:/usr/sbin])
87AC_PATH_PROG(CP, [cp], [])
88AC_PATH_PROG(CVS, [cvs], [])
89AC_PATH_PROG(SVN, [svn], [])
90AC_PATH_PROG(GIT, [git], [])
91AC_PATH_PROG(GZIP, [gzip], [])
92AC_PATH_PROG(RMDIR, [rmdir], [])
93AC_PATH_PROG(RSYNC, [rsync], [])
94AC_PATH_PROG(SED, [sed])
95AC_PATH_PROG(TAR, [tar])
96AC_PATH_PROG(UNZIP, [unzip])
97AC_PATH_PROG(ZIP, [zip])
98AC_PATH_PROG(MAKE, [make])
99AC_PATH_PROG(HDIUTIL, [hdiutil], [])
100AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
101AC_PATH_PROG(LAUNCHCTL, [launchctl], [])
102AC_PATH_PROG(XCODEBUILD, [xcodebuild], [])
103AC_PATH_PROGS(GNUTAR, [gnutar gtar], [], [$PATH:/usr/local/bin])
104AC_PATH_PROGS(GNUMAKE, [gnumake gmake], [], [$PATH:/usr/local/bin])
105AC_PATH_PROG(BZIP2, [bzip2], [])
106AC_PATH_PROG(PAX, [pax], [])
107AC_PATH_PROG(XAR, [xar], [])
108AC_PATH_PROG(OPEN, [open], [])
109
110# Define some precious variables allowing user to override PATH for some programs
111AC_ARG_VAR(MTREE, [path to mtree command])
112AC_ARG_VAR(CVS, [path to cvs command])
113AC_ARG_VAR(SVN, [path to svn command])
114AC_ARG_VAR(RSYNC, [path to rsync command])
115AC_ARG_VAR(SED, [path to sed command])
116AC_ARG_VAR(TAR, [path to tar command])
117AC_ARG_VAR(MAKE, [path to make command])
118AC_ARG_VAR(GNUTAR, [path to gnutar command])
119AC_ARG_VAR(GNUMAKE, [path to gnumake command])
120AC_ARG_VAR(BZIP2, [path to bzip2 command])
121AC_ARG_VAR(XAR, [path to xar command])
122AC_ARG_VAR(OPEN, [path to open command])
123
124MP_SED_EXTENDED_REGEXP
125MP_TAR_NO_SAME_OWNER
126
127# Quiche eaters options.
128if test x$GCC = xyes; then
129        CFLAGS_QUICHEEATERS='-W -Wall -pedantic'
130fi
131AC_SUBST(CFLAGS_QUICHEEATERS)
132MP_WERROR
133
134MP_COMPILER_ATTRIBUTE_UNUSED
135MP_COMPILER_ATTRIBUTE_LF_PRIVATE
136
137# Determine if we want to install conditional packages
138CONDITIONAL_PACKAGES=
139
140# Foundation checks
141ACX_PTHREAD
142MP_OBJC_RUNTIME
143MP_OBJC_FOUNDATION
144
145# tclobjc requires objc (runtime and foundation) support
146if test x$OBJC_RUNTIME != xnone -a x$OBJC_FOUNDATION != xnone; then
147        CONDITIONAL_PACKAGES="tclobjc1.0 $CONDITIONAL_PACKAGES"
148fi
149
150MP_PROG_DAEMONDO
151
152AC_SUBST(REPLACEMENT_PROGS)
153AC_SUBST(EXTRA_PROGS)
154
155# set default ports-directory
156PORTS_DIR_DEFAULT=`pwd | sed -e "s/base/ports/"`
157
158# Check for paths
159AC_PREFIX_DEFAULT(/opt/local)
160MP_PATH_PORTSDIR([$PORTS_DIR_DEFAULT])
161MP_PATH_MPCONFIGDIR
162
163# Check whether to install without root privileges
164MP_CHECK_NOROOTPRIVILEGES
165
166# Check for install ownership
167MP_CHECK_INSTALLUSER
168MP_CHECK_INSTALLGROUP
169MP_CHECK_RUNUSER
170MP_DIRECTORY_MODE
171MP_SHARED_DIRECTORY
172
173# Check for default directories
174MP_PATH_APPLICATIONS
175MP_PATH_FRAMEWORKS
176
177# Check for universal options
178MP_UNIVERSAL_OPTIONS
179
180# Check for standard header files.
181AC_HEADER_STDC
182AC_HEADER_DIRENT
183AC_HEADER_SYS_WAIT
184AC_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 \
185        readline/readline.h readline/history.h pwd.h sys/paths.h utime.h])
186
187INCLUDES="-I.. -I. $INCLUDES"
188
189# Checks for library functions.
190AC_CHECK_FUNCS([bzero memset fgetln lockf flock setmode strcasecmp strncasecmp strlcpy copyfile clearenv])
191MP_CHECK_READLINK_IS_P1003_1A
192
193# Check for md5 implementation
194MP_LIB_MD5
195
196# Check for readline
197AC_ARG_ENABLE(readline, AS_HELP_STRING([--enable-readline],[Enable addition of readline support, if readline present.]),
198[
199        AC_CHECK_LIB([readline], [readline], [
200                                  READLINE_LIBS=-lreadline
201                                  AC_DEFINE([HAVE_LIBREADLINE], [1], [Define to 1 if you have the `readline' library (-lreadline).])
202                                  ])
203        AC_CHECK_DECLS([rl_username_completion_function,rl_filename_completion_function,rl_completion_matches,username_completion_function,filename_completion_function,completion_matches], [], [],
204        [
205        #include <stdio.h>
206        #if HAVE_READLINE_READLINE_H
207        # include <readline/readline.h>
208        #endif
209        ])
210])
211AC_SUBST(READLINE_LIBS)
212
213# Lowest non-system-reserved uid and gid (Apple claims <500)
214AC_DEFINE([MIN_USABLE_UID], [500], [Lowest non-system-reserved UID.])
215AC_DEFINE([MIN_USABLE_GID], [500], [Lowest non-system-reserved GID.])
216
217# Load tclConfig.sh
218SC_PATH_TCLCONFIG
219SC_LOAD_TCLCONFIG
220
221# Check for Tcl public headers
222dnl XXX  hardwire CYGPATH (CYGPATH must be set for SC_PUBLIC_TCL_HEADERS)
223CYGPATH=echo
224SC_PUBLIC_TCL_HEADERS
225
226# Check for tclsh binary
227MP_PROG_TCLSH
228
229# Check for Tcl package path
230MP_TCL_PACKAGE_DIR
231
232# Check if thread is enabled.
233MP_TCL_THREAD_SUPPORT
234
235## libcurl
236MP_LIBCURL_FLAGS
237
238# Do we have curl_easy_strerror?
239AH_TEMPLATE([HAVE_CURL_EASY_STRERROR],
240               [Define to 1 if you have the curl_easy_strerror function.])
241AC_CHECK_LIB([curl], [curl_easy_strerror],
242        [AC_DEFINE([HAVE_CURL_EASY_STRERROR])],[],
243        [$LDFLAGS_LIBCURL])
244
245# Determine if we need to install some bundled packages
246OUR_INCLUDED_PACKAGES=
247
248## Thread package.
249AC_ARG_WITH(
250                included-tclthread,
251                AS_HELP_STRING([--with-included-tclthread],
252                        [install included Thread package.]),
253                [with_included_tclthread=$withval],
254                [with_included_tclthread="unspecified"])
255
256# Check if thread package is already installed.
257if test "x$with_included_tclthread" = "xunspecified" ; then
258        MP_TCL_PACKAGE(
259                [Thread],
260                [AC_MSG_RESULT([yes]); with_included_tclthread=no],
261                [AC_MSG_RESULT([no]); with_included_tclthread=yes])
262fi
263
264# If thread package isn't installed, configure and install thread package.
265if test "$with_included_tclthread" = "yes"; then
266        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
267        AC_CONFIG_SUBDIRS([src/thread2.6])
268        # Extract thread package
269        (cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
270        # Patch thread package (so thread2.6 is the vanilla distribution directory)
271        patch -p0 < src/thread2.6.diff
272fi
273
274## sqlite3 package.
275AC_ARG_WITH(
276                included-sqlite3,
277                AS_HELP_STRING([--with-included-sqlite3],
278                        [build using bundled sqlite3 package]),
279                [with_included_sqlite3=$withval],
280                [with_included_sqlite3="unspecified"])
281
282# Check if sqlite3 package is already installed.
283if test "x$with_included_sqlite3" = "xunspecified" ; then
284        AC_CHECK_LIB([sqlite3],[sqlite3_open],
285                [with_included_sqlite3=no],
286                [with_included_sqlite3=yes])
287fi
288
289AC_ARG_WITH(
290                tcl-sqlite3,
291                AS_HELP_STRING([--with-tcl-sqlite3=DIR],
292                        [directory for Tcl sqlite3 (default /usr/lib/sqlite3)]),
293                [mp_sqlite3_dir=$withval],
294                [mp_sqlite3_dir=/usr/lib/sqlite3])
295
296# If sqlite3 package isn't installed, configure and install sqlite3 package.
297if test "$with_included_sqlite3" = "yes"; then
298        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES sqlite-3.1.3"
299        INCLUDES="$INCLUDES -I../sqlite-3.1.3"
300        AC_CONFIG_SUBDIRS([src/sqlite-3.1.3])
301        # Extract sqlite3 package
302        (cd src/; gzip -d < sqlite-3.1.3.tar.gz | tar xf -)
303        # patch sqlite3 with desired configure options
304        patch -p0 < src/sqlite-3.1.3.diff
305        # the new tclinstaller.tcl needs to have substitution occur
306        mv src/sqlite-3.1.3/tclinstaller.tcl src/sqlite-3.1.3/tclinstaller.tcl.in
307        SQLITE3_LIBS=`pwd`"/src/sqlite-3.1.3/.libs/libsqlite3.a"
308        if test "x$prefix" = "xNONE" ; then
309                SQLITE3_DIR=$ac_default_prefix/share/macports/Tcl/sqlite3
310        else
311                SQLITE3_DIR=$prefix/share/macports/Tcl/sqlite3
312        fi
313else
314        SQLITE3_LIBS="-lsqlite3"
315
316        AC_CACHE_CHECK([for Tcl sqlite3 location], [mp_cv_sqlite3_dir],
317                [mp_cv_sqlite3_dir=
318                test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
319                ])
320
321        SQLITE3_DIR=$mp_cv_sqlite3_dir
322fi
323
324AC_SUBST(SQLITE3_LIBS)
325AC_SUBST(SQLITE3_DIR)
326
327AH_TEMPLATE([TRACE_SDK], [SDK for SDK redirect in tracelib])
328AC_ARG_WITH(
329        trace-sdk,
330        AS_HELP_STRING([--with-trace-sdk=SDK],
331                [SDK for redirection in trace lib (for example MacOSX10.4u.sdk)]),
332        [test -d /Developer/SDKs/$withval && AC_DEFINE_UNQUOTED([TRACE_SDK], "${withval}")], [])
333
334# Allows building of shared libraries
335SC_ENABLE_SHARED
336
337# Pull compiler / linker values from tclConfig.sh
338LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG}
339LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE}
340SHLIB_LD=${TCL_SHLIB_LD}
341STLIB_LD=${TCL_STLIB_LD}
342SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}
343SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX}
344
345AC_SUBST(INCLUDES)
346AC_SUBST(PATHCONF)
347AC_SUBST(STLIB_LD)
348AC_SUBST(SHLIB_LD)
349AC_SUBST(SHLIB_CFLAGS)
350AC_SUBST(SHLIB_LDFLAGS)
351AC_SUBST(SHLIB_SUFFIX)
352AC_SUBST(TCL_DEFS)
353AC_SUBST(TCL_STUB_LIB_SPEC)
354AC_SUBST(TCL_CC)
355AC_SUBST(CONDITIONAL_PACKAGES)
356AC_SUBST(OUR_INCLUDED_PACKAGES)
357
358# misc variables that need to be expanded for substitution into tcl
359
360oldprefix=$prefix
361if test "x$prefix" = "xNONE" ; then
362   prefix=$ac_default_prefix
363fi
364
365eval "prefix_expanded=$prefix"
366AC_SUBST(prefix_expanded)
367# do this twice, since there is a nested variable of
368# ${prefix} inside of ${sysconfdir}
369eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
370eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
371AC_SUBST(MPCONFIGDIR_EXPANDED)
372eval "localstatedir_expanded=$localstatedir"
373AC_SUBST(localstatedir_expanded)
374
375prefix=$oldprefix
376
377dnl man page settings (compressed, links, etc)
378dnl
379dnl SC_CONFIG_MANPAGES
380
381# Output
382AC_CONFIG_FILES([
383        Doxyfile
384        Makefile
385        Mk/macports.autoconf.mk
386        doc/prefix.mtree
387        doc/macosx.mtree
388        doc/macports.conf
389        portmgr/freebsd/Makefile
390        portmgr/fedora/macports.spec
391        src/Makefile
392        src/macports1.0/macports_autoconf.tcl
393        src/tclobjc1.0/Makefile
394        src/port1.0/port_autoconf.tcl
395        src/registry1.0/registry_autoconf.tcl
396        src/programs/Makefile
397        src/macports1.0/macports_fastload.tcl
398        setupenv.bash
399])
400
401AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.