source: trunk/base/configure.ac @ 34314

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

autoconf all universal options

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.0 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2dnl $Id: configure.ac 34314 2008-02-21 12:24:40Z afb@macports.org $
3AC_PREREQ(2.52)
4AC_DEFUN([MACPORTS_VERSION_MACRO], [esyscmd(cat config/macports_version | tr -d '\n')])
5AC_INIT([MacPorts], [MACPORTS_VERSION_MACRO], [macports-dev@lists.macosforge.org], [macports])
6AC_CONFIG_SRCDIR([src/pextlib1.0/Pextlib.c])
7AC_CONFIG_HEADERS([src/config.h])
8AC_CANONICAL_SYSTEM
9
10# Read in the MacPorts version from the base/config/macports_vesion file
11AC_MSG_CHECKING(MacPorts version)
12MACPORTS_VERSION=MACPORTS_VERSION_MACRO
13AC_MSG_RESULT([$MACPORTS_VERSION])
14AC_SUBST(MACPORTS_VERSION)
15# Read the old, floating point format version, which we still use internally, and export it for the $macports::autoconf::macports_version variable
16MP_VERSION=$(cat config/mp_version | tr -d '\n')
17AC_SUBST(MP_VERSION)
18
19# Check user PATH for MP paths, and remove as necessary.
20MP_PATH_SCAN
21
22AC_CHECK_PROGS(SW_VERS, sw_vers)
23if test "x$SW_VERS" != "x"; then
24  AC_MSG_CHECKING(Mac OS X version)
25  MACOSX_VERSION=`$SW_VERS -productVersion | cut -f 1-3 -d.`
26  AC_MSG_RESULT([$MACOSX_VERSION])
27fi
28
29case "$MACOSX_VERSION" in
30  10.0*|10.1*|10.2*)
31    AC_WARN(This version of Mac OS X is not supported)
32    AC_WARN(Please upgrade at http://store.apple.com/)
33    ;;
34  10.1.[[0-4]]|10.2.[[0-7]]|10.3.[[0-8]]|10.4.[[0-8]])
35    AC_WARN(This version of Mac OS X is out of date)
36    AC_WARN(Please run Software Update to update it)
37    ;;
38  10.3*|10.4*|10.5*)
39    dnl Supported version
40    ;;
41  *)
42    ;;
43esac
44
45XCODEPLIST=/Developer/Applications/Xcode.app/Contents/version.plist
46if test -r "$XCODEPLIST"; then
47  AC_MSG_CHECKING(Xcode version)
48  XCODE_VERSION=`tr -d '\r\n' < $XCODEPLIST | sed -e 's/.*<key>CFBundleShortVersionString<\/key>.<string>\([[0-9.]]*\)<\/string>.*/\1/'`
49  AC_MSG_RESULT([$XCODE_VERSION])
50fi
51
52case "$XCODE_VERSION" in
53  1.[[0-1]]*|2.[[0-1]]*)
54    AC_WARN(This version of Xcode Tools is not supported)
55    AC_WARN(Please upgrade at http://connect.apple.com/)
56    ;;
57  1.[[2-4]]*|2.[[2-3]]*)
58    AC_WARN(This version of Xcode Tools is out of date)
59    AC_WARN(Please consider upgrading as some ports fail compiling)
60    ;;
61  1.5*|2.4*|3.*)
62    dnl Supported version
63    ;;
64  *)
65    ;;
66esac
67
68# Checks for programs.
69AC_PROG_CC
70AC_PROG_OBJC
71AC_PROG_INSTALL
72AC_PROG_MAKE_SET
73AC_PROG_LN_S
74AC_PATH_PROG(MTREE, [mtree], [], [$PATH:/usr/sbin])
75AC_PATH_PROG(CVS, [cvs], [])
76AC_PATH_PROG(SVN, [svn], [])
77AC_PATH_PROG(RSYNC, [rsync], [])
78AC_PATH_PROG(SED, [sed])
79AC_PATH_PROG(TAR, [tar])
80AC_PATH_PROG(MAKE, [make])
81AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
82AC_PATH_PROG(LAUNCHCTL, [launchctl], [])
83AC_PATH_PROG(XCODEBUILD, [xcodebuild], [])
84AC_PATH_PROGS(GNUTAR, [gnutar gtar], [], [$PATH:/usr/local/bin])
85AC_PATH_PROGS(GNUMAKE, [gnumake gmake], [], [$PATH:/usr/local/bin])
86AC_PATH_PROG(BZIP2, [bzip2], [])
87AC_PATH_PROG(XAR, [xar], [])
88AC_PATH_PROG(OPEN, [open], [])
89
90# Define some precious variables allowing user to override PATH for some programs
91AC_ARG_VAR(MTREE, [path to mtree command])
92AC_ARG_VAR(CVS, [path to cvs command])
93AC_ARG_VAR(SVN, [path to svn command])
94AC_ARG_VAR(RSYNC, [path to rsync command])
95AC_ARG_VAR(SED, [path to sed command])
96AC_ARG_VAR(TAR, [path to tar command])
97AC_ARG_VAR(MAKE, [path to make command])
98AC_ARG_VAR(GNUTAR, [path to gnutar command])
99AC_ARG_VAR(GNUMAKE, [path to gnumake command])
100AC_ARG_VAR(BZIP2, [path to bzip2 command])
101AC_ARG_VAR(XAR, [path to xar command])
102AC_ARG_VAR(OPEN, [path to open command])
103
104MP_SED_EXTENDED_REGEXP
105MP_TAR_NO_SAME_OWNER
106
107# Quiche eaters options.
108if test x$GCC = xyes; then
109        CFLAGS_QUICHEEATERS='-W -Wall -pedantic'
110fi
111AC_SUBST(CFLAGS_QUICHEEATERS)
112MP_WERROR
113
114MP_COMPILER_ATTRIBUTE_UNUSED
115MP_COMPILER_ATTRIBUTE_LF_PRIVATE
116
117# Foundation checks
118ACX_PTHREAD
119MP_OBJC_RUNTIME
120MP_OBJC_FOUNDATION
121
122MP_PROG_DAEMONDO
123#MP_PROG_XAR
124
125AC_SUBST(REPLACEMENT_PROGS)
126AC_SUBST(EXTRA_PROGS)
127
128# set default ports-directory
129PORTS_DIR_DEFAULT=`pwd | sed -e "s/base/ports/"`
130
131# Check for paths
132AC_PREFIX_DEFAULT(/opt/local)
133MP_PATH_PORTSDIR([$PORTS_DIR_DEFAULT])
134MP_PATH_MPCONFIGDIR
135
136# Check for install ownership
137MP_CHECK_INSTALLUSER
138MP_CHECK_INSTALLGROUP
139MP_DIRECTORY_MODE
140
141# Check for default directories
142MP_PATH_APPLICATIONS
143MP_PATH_FRAMEWORKS
144
145# Check for universal options
146MP_UNIVERSAL_OPTIONS
147
148# Check for standard header files.
149AC_HEADER_STDC
150AC_HEADER_DIRENT
151AC_HEADER_SYS_WAIT
152AC_HEADER_STAT
153AC_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 \
154        readline/readline.h readline/history.h pwd.h sys/paths.h utime.h])
155
156INCLUDES="-I.. -I. $INCLUDES"
157
158# Checks for library functions.
159AC_FUNC_CLOSEDIR_VOID
160AC_FUNC_FORK
161AC_FUNC_STRERROR_R
162AC_CHECK_FUNCS([bzero memset dup2 regcomp strdup strerror strtol fgetln lockf flock setmode strcasecmp strncasecmp strlcpy copyfile])
163MP_CHECK_READLINK_IS_P1003_1A
164
165AC_ARG_WITH(x11-prefix, [AC_HELP_STRING([--with-x11-prefix=PREFIX], [use PREFIX as the X11 base dir (default autodetect)])], [ x11prefix="$withval" ] )
166case "$x11prefix" in
167  "")
168    # default to traditional value
169    x11prefix=/usr/X11R6
170    ;;
171  *)
172    x_includes=$x11prefix/include
173    x_libraries=$x11prefix/lib
174    ;;
175esac
176
177# Check for md5 implementation
178MP_LIB_MD5
179# Check for X11 and paraphernalia
180MP_CHECK_X11
181
182AC_MSG_CHECKING(for X11 prefix)
183X_INCLUDES_PREFIX=`echo "$x_includes" | sed "s,/include,,"`
184X_LIBRARIES_PREFIX=`echo "$x_libraries" | sed "s,/lib,,"`
185if test "x$have_x" = "xyes" -a "x$X_INCLUDES_PREFIX" = "x$X_LIBRARIES_PREFIX" -a "x$X_LIBRARIES_PREFIX" != x; then
186    x11prefix=$X_LIBRARIES_PREFIX
187fi
188AC_MSG_RESULT([$x11prefix])
189AC_SUBST(x11prefix)
190
191# Check for readline
192AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [Enable addition of readline support, if readline present.]),
193[
194        AC_CHECK_LIB([readline], [readline], [
195                                  READLINE_LIBS=-lreadline
196                                  AC_DEFINE([HAVE_LIBREADLINE], [1], [Define to 1 if you have the `readline' library (-lreadline).])
197                                  ])
198        AC_CHECK_DECLS([rl_username_completion_function,rl_filename_completion_function,rl_completion_matches,username_completion_function,filename_completion_function,completion_matches], [], [],
199        [
200        #include <stdio.h>
201        #if HAVE_READLINE_READLINE_H
202        # include <readline/readline.h>
203        #endif
204        ])
205])
206AC_SUBST(READLINE_LIBS)
207
208# Lowest non-system-reserved uid and gid (Apple claims <500)
209AC_DEFINE([MIN_USABLE_UID], [500], [Lowest non-system-reserved UID.])
210AC_DEFINE([MIN_USABLE_GID], [500], [Lowest non-system-reserved GID.])
211
212# Load tclConfig.sh
213SC_PATH_TCLCONFIG
214SC_LOAD_TCLCONFIG
215
216# Check for Tcl public headers
217dnl XXX  hardwire CYGPATH (CYGPATH must be set for SC_PUBLIC_TCL_HEADERS)
218CYGPATH=echo
219SC_PUBLIC_TCL_HEADERS
220
221# Check for tclsh binary
222MP_PROG_TCLSH
223
224# Check for Tcl package path
225MP_TCL_PACKAGE_DIR
226
227# Check if thread is enabled.
228MP_TCL_THREAD_SUPPORT
229
230## libcurl
231MP_LIBCURL_FLAGS
232
233# Do we have curl_easy_strerror?
234AH_TEMPLATE([HAVE_CURL_EASY_STRERROR],
235               [Define to 1 if you have the curl_easy_strerror function.])
236AC_CHECK_LIB([curl], [curl_easy_strerror],
237        [AC_DEFINE([HAVE_CURL_EASY_STRERROR])],[],
238        [$LDFLAGS_LIBCURL])
239
240# Determine if we need to install some bundled packages
241OUR_INCLUDED_PACKAGES=
242
243## Thread package.
244AC_ARG_WITH(
245                included-tclthread,
246                AS_HELP_STRING([--with-included-tclthread],
247                        [install included Thread package.]),
248                [with_included_tclthread=$withval],
249                [with_included_tclthread="unspecified"])
250
251# Check if thread package is already installed.
252if test "x$with_included_tclthread" = "xunspecified" ; then
253        MP_TCL_PACKAGE(
254                [Thread],
255                [AC_MSG_RESULT([yes]); with_included_tclthread=no],
256                [AC_MSG_RESULT([no]); with_included_tclthread=yes])
257fi
258
259# If thread package isn't installed, configure and install thread package.
260if test "$with_included_tclthread" = "yes"; then
261        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
262        AC_CONFIG_SUBDIRS([src/thread2.6])
263        # Extract thread package
264        (cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
265        # Patch thread package (so thread2.6 is the vanilla distribution directory)
266        patch -p0 < src/thread2.6.diff
267fi
268
269## sqlite3 package.
270AC_ARG_WITH(
271                included-sqlite3,
272                AS_HELP_STRING([--with-included-sqlite3],
273                        [build using bundled sqlite3 package]),
274                [with_included_sqlite3=$withval],
275                [with_included_sqlite3="unspecified"])
276
277# Check if sqlite3 package is already installed.
278if test "x$with_included_sqlite3" = "xunspecified" ; then
279        AC_CHECK_LIB([sqlite3],[sqlite3_open],
280                [with_included_sqlite3=no],
281                [with_included_sqlite3=yes])
282fi
283
284AC_ARG_WITH(
285                tcl-sqlite3,
286                AS_HELP_STRING([--with-tcl-sqlite3=DIR],
287                        [directory for Tcl sqlite3 (default /usr/lib/sqlite3)]),
288                [mp_sqlite3_dir=$withval],
289                [mp_sqlite3_dir=/usr/lib/sqlite3])
290
291# If sqlite3 package isn't installed, configure and install sqlite3 package.
292if test "$with_included_sqlite3" = "yes"; then
293        OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES sqlite-3.1.3"
294        INCLUDES="$INCLUDES -I../sqlite-3.1.3"
295        AC_CONFIG_SUBDIRS([src/sqlite-3.1.3])
296        # Extract sqlite3 package
297        (cd src/; gzip -d < sqlite-3.1.3.tar.gz | tar xf -)
298        # patch sqlite3 with desired configure options
299        patch -p0 < src/sqlite-3.1.3.diff
300        # the new tclinstaller.tcl needs to have substitution occur
301        mv src/sqlite-3.1.3/tclinstaller.tcl src/sqlite-3.1.3/tclinstaller.tcl.in
302        SQLITE3_LIBS=`pwd`"/src/sqlite-3.1.3/.libs/libsqlite3.a"
303        if test "x$prefix" = "xNONE" ; then
304                SQLITE3_DIR=$ac_default_prefix/share/macports/Tcl/sqlite3
305        else
306                SQLITE3_DIR=$prefix/share/macports/Tcl/sqlite3
307        fi
308else
309        SQLITE3_LIBS="-lsqlite3"
310
311        AC_CACHE_CHECK([for Tcl sqlite3 location], [mp_cv_sqlite3_dir],
312                [mp_cv_sqlite3_dir=
313                test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
314                ])
315
316        SQLITE3_DIR=$mp_cv_sqlite3_dir
317fi
318
319AC_SUBST(SQLITE3_LIBS)
320AC_SUBST(SQLITE3_DIR)
321
322AH_TEMPLATE([TRACE_SDK], [SDK for SDK redirect in tracelib])
323AC_ARG_WITH(
324        trace-sdk,
325        AS_HELP_STRING([--with-trace-sdk=SDK],
326                [SDK for redirection in trace lib (for example MacOSX10.4u.sdk)]),
327        [test -d /Developer/SDKs/$withval && AC_DEFINE_UNQUOTED([TRACE_SDK], "${withval}")], [])
328       
329       
330# If /etc/paths.d and /etc/manpaths.d then we can install our path configuration
331# (this code is currently disabled since this mechanism implies that MacPorts paths are
332# added after the system's paths, and so MacPorts commands would not override system functions).
333AC_MSG_CHECKING(whether to install MacPorts paths into /etc/paths.d and /etc/manpaths.d)
334mpprefix=$prefix
335test "x$mpprefix" = "xNONE" && mpprefix=$ac_default_prefix
336if false && test -d /etc/paths.d -a -d /etc/manpaths.d -a "$mpprefix" = "$ac_default_prefix"; then
337        PATHCONF=pathconf
338        AC_MSG_RESULT([yes])
339else
340        AC_MSG_RESULT([no])
341fi
342
343
344# Allows building of shared libraries
345SC_ENABLE_SHARED
346
347# Pull compiler / linker values from tclConfig.sh
348CFLAGS_DEBUG=${TCL_CFLAGS_DEBUG}
349CFLAGS_OPTIMIZE=${TCL_CFLAGS_OPTIMIZE}
350LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG}
351LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE}
352SHLIB_LD=${TCL_SHLIB_LD}
353STLIB_LD=${TCL_STLIB_LD}
354SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}
355SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX}
356
357AC_SUBST(INCLUDES)
358AC_SUBST(CFLAGS_DEBUG)
359AC_SUBST(CFLAGS_OPTIMIZE)
360AC_SUBST(PATHCONF)
361AC_SUBST(STLIB_LD)
362AC_SUBST(SHLIB_LD)
363AC_SUBST(SHLIB_CFLAGS)
364AC_SUBST(SHLIB_LDFLAGS)
365AC_SUBST(SHLIB_SUFFIX)
366AC_SUBST(TCL_DEFS)
367AC_SUBST(TCL_STUB_LIB_SPEC)
368AC_SUBST(TCL_CC)
369AC_SUBST(OUR_INCLUDED_PACKAGES)
370
371# misc variables that need to be expanded for substitution into tcl
372
373oldprefix=$prefix
374if test "x$prefix" = "xNONE" ; then
375   prefix=$ac_default_prefix
376fi
377
378eval "prefix_expanded=$prefix"
379AC_SUBST(prefix_expanded)
380# do this twice, since there is a nested variable of
381# ${prefix} inside of ${sysconfdir}
382eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR"
383eval "MPCONFIGDIR_EXPANDED=$MPCONFIGDIR_EXPANDED"
384AC_SUBST(MPCONFIGDIR_EXPANDED)
385eval "localstatedir_expanded=$localstatedir"
386AC_SUBST(localstatedir_expanded)
387
388prefix=$oldprefix
389
390dnl man page settings (compressed, links, etc)
391dnl
392dnl SC_CONFIG_MANPAGES
393
394# Output
395AC_CONFIG_FILES([
396        Doxyfile
397        Makefile
398        Mk/macports.autoconf.mk
399        doc/prefix.mtree
400        doc/macosx.mtree
401        doc/macports.conf
402        portmgr/freebsd/Makefile
403        portmgr/fedora/macports.spec
404        src/Makefile
405        src/macports1.0/macports_autoconf.tcl
406        src/tclobjc1.0/Makefile
407        src/pathconf/Makefile
408        src/pathconf/paths
409        src/pathconf/manpaths
410        src/port1.0/port_autoconf.tcl
411        src/registry1.0/registry_autoconf.tcl
412        src/programs/Makefile
413        src/macports1.0/macports_fastload.tcl
414])
415
416AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.