source: trunk/base/aclocal.m4 @ 3279

Last change on this file since 3279 was 3279, checked in by landonf (Landon Fuller), 17 years ago

Add an AC_PROGS check for tclsh
Garner the tcl pkg path somewhat intelligently, rather than guessing blindly.

  • Property svn:eol-style set to native
File size: 5.4 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#---------------------------------------
8AC_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       
17        if test "x$dportsdir" != "x" ; then
18          if test -d "$dportsdir" -a -e "$dportsdir/PortIndex" ; then
19                :
20          else
21                AC_MSG_ERROR([$dportsdir not a valid dports tree])
22          fi
23        else
24                dnl If the user didn't give a path, look for default
25                if test "x$1" != "x" ; then
26                  if test -d "$1" -a -e "$1/PortIndex" ; then
27                        dportsdir=$1
28                  fi
29                fi
30        fi
31
32        if test "x$dportsdir" != "x" ; then
33                AC_MSG_RESULT($dportsdir)
34                DPORTSDIR="$dportsdir"
35                AC_SUBST(DPORTSDIR)
36        else
37                AC_MSG_WARN([No dports tree found])
38        fi
39
40        ])
41
42
43# OD_PATH_PORTCONFIGDIR(DEFAULT_PORTCONFIGDIR, PREFIX)
44#---------------------------------------
45AC_DEFUN([OD_PATH_PORTCONFIGDIR],[
46        dnl if the user actually specified --prefix, shift
47        dnl portconfigdir to $prefix/etc/ports
48        AC_REQUIRE([OD_PATH_DPORTSDIR])
49       
50        AC_MSG_CHECKING([for ports config directory])
51
52        if test "$2" != "NONE" ; then
53                dnl user gave --prefix
54                portconfigdir='${sysconfdir}/ports'
55        else
56                dnl just use the default /etc/ports
57                portconfigdir='/etc/ports'
58        fi
59
60
61        AC_MSG_RESULT([$portconfigdir])
62        PORTCONFIGDIR="$portconfigdir"
63        AC_SUBST(PORTCONFIGDIR)
64
65        ])
66
67# OD_CHECK_INSTALLUSER
68#-------------------------------------------------
69AC_DEFUN([OD_CHECK_INSTALLUSER],[
70        dnl if with user specifies --with-install-user,
71        dnl use it. otherwise default to platform defaults
72        AC_REQUIRE([OD_PATH_PORTCONFIGDIR])
73
74        AC_ARG_WITH(install-user, [AC_HELP_STRING([--with-install-user=USER], [Specify user ownership of installed files])], [ DSTUSR=$withval ] )
75
76        AC_MSG_CHECKING([for install user])
77        if test "x$DSTUSR" = "x" ; then
78           DSTUSR=root
79        fi
80
81        AC_MSG_RESULT([$DSTUSR])
82        AC_SUBST(DSTUSR)
83])
84
85# OD_CHECK_INSTALLGROUP
86#-------------------------------------------------
87AC_DEFUN([OD_CHECK_INSTALLGROUP],[
88        dnl if with user specifies --with-install-group,
89        dnl use it. otherwise default to platform defaults
90        AC_REQUIRE([OD_CHECK_INSTALLUSER])
91
92        AC_ARG_WITH(install-group, [AC_HELP_STRING([--with-install-group=GROUP], [Specify group ownership of installed files])], [ DSTGRP=$withval ] )
93
94        AC_MSG_CHECKING([for install group])
95        if test "x$DSTGRP" = "x" ; then
96           
97           case $host_os in
98           darwin*)
99                DSTGRP="admin"
100                ;;
101           *)
102                DSTGRP="wheel"
103                ;;
104           esac
105        fi
106
107        AC_MSG_RESULT([$DSTGRP])
108        AC_SUBST(DSTGRP)
109])
110
111# OD_PROG_MD5
112#---------------------------------------
113AC_DEFUN([OD_PROG_MD5],[
114
115        AC_PATH_PROG([MD5], [md5], ,  [/usr/bin:/usr/sbin:/bin:/sbin])
116
117        if test "x$MD5" = "x" ; then
118                AC_CONFIG_SUBDIRS([src/programs/md5])
119                MD5='${prefix}/bin/md5'
120                REPLACEMENT_PROGS="$REPLACEMENT_PROGS md5"
121        fi
122
123        AC_SUBST(MD5)
124])
125
126# OD_PROG_MTREE
127#---------------------------------------
128AC_DEFUN([OD_PROG_MTREE],[
129
130        AC_PATH_PROG([MTREE], [mtree], ,  [/usr/bin:/usr/sbin:/bin:/sbin])
131
132        if test "x$MTREE" = "x" ; then
133                AC_CONFIG_SUBDIRS([src/programs/mtree])
134                MTREE='$(TOPSRCDIR)/src/programs/mtree/mtree'
135#               MTREE='${prefix}/bin/mtree'
136                REPLACEMENT_PROGS="$REPLACEMENT_PROGS mtree"
137        fi
138
139        AC_SUBST(MTREE)
140])
141
142#------------------------------------------------------------------------
143# OD_TCL_PACKAGE_DIR --
144#
145#       Locate the correct directory for Tcl package installation
146#
147# Arguments:
148#       None.
149#
150# Requires:
151#       TCLVERSION must be set
152#       CYGPATH must be set
153#       TCLSH must be set
154#
155# Results:
156#
157#       Adds a --with-tclpackage switch to configure.
158#       Result is cached.
159#
160#       Substs the following vars:
161#               TCL_PACKAGE_DIR
162#------------------------------------------------------------------------
163
164AC_DEFUN(OD_TCL_PACKAGE_DIR, [
165    AC_MSG_CHECKING(for Tcl package directory)
166
167    AC_ARG_WITH(tclpackage, [  --with-tclpackage       Tcl package installation directory.], with_tclpackagedir=${withval})
168
169    if test x"${with_tclpackagedir}" != x ; then
170        ac_cv_c_tclpkgd=${with_tclpackagedir}
171    else
172        AC_CACHE_VAL(ac_cv_c_tclpkgd, [
173            # Use the value from --with-tclpackagedir, if it was given
174
175            if test x"${with_tclpackagedir}" != x ; then
176                ac_cv_c_tclpkgd=${with_tclpackagedir}
177            else
178                tcl_autopath=`echo 'puts \$auto_path' | $TCLSH`
179                # On darwin we can do some intelligent guessing
180                if test "`uname -s`" = "Darwin" ; then
181                    for path in $tcl_autopath; do
182                        if test "$path" = "/Library/Tcl"; then
183                            ac_cv_c_tclpkgd="$path"
184                            break
185                        fi
186                        if test "$path" = "/System/Library/Tcl"; then
187                            if test -d "$path"; then
188                                ac_cv_c_tclpkgd="$path"
189                                break
190                            fi
191                        fi
192                    done
193                else
194                    # Fudge a path from the first entry in the auto_path
195                    tcl_pkgpath=`echo $tcl_autopath | awk '{print \$1}'`
196                    if test -d "$path"; then
197                        ac_cv_tclpkgd="$path"
198                    fi
199                    # If the first entry does not exist, do nothing
200                fi
201            fi
202        ])
203    fi
204
205    if test x"${ac_cv_c_tclpkgd}" = x ; then
206        AC_MSG_ERROR(Tcl package directory not found.  Please specify its location with --with-tclpackagedir)
207    else
208        AC_MSG_RESULT(${ac_cv_c_tclpkgd})
209    fi
210
211    # Convert to a native path and substitute into the output files.
212
213    PACKAGE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclpkgd}`
214
215    TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE}
216
217    AC_SUBST(TCL_PACKAGE_DIR)
218])
Note: See TracBrowser for help on using the repository browser.