source: trunk/base/aclocal.m4 @ 3640

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

For real this time. Comment out the macro definition in aclocal.m4 as
well, since it was being processed for AC_ARG_WITH even if the
macro for OD_PATH_DPORTSDIR was not being used.

  • 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       
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        dnl     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_LIB_MD5
112#---------------------------------------
113# Check for an md5 implementation
114AC_DEFUN([OD_LIB_MD5],[
115
116        # Check for libmd, which is prefered
117        AC_CHECK_LIB([md], [MD5Update],[
118                AC_CHECK_HEADERS([md5.h], ,[
119                        AC_MSG_ERROR([libmd was found, but md5.h is missing.])])
120                AC_DEFINE([HAVE_LIBMD], ,[Define if you have the `md' library (-lmd).])
121                MD5_LIBS="-lmd"]
122        )
123        if test "x$MD5_LIBS" = "x" ; then
124                # If libmd is not found, check for libcrypto from OpenSSL
125                AC_CHECK_LIB([crypto], [MD5_Update],[
126                        AC_CHECK_HEADERS([openssl/md5.h],,[
127                                AC_MSG_ERROR([libcrypt was found, but header file openssl/md5.h is missing.])])
128                                AC_DEFINE([HAVE_LIBCRYPTO],,[Define if you have the `crypto' library (-lcrypto).])
129                        MD5_LIBS="-lcrypto"
130                ], [
131                        AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.])
132                ])
133        fi
134        if test "x$MD5_LIBS" = "x"; then
135                AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.])
136        fi
137        AC_SUBST([MD5_LIBS])
138])
139
140# OD_PROG_MTREE
141#---------------------------------------
142AC_DEFUN([OD_PROG_MTREE],[
143
144        AC_PATH_PROG([MTREE], [mtree], ,  [/usr/bin:/usr/sbin:/bin:/sbin])
145
146        if test "x$MTREE" = "x" ; then
147                AC_CONFIG_SUBDIRS([src/programs/mtree])
148                MTREE='$(TOPSRCDIR)/src/programs/mtree/mtree'
149#               MTREE='${prefix}/bin/mtree'
150                REPLACEMENT_PROGS="$REPLACEMENT_PROGS mtree"
151        fi
152
153        AC_SUBST(MTREE)
154])
155
156#------------------------------------------------------------------------
157# OD_TCL_PACKAGE_DIR --
158#
159#       Locate the correct directory for Tcl package installation
160#
161# Arguments:
162#       None.
163#
164# Requires:
165#       TCLVERSION must be set
166#       CYGPATH must be set
167#       TCLSH must be set
168#
169# Results:
170#
171#       Adds a --with-tclpackage switch to configure.
172#       Result is cached.
173#
174#       Substs the following vars:
175#               TCL_PACKAGE_DIR
176#------------------------------------------------------------------------
177
178AC_DEFUN(OD_TCL_PACKAGE_DIR, [
179    AC_MSG_CHECKING(for Tcl package directory)
180
181    AC_ARG_WITH(tclpackage, [  --with-tclpackage       Tcl package installation directory.], with_tclpackagedir=${withval})
182
183    if test x"${with_tclpackagedir}" != x ; then
184        ac_cv_c_tclpkgd=${with_tclpackagedir}
185    else
186        AC_CACHE_VAL(ac_cv_c_tclpkgd, [
187            # Use the value from --with-tclpackagedir, if it was given
188
189            if test x"${with_tclpackagedir}" != x ; then
190                ac_cv_c_tclpkgd=${with_tclpackagedir}
191            else
192                # On darwin we can do some intelligent guessing
193                case $host_os in
194                    darwin*)
195                        tcl_autopath=`echo 'puts \$auto_path' | $TCLSH`
196                        for path in $tcl_autopath; do
197                            if test "$path" = "/Library/Tcl"; then
198                                ac_cv_c_tclpkgd="$path"
199                                break
200                            fi
201                            if test "$path" = "/System/Library/Tcl"; then
202                                if test -d "$path"; then
203                                    ac_cv_c_tclpkgd="$path"
204                                    break
205                                fi
206                            fi
207                        done
208                    ;;
209                esac
210                if test x"${ac_cv_c_tclpkgd}" = x ; then
211                    # Fudge a path from the first entry in the auto_path
212                    tcl_pkgpath=`echo 'puts [[lindex \$auto_path 0]]' | $TCLSH`
213                    if test -d "$tcl_pkgpath"; then
214                        ac_cv_c_tclpkgd="$tcl_pkgpath"
215                    fi
216                    # If the first entry does not exist, do nothing
217                fi
218            fi
219        ])
220    fi
221
222    if test x"${ac_cv_c_tclpkgd}" = x ; then
223        AC_MSG_ERROR(Tcl package directory not found.  Please specify its location with --with-tclpackagedir)
224    else
225        AC_MSG_RESULT(${ac_cv_c_tclpkgd})
226    fi
227
228    # Convert to a native path and substitute into the output files.
229
230    PACKAGE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclpkgd}`
231
232    TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE}
233
234    AC_SUBST(TCL_PACKAGE_DIR)
235])
236
237# OD_PROG_TCLSH
238#---------------------------------------
239AC_DEFUN([OD_PROG_TCLSH],[
240
241
242        case $host_os in
243                freebsd*)
244                        # FreeBSD installs a dummy tclsh (annoying)
245                        # Look for a real versioned tclsh first
246                        AC_PATH_PROG([TCLSH], [tclsh${TCL_VERSION} tclsh])
247                        ;;
248                *)
249                        # Otherwise, look for a non-versioned tclsh
250                        AC_PATH_PROG([TCLSH], [tclsh tclsh${TCL_VERSION}])
251                        ;;
252        esac
253        if test "x$TCLSH" = "x" ; then
254                AC_MSG_ERROR([Could not find tclsh])
255        fi
256
257        AC_SUBST(TCLSH)
258])
259
Note: See TracBrowser for help on using the repository browser.