source: trunk/base/aclocal.m4 @ 3937

Last change on this file since 3937 was 3937, checked in by fkr, 17 years ago

Bug:
Submitted by:
Reviewed by:
Approved by:
Obtained from:

enable --with-dports-dir.
Attention: this changes the default behavior upon installation, since it will
configure $PREFIX/$portconfigdir/sources.conf (commonly /etc/ports/sources.conf)
If you don't re-install (and remove your old sources.conf prior to that), this won't affect you.
(and it should not, since you most likely have a already configured sources.conf).
By default, it will add the dports-tree from your checked out copy from which you install
to sources.conf.

  • 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(DEFAULT_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 "$2" != "NONE" ; then
52                dnl user gave --prefix
53                portconfigdir='${sysconfdir}/ports'
54        else
55                dnl just use the default /etc/ports
56                portconfigdir='/etc/ports'
57        fi
58
59
60        AC_MSG_RESULT([$portconfigdir])
61        PORTCONFIGDIR="$portconfigdir"
62        AC_SUBST(PORTCONFIGDIR)
63
64        ])
65
66# OD_CHECK_INSTALLUSER
67#-------------------------------------------------
68AC_DEFUN([OD_CHECK_INSTALLUSER],[
69        dnl if with user specifies --with-install-user,
70        dnl use it. otherwise default to platform defaults
71        AC_REQUIRE([OD_PATH_PORTCONFIGDIR])
72
73        AC_ARG_WITH(install-user, [AC_HELP_STRING([--with-install-user=USER], [Specify user ownership of installed files])], [ DSTUSR=$withval ] )
74       
75        AC_MSG_CHECKING([for install user])
76        if test "x$DSTUSR" = "x" ; then
77           DSTUSR=root
78        fi
79
80        AC_MSG_RESULT([$DSTUSR])
81        AC_SUBST(DSTUSR)
82])
83
84# OD_CHECK_INSTALLGROUP
85#-------------------------------------------------
86AC_DEFUN([OD_CHECK_INSTALLGROUP],[
87        dnl if with user specifies --with-install-group,
88        dnl use it. otherwise default to platform defaults
89        AC_REQUIRE([OD_CHECK_INSTALLUSER])
90
91        AC_ARG_WITH(install-group, [AC_HELP_STRING([--with-install-group=GROUP], [Specify group ownership of installed files])], [ DSTGRP=$withval ] )
92
93        AC_MSG_CHECKING([for install group])
94        if test "x$DSTGRP" = "x" ; then
95           
96           case $host_os in
97           darwin*)
98                DSTGRP="admin"
99                ;;
100           *)
101                DSTGRP="wheel"
102                ;;
103           esac
104        fi
105
106        AC_MSG_RESULT([$DSTGRP])
107        AC_SUBST(DSTGRP)
108])
109
110# OD_LIB_MD5
111#---------------------------------------
112# Check for an md5 implementation
113AC_DEFUN([OD_LIB_MD5],[
114
115        # Check for libmd, which is prefered
116        AC_CHECK_LIB([md], [MD5Update],[
117                AC_CHECK_HEADERS([md5.h], ,[
118                        AC_MSG_ERROR([libmd was found, but md5.h is missing.])])
119                AC_DEFINE([HAVE_LIBMD], ,[Define if you have the `md' library (-lmd).])
120                MD5_LIBS="-lmd"]
121        )
122        if test "x$MD5_LIBS" = "x" ; then
123                # If libmd is not found, check for libcrypto from OpenSSL
124                AC_CHECK_LIB([crypto], [MD5_Update],[
125                        AC_CHECK_HEADERS([openssl/md5.h],,[
126                                AC_MSG_ERROR([libcrypt was found, but header file openssl/md5.h is missing.])])
127                                AC_DEFINE([HAVE_LIBCRYPTO],,[Define if you have the `crypto' library (-lcrypto).])
128                        MD5_LIBS="-lcrypto"
129                ], [
130                        AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.])
131                ])
132        fi
133        if test "x$MD5_LIBS" = "x"; then
134                AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.])
135        fi
136        AC_SUBST([MD5_LIBS])
137])
138
139# OD_PROG_MTREE
140#---------------------------------------
141AC_DEFUN([OD_PROG_MTREE],[
142
143        AC_PATH_PROG([MTREE], [mtree], ,  [/usr/bin:/usr/sbin:/bin:/sbin])
144
145        if test "x$MTREE" = "x" ; then
146                AC_CONFIG_SUBDIRS([src/programs/mtree])
147                MTREE='$(TOPSRCDIR)/src/programs/mtree/mtree'
148#               MTREE='${prefix}/bin/mtree'
149                REPLACEMENT_PROGS="$REPLACEMENT_PROGS mtree"
150        fi
151
152        AC_SUBST(MTREE)
153])
154
155#------------------------------------------------------------------------
156# OD_TCL_PACKAGE_DIR --
157#
158#       Locate the correct directory for Tcl package installation
159#
160# Arguments:
161#       None.
162#
163# Requires:
164#       TCLVERSION must be set
165#       CYGPATH must be set
166#       TCLSH must be set
167#
168# Results:
169#
170#       Adds a --with-tclpackage switch to configure.
171#       Result is cached.
172#
173#       Substs the following vars:
174#               TCL_PACKAGE_DIR
175#------------------------------------------------------------------------
176
177AC_DEFUN(OD_TCL_PACKAGE_DIR, [
178    AC_MSG_CHECKING(for Tcl package directory)
179
180    AC_ARG_WITH(tclpackage, [  --with-tclpackage       Tcl package installation directory.], with_tclpackagedir=${withval})
181
182    if test x"${with_tclpackagedir}" != x ; then
183        ac_cv_c_tclpkgd=${with_tclpackagedir}
184    else
185        AC_CACHE_VAL(ac_cv_c_tclpkgd, [
186            # Use the value from --with-tclpackagedir, if it was given
187
188            if test x"${with_tclpackagedir}" != x ; then
189                ac_cv_c_tclpkgd=${with_tclpackagedir}
190            else
191                # On darwin we can do some intelligent guessing
192                case $host_os in
193                    darwin*)
194                        tcl_autopath=`echo 'puts \$auto_path' | $TCLSH`
195                        for path in $tcl_autopath; do
196                            if test "$path" = "/Library/Tcl"; then
197                                ac_cv_c_tclpkgd="$path"
198                                break
199                            fi
200                            if test "$path" = "/System/Library/Tcl"; then
201                                if test -d "$path"; then
202                                    ac_cv_c_tclpkgd="$path"
203                                    break
204                                fi
205                            fi
206                        done
207                    ;;
208                esac
209                if test x"${ac_cv_c_tclpkgd}" = x ; then
210                    # Fudge a path from the first entry in the auto_path
211                    tcl_pkgpath=`echo 'puts [[lindex \$auto_path 0]]' | $TCLSH`
212                    if test -d "$tcl_pkgpath"; then
213                        ac_cv_c_tclpkgd="$tcl_pkgpath"
214                    fi
215                    # If the first entry does not exist, do nothing
216                fi
217            fi
218        ])
219    fi
220
221    if test x"${ac_cv_c_tclpkgd}" = x ; then
222        AC_MSG_ERROR(Tcl package directory not found.  Please specify its location with --with-tclpackagedir)
223    else
224        AC_MSG_RESULT(${ac_cv_c_tclpkgd})
225    fi
226
227    # Convert to a native path and substitute into the output files.
228
229    PACKAGE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclpkgd}`
230
231    TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE}
232
233    AC_SUBST(TCL_PACKAGE_DIR)
234])
235
236# OD_PROG_TCLSH
237#---------------------------------------
238AC_DEFUN([OD_PROG_TCLSH],[
239
240
241        case $host_os in
242                freebsd*)
243                        # FreeBSD installs a dummy tclsh (annoying)
244                        # Look for a real versioned tclsh first
245                        AC_PATH_PROG([TCLSH], [tclsh${TCL_VERSION} tclsh])
246                        ;;
247                *)
248                        # Otherwise, look for a non-versioned tclsh
249                        AC_PATH_PROG([TCLSH], [tclsh tclsh${TCL_VERSION}])
250                        ;;
251        esac
252        if test "x$TCLSH" = "x" ; then
253                AC_MSG_ERROR([Could not find tclsh])
254        fi
255
256        AC_SUBST(TCLSH)
257])
258
Note: See TracBrowser for help on using the repository browser.