source: trunk/base/aclocal.m4 @ 5403

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

Sigh. Make the error messages for X11SDK EXTREMELY EXPLICIT
Bug: Another message today

  • Property svn:eol-style set to native
File size: 8.3 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
145dnl This macro checks for X11 presence. If the libraries are
146dnl present, so must the headers be. If nothing is present,
147dnl print a warning
148
149# OD_CHECK_X11
150# ---------------------
151AC_DEFUN([OD_CHECK_X11], [
152
153        # Check for libX11
154        AC_CHECK_LIB([X11], [XOpenDisplay],[
155                        # found the library. check for header
156                        INCLUDES="-I/usr/X11R6/include $INCLUDES"
157                        AC_CHECK_HEADERS([X11/X.h], ,[
158                                case $host_os in
159                                        darwin*)
160                                                echo "***************************************************"
161                                                if test -d /Library/Receipts/X11User.pkg ; then
162                                                        if test -d /Library/Receipts/X11SDK.pkg ; then
163                                                                cat <<EOF;
164It appears that you are running Mac OS X and have both the X11 and X11SDK
165packages installed. However, for some reason the headers in
166/usr/X11R6/include are not accessible. Please correct this and
167re-run ./configure
168EOF
169                                                        else
170                                                                cat <<EOF;
171It appears that you are running Mac OS X and have the X11 package
172installed, but do *not* have the X11SDK package installed. You can
173find this package on the Xcode Tools CD of you Mac OS X CD Installation
174Set, or on the Restore CDs/DVDs that came with your computer. Please
175install this package and re-run ./configure
176EOF
177                                                        fi
178                                                else
179                                                                cat <<EOF;
180It appears that you are running Mac OS X and have installed X11
181from a third party, without installing the associated X11 development
182headers. Please correct this and re-run ./configure
183EOF
184                                                fi
185                                                AC_MSG_ERROR([Inconsistent X11 installation])
186                                                ;;
187                                        *)
188                                                AC_MSG_ERROR([libX11 was found, but X.h is missing.])
189                                                ;;
190                                esac                                   
191                                ])],
192                        [ AC_MSG_WARN([libX11 was not found])
193                ], [-L/usr/X11R6/lib]
194        )
195])
196
197# OD_PROG_MTREE
198#---------------------------------------
199AC_DEFUN([OD_PROG_MTREE],[
200
201        AC_PATH_PROG([MTREE], [mtree], ,  [/usr/bin:/usr/sbin:/bin:/sbin])
202
203        if test "x$MTREE" = "x" ; then
204                AC_CONFIG_SUBDIRS([src/programs/mtree])
205                MTREE='$(TOPSRCDIR)/src/programs/mtree/mtree'
206#               MTREE='${prefix}/bin/mtree'
207                REPLACEMENT_PROGS="$REPLACEMENT_PROGS mtree"
208        fi
209
210        AC_SUBST(MTREE)
211])
212
213#------------------------------------------------------------------------
214# OD_TCL_PACKAGE_DIR --
215#
216#       Locate the correct directory for Tcl package installation
217#
218# Arguments:
219#       None.
220#
221# Requires:
222#       TCLVERSION must be set
223#       CYGPATH must be set
224#       TCLSH must be set
225#
226# Results:
227#
228#       Adds a --with-tclpackage switch to configure.
229#       Result is cached.
230#
231#       Substs the following vars:
232#               TCL_PACKAGE_DIR
233#------------------------------------------------------------------------
234
235AC_DEFUN(OD_TCL_PACKAGE_DIR, [
236    AC_MSG_CHECKING(for Tcl package directory)
237
238    AC_ARG_WITH(tclpackage, [  --with-tclpackage       Tcl package installation directory.], with_tclpackagedir=${withval})
239
240    if test x"${with_tclpackagedir}" != x ; then
241        ac_cv_c_tclpkgd=${with_tclpackagedir}
242    else
243        AC_CACHE_VAL(ac_cv_c_tclpkgd, [
244            # Use the value from --with-tclpackagedir, if it was given
245
246            if test x"${with_tclpackagedir}" != x ; then
247                ac_cv_c_tclpkgd=${with_tclpackagedir}
248            else
249                # On darwin we can do some intelligent guessing
250                case $host_os in
251                    darwin*)
252                        tcl_autopath=`echo 'puts \$auto_path' | $TCLSH`
253                        for path in $tcl_autopath; do
254                            if test "$path" = "/Library/Tcl"; then
255                                ac_cv_c_tclpkgd="$path"
256                                break
257                            fi
258                            if test "$path" = "/System/Library/Tcl"; then
259                                if test -d "$path"; then
260                                    ac_cv_c_tclpkgd="$path"
261                                    break
262                                fi
263                            fi
264                        done
265                    ;;
266                esac
267                if test x"${ac_cv_c_tclpkgd}" = x ; then
268                    # Fudge a path from the first entry in the auto_path
269                    tcl_pkgpath=`echo 'puts [[lindex \$auto_path 0]]' | $TCLSH`
270                    if test -d "$tcl_pkgpath"; then
271                        ac_cv_c_tclpkgd="$tcl_pkgpath"
272                    fi
273                    # If the first entry does not exist, do nothing
274                fi
275            fi
276        ])
277    fi
278
279    if test x"${ac_cv_c_tclpkgd}" = x ; then
280        AC_MSG_ERROR(Tcl package directory not found.  Please specify its location with --with-tclpackagedir)
281    else
282        AC_MSG_RESULT(${ac_cv_c_tclpkgd})
283    fi
284
285    # Convert to a native path and substitute into the output files.
286
287    PACKAGE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclpkgd}`
288
289    TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE}
290
291    AC_SUBST(TCL_PACKAGE_DIR)
292])
293
294# OD_PROG_TCLSH
295#---------------------------------------
296AC_DEFUN([OD_PROG_TCLSH],[
297
298
299        case $host_os in
300                freebsd*)
301                        # FreeBSD installs a dummy tclsh (annoying)
302                        # Look for a real versioned tclsh first
303                        AC_PATH_PROG([TCLSH], [tclsh${TCL_VERSION} tclsh])
304                        ;;
305                *)
306                        # Otherwise, look for a non-versioned tclsh
307                        AC_PATH_PROG([TCLSH], [tclsh tclsh${TCL_VERSION}])
308                        ;;
309        esac
310        if test "x$TCLSH" = "x" ; then
311                AC_MSG_ERROR([Could not find tclsh])
312        fi
313
314        AC_SUBST(TCLSH)
315])
Note: See TracBrowser for help on using the repository browser.