source: trunk/base/configure.ac @ 28761

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

add check for <utime.h>

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