source: trunk/base/configure.ac @ 26186

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

MacPorts 1.5 again.

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