source: trunk/base/aclocal.m4 @ 3624

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

Improve support for other operating systems
Add special code to handle FreeBSD's tcl port and its strange installation locations.

  • Property svn:eol-style set to native
File size: 6.5 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_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                        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                    *)
209                        # Fudge a path from the first entry in the auto_path
210                        tcl_pkgpath=`echo 'puts [[lindex \$auto_path 0]]' | $TCLSH`
211                        if test -d "$tcl_pkgpath"; then
212                            ac_cv_c_tclpkgd="$tcl_pkgpath"
213                        fi
214                        # If the first entry does not exist, do nothing
215                    ;;
216                esac
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.