source: trunk/base/aclocal.m4 @ 5395

Last change on this file since 5395 was 5395, checked in by ssen, 16 years ago

Implement and use OD_CHECK_X11. If the user has an X11 runtime
(as defined by libX11), require corresponding headers. If they don't
have a runtime, print a warning. Eventually, this should say
"You don't have X11. You won't be able to build any X11-dependent
ports without building all of XFree86, which probably isn't what you want"
Bug: Lots of mailing list newbies

  • Property svn:eol-style set to native
File size: 7.2 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                                AC_MSG_ERROR([libX11 was found, but X.h is missing.])
159                                ])],
160                        [ AC_MSG_WARN([libX11 was not found])
161                ], [-L/usr/X11R6/lib]
162        )
163])
164
165# OD_PROG_MTREE
166#---------------------------------------
167AC_DEFUN([OD_PROG_MTREE],[
168
169        AC_PATH_PROG([MTREE], [mtree], ,  [/usr/bin:/usr/sbin:/bin:/sbin])
170
171        if test "x$MTREE" = "x" ; then
172                AC_CONFIG_SUBDIRS([src/programs/mtree])
173                MTREE='$(TOPSRCDIR)/src/programs/mtree/mtree'
174#               MTREE='${prefix}/bin/mtree'
175                REPLACEMENT_PROGS="$REPLACEMENT_PROGS mtree"
176        fi
177
178        AC_SUBST(MTREE)
179])
180
181#------------------------------------------------------------------------
182# OD_TCL_PACKAGE_DIR --
183#
184#       Locate the correct directory for Tcl package installation
185#
186# Arguments:
187#       None.
188#
189# Requires:
190#       TCLVERSION must be set
191#       CYGPATH must be set
192#       TCLSH must be set
193#
194# Results:
195#
196#       Adds a --with-tclpackage switch to configure.
197#       Result is cached.
198#
199#       Substs the following vars:
200#               TCL_PACKAGE_DIR
201#------------------------------------------------------------------------
202
203AC_DEFUN(OD_TCL_PACKAGE_DIR, [
204    AC_MSG_CHECKING(for Tcl package directory)
205
206    AC_ARG_WITH(tclpackage, [  --with-tclpackage       Tcl package installation directory.], with_tclpackagedir=${withval})
207
208    if test x"${with_tclpackagedir}" != x ; then
209        ac_cv_c_tclpkgd=${with_tclpackagedir}
210    else
211        AC_CACHE_VAL(ac_cv_c_tclpkgd, [
212            # Use the value from --with-tclpackagedir, if it was given
213
214            if test x"${with_tclpackagedir}" != x ; then
215                ac_cv_c_tclpkgd=${with_tclpackagedir}
216            else
217                # On darwin we can do some intelligent guessing
218                case $host_os in
219                    darwin*)
220                        tcl_autopath=`echo 'puts \$auto_path' | $TCLSH`
221                        for path in $tcl_autopath; do
222                            if test "$path" = "/Library/Tcl"; then
223                                ac_cv_c_tclpkgd="$path"
224                                break
225                            fi
226                            if test "$path" = "/System/Library/Tcl"; then
227                                if test -d "$path"; then
228                                    ac_cv_c_tclpkgd="$path"
229                                    break
230                                fi
231                            fi
232                        done
233                    ;;
234                esac
235                if test x"${ac_cv_c_tclpkgd}" = x ; then
236                    # Fudge a path from the first entry in the auto_path
237                    tcl_pkgpath=`echo 'puts [[lindex \$auto_path 0]]' | $TCLSH`
238                    if test -d "$tcl_pkgpath"; then
239                        ac_cv_c_tclpkgd="$tcl_pkgpath"
240                    fi
241                    # If the first entry does not exist, do nothing
242                fi
243            fi
244        ])
245    fi
246
247    if test x"${ac_cv_c_tclpkgd}" = x ; then
248        AC_MSG_ERROR(Tcl package directory not found.  Please specify its location with --with-tclpackagedir)
249    else
250        AC_MSG_RESULT(${ac_cv_c_tclpkgd})
251    fi
252
253    # Convert to a native path and substitute into the output files.
254
255    PACKAGE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclpkgd}`
256
257    TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE}
258
259    AC_SUBST(TCL_PACKAGE_DIR)
260])
261
262# OD_PROG_TCLSH
263#---------------------------------------
264AC_DEFUN([OD_PROG_TCLSH],[
265
266
267        case $host_os in
268                freebsd*)
269                        # FreeBSD installs a dummy tclsh (annoying)
270                        # Look for a real versioned tclsh first
271                        AC_PATH_PROG([TCLSH], [tclsh${TCL_VERSION} tclsh])
272                        ;;
273                *)
274                        # Otherwise, look for a non-versioned tclsh
275                        AC_PATH_PROG([TCLSH], [tclsh tclsh${TCL_VERSION}])
276                        ;;
277        esac
278        if test "x$TCLSH" = "x" ; then
279                AC_MSG_ERROR([Could not find tclsh])
280        fi
281
282        AC_SUBST(TCLSH)
283])
Note: See TracBrowser for help on using the repository browser.