source: trunk/base/aclocal.m4 @ 4510

Last change on this file since 4510 was 4510, checked in by ssen, 17 years ago

On Darwin, if the user did not specify --prefix, install config files in
/private/etc/ports instead of /etc/ports, to comply with the standard
FS layout.

Regenerate configure on Mac OS X 10.3

  • Property svn:eol-style set to native
File size: 6.7 KB
Line 
1builtin(include,tcl.m4)
2
3dnl This macro checks if the user specified a dports tree
4dnl explicitly. If not, search for it
5
6# OD_PATH_DPORTSDIR(DEFAULT_DPORTSDIR)
7#---------------------------------------
8 AC_DEFUN([OD_PATH_DPORTSDIR],[
9        dnl For ease of reading, run after gcc has been found/configured
10        AC_REQUIRE([AC_PROG_CC])
11
12        AC_ARG_WITH(dports-dir, [AC_HELP_STRING([--with-dports-dir=DIR], [Specify alternate dports directory])], [ dportsdir="$withval" ] )
13
14
15        AC_MSG_CHECKING([for dports tree])
16        if test "x$dportsdir" != "x" ; then
17          if test -d "$dportsdir" -a -e "$dportsdir/PortIndex" ; then
18                :
19          else
20                AC_MSG_ERROR([$dportsdir not a valid dports tree])
21          fi
22        else
23                dnl If the user didn't give a path, look for default
24                if test "x$1" != "x" ; then
25                  if test -d "$1" -a -e "$1/PortIndex" ; then
26                        dportsdir=$1
27                  fi
28                fi
29        fi
30
31        if test "x$dportsdir" != "x" ; then
32                AC_MSG_RESULT($dportsdir)
33                DPORTSDIR="$dportsdir"
34                AC_SUBST(DPORTSDIR)
35        else
36                AC_MSG_WARN([No dports tree found])
37        fi
38
39         ])
40
41
42# OD_PATH_PORTCONFIGDIR(PREFIX)
43#---------------------------------------
44AC_DEFUN([OD_PATH_PORTCONFIGDIR],[
45        dnl if the user actually specified --prefix, shift
46        dnl portconfigdir to $prefix/etc/ports
47        dnl     AC_REQUIRE([OD_PATH_DPORTSDIR])
48       
49        AC_MSG_CHECKING([for ports config directory])
50
51        if test "$1" != "NONE" ; then
52                dnl user gave --prefix
53                portconfigdir='${sysconfdir}/ports'
54        else
55           case $host_os in
56           darwin*)
57                portconfigdir='/private/etc/ports'
58                ;;
59           *)
60                portconfigdir='/etc/ports'
61                ;;
62           esac
63        fi
64
65
66        AC_MSG_RESULT([$portconfigdir])
67        PORTCONFIGDIR="$portconfigdir"
68        AC_SUBST(PORTCONFIGDIR)
69
70        ])
71
72# OD_CHECK_INSTALLUSER
73#-------------------------------------------------
74AC_DEFUN([OD_CHECK_INSTALLUSER],[
75        dnl if with user specifies --with-install-user,
76        dnl use it. otherwise default to platform defaults
77        AC_REQUIRE([OD_PATH_PORTCONFIGDIR])
78
79        AC_ARG_WITH(install-user, [AC_HELP_STRING([--with-install-user=USER], [Specify user ownership of installed files])], [ DSTUSR=$withval ] )
80       
81        AC_MSG_CHECKING([for install user])
82        if test "x$DSTUSR" = "x" ; then
83           DSTUSR=root
84        fi
85
86        AC_MSG_RESULT([$DSTUSR])
87        AC_SUBST(DSTUSR)
88])
89
90# OD_CHECK_INSTALLGROUP
91#-------------------------------------------------
92AC_DEFUN([OD_CHECK_INSTALLGROUP],[
93        dnl if with user specifies --with-install-group,
94        dnl use it. otherwise default to platform defaults
95        AC_REQUIRE([OD_CHECK_INSTALLUSER])
96
97        AC_ARG_WITH(install-group, [AC_HELP_STRING([--with-install-group=GROUP], [Specify group ownership of installed files])], [ DSTGRP=$withval ] )
98
99        AC_MSG_CHECKING([for install group])
100        if test "x$DSTGRP" = "x" ; then
101           
102           case $host_os in
103           darwin*)
104                DSTGRP="admin"
105                ;;
106           *)
107                DSTGRP="wheel"
108                ;;
109           esac
110        fi
111
112        AC_MSG_RESULT([$DSTGRP])
113        AC_SUBST(DSTGRP)
114])
115
116# OD_LIB_MD5
117#---------------------------------------
118# Check for an md5 implementation
119AC_DEFUN([OD_LIB_MD5],[
120
121        # Check for libmd, which is prefered
122        AC_CHECK_LIB([md], [MD5Update],[
123                AC_CHECK_HEADERS([md5.h], ,[
124                        AC_MSG_ERROR([libmd was found, but md5.h is missing.])])
125                AC_DEFINE([HAVE_LIBMD], ,[Define if you have the `md' library (-lmd).])
126                MD5_LIBS="-lmd"]
127        )
128        if test "x$MD5_LIBS" = "x" ; then
129                # If libmd is not found, check for libcrypto from OpenSSL
130                AC_CHECK_LIB([crypto], [MD5_Update],[
131                        AC_CHECK_HEADERS([openssl/md5.h],,[
132                                AC_MSG_ERROR([libcrypt was found, but header file openssl/md5.h is missing.])])
133                                AC_DEFINE([HAVE_LIBCRYPTO],,[Define if you have the `crypto' library (-lcrypto).])
134                        MD5_LIBS="-lcrypto"
135                ], [
136                        AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.])
137                ])
138        fi
139        if test "x$MD5_LIBS" = "x"; then
140                AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.])
141        fi
142        AC_SUBST([MD5_LIBS])
143])
144
145# OD_PROG_MTREE
146#---------------------------------------
147AC_DEFUN([OD_PROG_MTREE],[
148
149        AC_PATH_PROG([MTREE], [mtree], ,  [/usr/bin:/usr/sbin:/bin:/sbin])
150
151        if test "x$MTREE" = "x" ; then
152                AC_CONFIG_SUBDIRS([src/programs/mtree])
153                MTREE='$(TOPSRCDIR)/src/programs/mtree/mtree'
154#               MTREE='${prefix}/bin/mtree'
155                REPLACEMENT_PROGS="$REPLACEMENT_PROGS mtree"
156        fi
157
158        AC_SUBST(MTREE)
159])
160
161#------------------------------------------------------------------------
162# OD_TCL_PACKAGE_DIR --
163#
164#       Locate the correct directory for Tcl package installation
165#
166# Arguments:
167#       None.
168#
169# Requires:
170#       TCLVERSION must be set
171#       CYGPATH must be set
172#       TCLSH must be set
173#
174# Results:
175#
176#       Adds a --with-tclpackage switch to configure.
177#       Result is cached.
178#
179#       Substs the following vars:
180#               TCL_PACKAGE_DIR
181#------------------------------------------------------------------------
182
183AC_DEFUN(OD_TCL_PACKAGE_DIR, [
184    AC_MSG_CHECKING(for Tcl package directory)
185
186    AC_ARG_WITH(tclpackage, [  --with-tclpackage       Tcl package installation directory.], with_tclpackagedir=${withval})
187
188    if test x"${with_tclpackagedir}" != x ; then
189        ac_cv_c_tclpkgd=${with_tclpackagedir}
190    else
191        AC_CACHE_VAL(ac_cv_c_tclpkgd, [
192            # Use the value from --with-tclpackagedir, if it was given
193
194            if test x"${with_tclpackagedir}" != x ; then
195                ac_cv_c_tclpkgd=${with_tclpackagedir}
196            else
197                # On darwin we can do some intelligent guessing
198                case $host_os in
199                    darwin*)
200                        tcl_autopath=`echo 'puts \$auto_path' | $TCLSH`
201                        for path in $tcl_autopath; do
202                            if test "$path" = "/Library/Tcl"; then
203                                ac_cv_c_tclpkgd="$path"
204                                break
205                            fi
206                            if test "$path" = "/System/Library/Tcl"; then
207                                if test -d "$path"; then
208                                    ac_cv_c_tclpkgd="$path"
209                                    break
210                                fi
211                            fi
212                        done
213                    ;;
214                esac
215                if test x"${ac_cv_c_tclpkgd}" = x ; then
216                    # Fudge a path from the first entry in the auto_path
217                    tcl_pkgpath=`echo 'puts [[lindex \$auto_path 0]]' | $TCLSH`
218                    if test -d "$tcl_pkgpath"; then
219                        ac_cv_c_tclpkgd="$tcl_pkgpath"
220                    fi
221                    # If the first entry does not exist, do nothing
222                fi
223            fi
224        ])
225    fi
226
227    if test x"${ac_cv_c_tclpkgd}" = x ; then
228        AC_MSG_ERROR(Tcl package directory not found.  Please specify its location with --with-tclpackagedir)
229    else
230        AC_MSG_RESULT(${ac_cv_c_tclpkgd})
231    fi
232
233    # Convert to a native path and substitute into the output files.
234
235    PACKAGE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclpkgd}`
236
237    TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE}
238
239    AC_SUBST(TCL_PACKAGE_DIR)
240])
241
242# OD_PROG_TCLSH
243#---------------------------------------
244AC_DEFUN([OD_PROG_TCLSH],[
245
246
247        case $host_os in
248                freebsd*)
249                        # FreeBSD installs a dummy tclsh (annoying)
250                        # Look for a real versioned tclsh first
251                        AC_PATH_PROG([TCLSH], [tclsh${TCL_VERSION} tclsh])
252                        ;;
253                *)
254                        # Otherwise, look for a non-versioned tclsh
255                        AC_PATH_PROG([TCLSH], [tclsh tclsh${TCL_VERSION}])
256                        ;;
257        esac
258        if test "x$TCLSH" = "x" ; then
259                AC_MSG_ERROR([Could not find tclsh])
260        fi
261
262        AC_SUBST(TCLSH)
263])
264
Note: See TracBrowser for help on using the repository browser.