source: trunk/base/configure.ac @ 26855

Last change on this file since 26855 was 26710, checked in by landonf@…, 13 years ago

Add missing macro for detecting pthread compiler/linker flags.

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