source: trunk/base/configure.ac @ 29367

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

autoconf sed extended regexp flag

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