source: trunk/base/configure.ac @ 33108

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

autoconf x11prefix, instead of hardcoding it

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.7 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2dnl $Id: configure.ac 33108 2008-01-18 08:27:43Z 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 standard header files.
142AC_HEADER_STDC
143AC_HEADER_DIRENT
144AC_HEADER_SYS_WAIT
145AC_HEADER_STAT
146AC_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 \
147        readline/readline.h readline/history.h pwd.h sys/paths.h utime.h])
148
149INCLUDES="-I.. -I. $INCLUDES"
150
151# Checks for library functions.
152AC_FUNC_CLOSEDIR_VOID
153AC_FUNC_FORK
154AC_FUNC_STRERROR_R
155AC_CHECK_FUNCS([bzero memset dup2 regcomp strdup strerror strtol fgetln lockf flock setmode strcasecmp strncasecmp strlcpy copyfile])
156MP_CHECK_READLINK_IS_P1003_1A
157
158AC_ARG_WITH(x11-prefix, [AC_HELP_STRING([--with-x11-prefix=PREFIX], [use PREFIX as the X11 base dir (default autodetect)])], [ x11prefix="$withval" ] )
159case "$x11prefix" in
160  "")
161    # default to traditional value
162    x11prefix=/usr/X11R6
163    ;;
164  *)
165    x_includes=$x11prefix/include
166    x_libraries=$x11prefix/lib
167    ;;
168esac
169
170# Check for md5 implementation
171MP_LIB_MD5
172# Check for X11 and paraphernalia
173MP_CHECK_X11
174
175AC_MSG_CHECKING(for X11 prefix)
176X_INCLUDES_PREFIX=`echo "$x_includes" | sed "s,/include,,"`
177X_LIBRARIES_PREFIX=`echo "$x_libraries" | sed "s,/lib,,"`
178if test "x$have_x" = "xyes" -a "x$X_INCLUDES_PREFIX" = "x$X_LIBRARIES_PREFIX"; then
179    x11prefix=$X_LIBRARIES_PREFIX
180fi
181AC_MSG_RESULT([$x11prefix])
182AC_SUBST(x11prefix)
183
184# Check for readline
185AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [Enable addition of readline support, if readline present.]),
186[
187        AC_CHECK_LIB([readline], [readline], [
188                                  READLINE_LIBS=-lreadline
189                                  AC_DEFINE([HAVE_LIBREADLINE], [1], [Define to 1 if you have the `readline' library (-lreadline).])
190                                  ])
191        AC_CHECK_DECLS([rl_username_completion_function,rl_filename_completion_function,rl_completion_matches,username_completion_function,filename_completion_function,completion_matches], [], [],
192        [
193        #include <stdio.h>
194        #if HAVE_READLINE_READLINE_H
195        # include <readline/readline.h>
196        #endif
197        ])
198])
199AC_SUBST(READLINE_LIBS)
200
201# Lowest non-system-reserved uid and gid (Apple claims <500)
202AC_DEFINE([MIN_USABLE_UID], [500], [Lowest non-system-reserved UID.])
203AC_DEFINE([MIN_USABLE_GID], [500], [Lowest non-system-reserved GID.])
204
205# Load tclConfig.sh
206SC_PATH_TCLCONFIG
207SC_LOAD_TCLCONFIG
208
209# Check for Tcl public headers
210dnl XXX  hardwire CYGPATH (CYGPATH must be set for SC_PUBLIC_TCL_HEADERS)
211CYGPATH=echo
212SC_PUBLIC_TCL_HEADERS
213
214# Check for tclsh binary
215MP_PROG_TCLSH
216
217# Check for Tcl package path
218MP_TCL_PACKAGE_DIR
219
220# Check if thread is enabled.
221MP_TCL_THREAD_SUPPORT
222
223## libcurl
224MP_LIBCURL_FLAGS
225
226# Do we have curl_easy_strerror?
227AH_TEMPLATE([HAVE_CURL_EASY_STRERROR],
228               [Define to 1 if you have the curl_easy_strerror function.])
229AC_CHECK_LIB([curl], [curl_easy_strerror],
230        [AC_DEFINE([HAVE_CURL_EASY_STRERROR])],[],
231        [$LDFLAGS_LIBCURL])
232
233# Determine if we need to install some bundled packages
234OUR_INCLUDED_PACKAGES=
235
236## Thread package.
237AC_ARG_WITH(
238                included-tclthread,
239                AS_HELP_STRING([--with-included-tclthread],
240                        [install included Thread package.]),
241                [with_included_tclthread=$withval],
242                [with_included_tclthread="unspecified"])
243
244# Check if thread package is already installed.
245if test "x$with_included_tclthread" = "xunspecified" ; then
246        MP_TCL_PACKAGE(
247                [Thread],
248                [AC_MSG_RESULT([yes]); with_included_tclthread=no],
249                [AC_MSG_RESULT([no]); with_included_tclthread=yes])
250fi
251
252# If thread package isn't installed, configure and install thread package.
253if test "$with_included_tclthread" = "yes"; then
254        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
255        AC_CONFIG_SUBDIRS([src/thread2.6])
256        # Extract thread package
257        (cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
258        # Patch thread package (so thread2.6 is the vanilla distribution directory)
259        patch -p0 < src/thread2.6.diff
260fi
261
262## sqlite3 package.
263AC_ARG_WITH(
264                included-sqlite3,
265                AS_HELP_STRING([--with-included-sqlite3],
266                        [build using bundled sqlite3 package]),
267                [with_included_sqlite3=$withval],
268                [with_included_sqlite3="unspecified"])
269
270# Check if sqlite3 package is already installed.
271if test "x$with_included_sqlite3" = "xunspecified" ; then
272        AC_CHECK_LIB([sqlite3],[sqlite3_open],
273                [with_included_sqlite3=no],
274                [with_included_sqlite3=yes])
275fi
276
277AC_ARG_WITH(
278                tcl-sqlite3,
279                AS_HELP_STRING([--with-tcl-sqlite3=DIR],
280                        [directory for Tcl sqlite3 (default /usr/lib/sqlite3)]),
281                [mp_sqlite3_dir=$withval],
282                [mp_sqlite3_dir=/usr/lib/sqlite3])
283
284# If sqlite3 package isn't installed, configure and install sqlite3 package.
285if test "$with_included_sqlite3" = "yes"; then
286        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES sqlite-3.1.3"
287        INCLUDES="$INCLUDES -I../sqlite-3.1.3"
288        AC_CONFIG_SUBDIRS([src/sqlite-3.1.3])
289        # Extract sqlite3 package
290        (cd src/; gzip -d < sqlite-3.1.3.tar.gz | tar xf -)
291        # patch sqlite3 with desired configure options
292        patch -p0 < src/sqlite-3.1.3.diff
293        # the new tclinstaller.tcl needs to have substitution occur
294        mv src/sqlite-3.1.3/tclinstaller.tcl src/sqlite-3.1.3/tclinstaller.tcl.in
295        SQLITE3_LIBS=`pwd`"/src/sqlite-3.1.3/.libs/libsqlite3.a"
296        if test "x$prefix" = "xNONE" ; then
297                SQLITE3_DIR=$ac_default_prefix/share/macports/Tcl/sqlite3
298        else
299                SQLITE3_DIR=$prefix/share/macports/Tcl/sqlite3
300        fi
301else
302        SQLITE3_LIBS="-lsqlite3"
303
304        AC_CACHE_CHECK([for Tcl sqlite3 location], [mp_cv_sqlite3_dir],
305                [mp_cv_sqlite3_dir=
306                test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
307                ])
308
309        SQLITE3_DIR=$mp_cv_sqlite3_dir
310fi
311
312AC_SUBST(SQLITE3_LIBS)
313AC_SUBST(SQLITE3_DIR)
314
315AH_TEMPLATE([TRACE_SDK], [SDK for SDK redirect in tracelib])
316AC_ARG_WITH(
317        trace-sdk,
318        AS_HELP_STRING([--with-trace-sdk=SDK],
319                [SDK for redirection in trace lib (for example MacOSX10.4u.sdk)]),
320        [test -d /Developer/SDKs/$withval && AC_DEFINE_UNQUOTED([TRACE_SDK], "${withval}")], [])
321       
322       
323# If /etc/paths.d and /etc/manpaths.d then we can install our path configuration
324AC_MSG_CHECKING(whether to install MacPorts paths into /etc/paths.d and /etc/manpaths.d)
325mpprefix=$prefix
326test "x$mpprefix" = "xNONE" && mpprefix=$ac_default_prefix
327if test -d /etc/paths.d -a -d /etc/manpaths.d -a "$mpprefix" = "$ac_default_prefix"; then
328        PATHCONF=pathconf
329        AC_MSG_RESULT([yes])
330else
331        AC_MSG_RESULT([no])
332fi
333
334
335# Allows building of shared libraries
336SC_ENABLE_SHARED
337
338# Pull compiler / linker values from tclConfig.sh
339CFLAGS_DEBUG=${TCL_CFLAGS_DEBUG}
340CFLAGS_OPTIMIZE=${TCL_CFLAGS_OPTIMIZE}
341LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG}
342LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE}
343SHLIB_LD=${TCL_SHLIB_LD}
344STLIB_LD=${TCL_STLIB_LD}
345SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}
346SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX}
347
348AC_SUBST(INCLUDES)
349AC_SUBST(CFLAGS_DEBUG)
350AC_SUBST(CFLAGS_OPTIMIZE)
351AC_SUBST(PATHCONF)
352AC_SUBST(STLIB_LD)
353AC_SUBST(SHLIB_LD)
354AC_SUBST(SHLIB_CFLAGS)
355AC_SUBST(SHLIB_LDFLAGS)
356AC_SUBST(SHLIB_SUFFIX)
357AC_SUBST(TCL_DEFS)
358AC_SUBST(TCL_STUB_LIB_SPEC)
359AC_SUBST(TCL_CC)
360AC_SUBST(OUR_INCLUDED_PACKAGES)
361
362# misc variables that need to be expanded for substitution into tcl
363
364oldprefix=$prefix
365if test "x$prefix" = "xNONE" ; then
366   prefix=$ac_default_prefix
367fi
368
369eval "prefix_expanded=$prefix"
370AC_SUBST(prefix_expanded)
371# do this twice, since there is a nested variable of
372# ${prefix} inside of ${sysconfdir}
373eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
374eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
375AC_SUBST(MPCONFIGDIR_EXPANDED)
376eval "localstatedir_expanded=$localstatedir"
377AC_SUBST(localstatedir_expanded)
378
379prefix=$oldprefix
380
381dnl man page settings (compressed, links, etc)
382dnl
383dnl SC_CONFIG_MANPAGES
384
385# Output
386AC_CONFIG_FILES([
387        Makefile
388        Mk/macports.autoconf.mk
389        doc/prefix.mtree
390        doc/macosx.mtree
391        doc/macports.conf
392        portmgr/freebsd/Makefile
393        portmgr/fedora/macports.spec
394        src/Makefile
395        src/macports1.0/macports_autoconf.tcl
396        src/tclobjc1.0/Makefile
397        src/pathconf/Makefile
398        src/pathconf/paths
399        src/pathconf/manpaths
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])
405
406AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.