source: trunk/base/configure.ac @ 29115

Last change on this file since 29115 was 28822, checked in by afb@…, 12 years ago

portable sed regexp now. looks like snoopy swearing.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.5 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2dnl $Id: configure.ac 28822 2007-09-09 15:48:40Z afb@macports.org $
3AC_PREREQ(2.52)
4AC_INIT([MacPorts], [esyscmd(cat config/mp_version | tr -d '\n')], [macports-dev@lists.macosforge.org], [macports])
5AC_CONFIG_SRCDIR([src/pextlib1.0/Pextlib.c])
6AC_CONFIG_HEADERS([src/config.h])
7AC_CANONICAL_SYSTEM
8
9# Check user PATH for MP paths, and remove as necessary.
10MP_PATH_SCAN
11
12# translate mp_version (1.600) to regular version (1.6.0)
13AC_MSG_CHECKING(MacPorts version)
14MP_VERSION=`cat config/mp_version | tr -d '\n'`
15VER=`echo $MP_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)0\{0,1\}\([[0-9]][[1-9]]\{0,1\}\)0\{0,1\}/\1.\2.\3/'`
16AC_MSG_RESULT([$VER])
17AC_SUBST(VER)
18
19# Checks for programs.
20AC_PROG_CC
21AC_PROG_OBJC
22AC_PROG_INSTALL
23AC_PROG_MAKE_SET
24AC_PROG_LN_S
25AC_PATH_PROG(MTREE, [mtree], [], [$PATH:/usr/sbin])
26AC_PATH_PROG(CVS, [cvs], [])
27AC_PATH_PROG(SVN, [svn], [])
28AC_PATH_PROG(RSYNC, [rsync], [])
29AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
30AC_PATH_PROG(LAUNCHCTL, [launchctl], [])
31AC_PATH_PROG(XCODEBUILD, [xcodebuild], [])
32AC_PATH_PROG(BZIP2, [bzip2], [])
33AC_PATH_PROG(XAR, [xar], [])
34AC_PATH_PROG(OPEN, [open], [])
35
36# Define some precious variables allowing user to override PATH for some programs
37AC_ARG_VAR(MTREE, [path to mtree command])
38AC_ARG_VAR(CVS, [path to cvs command])
39AC_ARG_VAR(SVN, [path to svn command])
40AC_ARG_VAR(RSYNC, [path to rsync command])
41AC_ARG_VAR(TAR, [path to tar command])
42AC_ARG_VAR(GNUTAR, [path to gnutar command])
43AC_ARG_VAR(BZIP2, [path to bzip2 command])
44AC_ARG_VAR(XAR, [path to xar command])
45AC_ARG_VAR(OPEN, [path to open command])
46
47MP_TAR_NO_SAME_OWNER
48
49# Quiche eaters options.
50if test x$GCC = xyes; then
51        CFLAGS_QUICHEEATERS='-W -Wall -pedantic'
52fi
53AC_SUBST(CFLAGS_QUICHEEATERS)
54MP_WERROR
55
56MP_COMPILER_ATTRIBUTE_UNUSED
57MP_COMPILER_ATTRIBUTE_LF_PRIVATE
58
59# Foundation checks
60ACX_PTHREAD
61MP_OBJC_RUNTIME
62MP_OBJC_FOUNDATION
63
64MP_PROG_DAEMONDO
65#MP_PROG_XAR
66
67AC_SUBST(REPLACEMENT_PROGS)
68AC_SUBST(EXTRA_PROGS)
69
70# set default ports-directory
71PORTS_DIR_DEFAULT=`pwd | sed -e "s/base/ports/"`
72
73# Check for paths
74AC_PREFIX_DEFAULT(/opt/local)
75MP_PATH_PORTSDIR([$PORTS_DIR_DEFAULT])
76MP_PATH_MPCONFIGDIR
77
78# Check for install ownership
79MP_CHECK_INSTALLUSER
80MP_CHECK_INSTALLGROUP
81MP_DIRECTORY_MODE
82
83# Check for standard header files.
84AC_HEADER_STDC
85AC_HEADER_DIRENT
86AC_HEADER_SYS_WAIT
87AC_HEADER_STAT
88AC_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 \
89        readline/readline.h readline/history.h pwd.h sys/paths.h utime.h])
90
91INCLUDES="-I.. -I. $INCLUDES"
92
93# Checks for library functions.
94AC_FUNC_CLOSEDIR_VOID
95AC_FUNC_FORK
96AC_FUNC_STRERROR_R
97AC_CHECK_FUNCS([bzero memset dup2 regcomp strdup strerror strtol fgetln lockf flock setmode strcasecmp strncasecmp strlcpy copyfile])
98MP_CHECK_READLINK_IS_P1003_1A
99
100# Check for md5 implementation
101MP_LIB_MD5
102# Check for X11 and paraphernalia
103MP_CHECK_X11
104
105# Check for readline
106AC_CHECK_LIB([readline], [readline], [
107              READLINE_LIBS=-lreadline
108              AC_DEFINE([HAVE_LIBREADLINE], [1], [Define to 1 if you have the `readline' library (-lreadline).])
109              ])
110AC_CHECK_DECLS([rl_username_completion_function,rl_filename_completion_function,rl_completion_matches,username_completion_function,filename_completion_function,completion_matches], [], [],
111[
112#include <stdio.h>
113#if HAVE_READLINE_READLINE_H
114# include <readline/readline.h>
115#endif
116])
117AC_SUBST(READLINE_LIBS)
118
119# Lowest non-system-reserved uid and gid (Apple claims <500)
120AC_DEFINE([MIN_USABLE_UID], [500], [Lowest non-system-reserved UID.])
121AC_DEFINE([MIN_USABLE_GID], [500], [Lowest non-system-reserved GID.])
122
123# Load tclConfig.sh
124SC_PATH_TCLCONFIG
125SC_LOAD_TCLCONFIG
126
127# Check for Tcl public headers
128dnl XXX  hardwire CYGPATH (CYGPATH must be set for SC_PUBLIC_TCL_HEADERS)
129CYGPATH=echo
130SC_PUBLIC_TCL_HEADERS
131
132# Check for tclsh binary
133MP_PROG_TCLSH
134
135# Check for Tcl package path
136MP_TCL_PACKAGE_DIR
137
138# Check if thread is enabled.
139MP_TCL_THREAD_SUPPORT
140
141## libcurl
142MP_LIBCURL_FLAGS
143
144# Do we have curl_easy_strerror?
145AH_TEMPLATE([HAVE_CURL_EASY_STRERROR],
146               [Define to 1 if you have the curl_easy_strerror function.])
147AC_CHECK_LIB([curl], [curl_easy_strerror],
148        [AC_DEFINE([HAVE_CURL_EASY_STRERROR])],[],
149        [$LDFLAGS_LIBCURL])
150
151# Determine if we need to install some bundled packages
152OUR_INCLUDED_PACKAGES=
153
154## Thread package.
155AC_ARG_WITH(
156                included-tclthread,
157                AS_HELP_STRING([--with-included-tclthread],
158                        [install included Thread package.]),
159                [with_included_tclthread=$withval],
160                [with_included_tclthread="unspecified"])
161
162# Check if thread package is already installed.
163if test "x$with_included_tclthread" = "xunspecified" ; then
164        MP_TCL_PACKAGE(
165                [Thread],
166                [AC_MSG_RESULT([yes]); with_included_tclthread=no],
167                [AC_MSG_RESULT([no]); with_included_tclthread=yes])
168fi
169
170# If thread package isn't installed, configure and install thread package.
171if test "$with_included_tclthread" = "yes"; then
172        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
173        AC_CONFIG_SUBDIRS([src/thread2.6])
174        # Extract thread package
175        (cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
176        # Patch thread package (so thread2.6 is the vanilla distribution directory)
177        patch -p0 < src/thread2.6.diff
178fi
179
180## sqlite3 package.
181AC_ARG_WITH(
182                included-sqlite3,
183                AS_HELP_STRING([--with-included-sqlite3],
184                        [build using bundled sqlite3 package]),
185                [with_included_sqlite3=$withval],
186                [with_included_sqlite3="unspecified"])
187
188# Check if sqlite3 package is already installed.
189if test "x$with_included_sqlite3" = "xunspecified" ; then
190        AC_CHECK_LIB([sqlite3],[sqlite3_open],
191                [with_included_sqlite3=no],
192                [with_included_sqlite3=yes])
193fi
194
195AC_ARG_WITH(
196                tcl-sqlite3,
197                AS_HELP_STRING([--with-tcl-sqlite3=DIR],
198                        [directory for Tcl sqlite3 (default /usr/lib/sqlite3)]),
199                [mp_sqlite3_dir=$withval],
200                [mp_sqlite3_dir=/usr/lib/sqlite3])
201
202# If sqlite3 package isn't installed, configure and install sqlite3 package.
203if test "$with_included_sqlite3" = "yes"; then
204        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES sqlite-3.1.3"
205        AC_CONFIG_SUBDIRS([src/sqlite-3.1.3])
206        # Extract sqlite3 package
207        (cd src/; gzip -d < sqlite-3.1.3.tar.gz | tar xf -)
208        # patch sqlite3 with desired configure options
209        patch -p0 < src/sqlite-3.1.3.diff
210        # the new tclinstaller.tcl needs to have substitution occur
211        mv src/sqlite-3.1.3/tclinstaller.tcl src/sqlite-3.1.3/tclinstaller.tcl.in
212        SQLITE3_LIBS=`pwd`"/src/sqlite-3.1.3/.libs/libsqlite3.a"
213        if test "x$prefix" = "xNONE" ; then
214                SQLITE3_DIR=$ac_default_prefix/share/macports/Tcl/sqlite3
215        else
216                SQLITE3_DIR=$prefix/share/macports/Tcl/sqlite3
217        fi
218else
219        SQLITE3_LIBS="-lsqlite3"
220
221        AC_CACHE_CHECK([for Tcl sqlite3 location], [mp_cv_sqlite3_dir],
222                [mp_cv_sqlite3_dir=
223                test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
224                ])
225
226        SQLITE3_DIR=$mp_cv_sqlite3_dir
227fi
228
229AC_SUBST(SQLITE3_LIBS)
230AC_SUBST(SQLITE3_DIR)
231
232AC_SUBST(OUR_INCLUDED_PACKAGES)
233
234AH_TEMPLATE([TRACE_SDK], [SDK for SDK redirect in tracelib])
235AC_ARG_WITH(
236        trace-sdk,
237        AS_HELP_STRING([--with-trace-sdk=SDK],
238                [SDK for redirection in trace lib (for example MacOSX10.4u.sdk)]),
239        [test -d /Developer/SDKs/$withval && AC_DEFINE_UNQUOTED([TRACE_SDK], "${withval}")], [])
240
241# Allows building of shared libraries
242SC_ENABLE_SHARED
243
244# Pull compiler / linker values from tclConfig.sh
245CFLAGS_DEBUG=${TCL_CFLAGS_DEBUG}
246CFLAGS_OPTIMIZE=${TCL_CFLAGS_OPTIMIZE}
247LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG}
248LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE}
249SHLIB_LD=${TCL_SHLIB_LD}
250STLIB_LD=${TCL_STLIB_LD}
251SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}
252SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX}
253
254AC_SUBST(INCLUDES)
255AC_SUBST(CFLAGS_DEBUG)
256AC_SUBST(CFLAGS_OPTIMIZE)
257AC_SUBST(TCL_DEFS)
258AC_SUBST(STLIB_LD)
259AC_SUBST(SHLIB_LD)
260AC_SUBST(SHLIB_CFLAGS)
261AC_SUBST(SHLIB_LDFLAGS)
262AC_SUBST(SHLIB_SUFFIX)
263AC_SUBST(TCL_STUB_LIB_SPEC)
264AC_SUBST(TCL_CC)
265
266# misc variables that need to be expanded for substitution into tcl
267
268oldprefix=$prefix
269if test "x$prefix" = "xNONE" ; then
270   prefix=$ac_default_prefix
271fi
272
273eval "prefix_expanded=$prefix"
274AC_SUBST(prefix_expanded)
275# do this twice, since there is a nested variable of
276# ${prefix} inside of ${sysconfdir}
277eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
278eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
279AC_SUBST(MPCONFIGDIR_EXPANDED)
280eval "localstatedir_expanded=$localstatedir"
281AC_SUBST(localstatedir_expanded)
282
283prefix=$oldprefix
284
285dnl man page settings (compressed, links, etc)
286dnl
287dnl SC_CONFIG_MANPAGES
288
289# Output
290AC_CONFIG_FILES([
291        Makefile
292        Mk/macports.autoconf.mk
293        doc/prefix.mtree
294        doc/macosx.mtree
295        doc/macports.conf
296        src/Makefile
297        src/macports1.0/macports_autoconf.tcl
298        src/tclobjc1.0/Makefile
299        src/port1.0/port_autoconf.tcl
300        src/registry1.0/registry_autoconf.tcl
301        src/programs/Makefile
302        src/macports1.0/macports_fastload.tcl
303])
304
305AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.