builtin(include,tcl.m4) #------------------------------------------------------------------------ # OD_CHECK_FRAMEWORK_COREFOUNDATION -- # # Check if CoreFoundation framework is available, define HAVE_FRAMEWORK_COREFOUNDATION if so. # # Arguments: # None. # # Requires: # None. # # Depends: # AC_LANG_PROGRAM # # Results: # Result is cached. # # If CoreFoundation framework is available, defines the following variables: # HAVE_FRAMEWORK_COREFOUNDATION # #------------------------------------------------------------------------ AC_DEFUN(OD_CHECK_FRAMEWORK_COREFOUNDATION, [ FRAMEWORK_LIBS="-framework CoreFoundation" AC_MSG_CHECKING([for CoreFoundation framework]) AC_CACHE_VAL(od_cv_have_framework_corefoundation, [ ac_save_LIBS="$LIBS" LIBS="$FRAMEWORK_LIBS $LIBS" AC_LINK_IFELSE([ AC_LANG_PROGRAM([ #include ], [ CFURLRef url = CFURLCreateWithFileSystemPath(NULL, CFSTR("/testing"), kCFURLPOSIXPathStyle, 1); CFArrayRef bundles = CFBundleCreateBundlesFromDirectory(NULL, url, CFSTR("pkg")); ]) ], [ od_cv_have_framework_corefoundation="yes" ], [ od_cv_have_framework_corefoundation="no" ] ) LIBS="$ac_save_LIBS" ]) AC_MSG_RESULT(${od_cv_have_framework_corefoundation}) if test x"${od_cv_have_framework_corefoundation}" = "xyes"; then AC_DEFINE([HAVE_FRAMEWORK_COREFOUNDATION], [], [Define if CoreFoundation framework is available]) fi AC_SUBST(HAVE_FRAMEWORK_COREFOUNDATION) ]) #------------------------------------------------------------------------ # OD_CHECK_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER -- # # Check if if the routine CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER # is available in CoreFoundation. # # Arguments: # None. # # Requires: # None. # # Depends: # AC_LANG_PROGRAM # # Results: # Result is cached. # # If function CFNotificationCenterGetDarwinNotifyCenter is in the CoreFoundation framework, defines the following variables: # HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER # #------------------------------------------------------------------------ AC_DEFUN(OD_CHECK_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER, [ FRAMEWORK_LIBS="-framework CoreFoundation" AC_MSG_CHECKING([for CFNotificationCenterGetDarwinNotifyCenter]) AC_CACHE_VAL(od_cv_have_function_cfnotificationcentergetdarwinnotifycenter, [ ac_save_LIBS="$LIBS" LIBS="$FRAMEWORK_LIBS $LIBS" AC_LINK_IFELSE([ AC_LANG_PROGRAM([ #include ], [ CFNotificationCenterRef ref = CFNotificationCenterGetDarwinNotifyCenter(); ]) ], [ od_cv_have_function_cfnotificationcentergetdarwinnotifycenter="yes" ], [ od_cv_have_function_cfnotificationcentergetdarwinnotifycenter="no" ] ) LIBS="$ac_save_LIBS" ]) AC_MSG_RESULT(${od_cv_have_function_cfnotificationcentergetdarwinnotifycenter}) if test x"${od_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" = "xyes"; then AC_DEFINE([HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER], [], [Define if function CFNotificationCenterGetDarwinNotifyCenter in CoreFoundation framework]) fi AC_SUBST(HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER) ]) #------------------------------------------------------------------------ # OD_CHECK_FRAMEWORK_SYSTEMCONFIGURATION -- # # Check if SystemConfiguration framework is available, define HAVE_FRAMEWORK_SYSTEMCONFIGURATION if so. # # Arguments: # None. # # Requires: # None. # # Depends: # AC_LANG_PROGRAM # # Results: # Result is cached. # # If SystemConfiguration framework is available, defines the following variables: # HAVE_FRAMEWORK_SYSTEMCONFIGURATION # #------------------------------------------------------------------------ AC_DEFUN(OD_CHECK_FRAMEWORK_SYSTEMCONFIGURATION, [ FRAMEWORK_LIBS="-framework SystemConfiguration" AC_MSG_CHECKING([for SystemConfiguration framework]) AC_CACHE_VAL(od_cv_have_framework_systemconfiguration, [ ac_save_LIBS="$LIBS" LIBS="$FRAMEWORK_LIBS $LIBS" AC_LINK_IFELSE([ AC_LANG_PROGRAM([ #include ], [ int err = SCError(); SCDynamicStoreRef dsRef = SCDynamicStoreCreate(NULL, NULL, NULL, NULL); ]) ], [ od_cv_have_framework_systemconfiguration="yes" ], [ od_cv_have_framework_systemconfiguration="no" ] ) LIBS="$ac_save_LIBS" ]) AC_MSG_RESULT(${od_cv_have_framework_systemconfiguration}) if test x"${od_cv_have_framework_systemconfiguration}" = "xyes"; then AC_DEFINE([HAVE_FRAMEWORK_SYSTEMCONFIGURATION], [], [Define if SystemConfiguration framework is available]) fi AC_SUBST(HAVE_FRAMEWORK_SYSTEMCONFIGURATION) ]) #------------------------------------------------------------------------ # OD_CHECK_FRAMEWORK_IOKIT -- # # Check if IOKit framework is available, define HAVE_FRAMEWORK_IOKIT if so. # # Arguments: # None. # # Requires: # None. # # Depends: # AC_LANG_PROGRAM # # Results: # Result is cached. # # If IOKit framework is available, defines the following variables: # HAVE_FRAMEWORK_IOKIT # #------------------------------------------------------------------------ AC_DEFUN(OD_CHECK_FRAMEWORK_IOKIT, [ FRAMEWORK_LIBS="-framework IOKit" AC_MSG_CHECKING([for IOKit framework]) AC_CACHE_VAL(od_cv_have_framework_iokit, [ ac_save_LIBS="$LIBS" LIBS="$FRAMEWORK_LIBS $LIBS" AC_LINK_IFELSE([ AC_LANG_PROGRAM([ #include ], [ IOCreateReceivePort(0, NULL); IORegisterForSystemPower(0, NULL, NULL, NULL); ]) ], [ od_cv_have_framework_iokit="yes" ], [ od_cv_have_framework_iokit="no" ] ) LIBS="$ac_save_LIBS" ]) AC_MSG_RESULT(${od_cv_have_framework_iokit}) if test x"${od_cv_have_framework_iokit}" = "xyes"; then AC_DEFINE([HAVE_FRAMEWORK_IOKIT], [], [Define if IOKit framework is available]) fi AC_SUBST(HAVE_FRAMEWORK_IOKIT) ]) dnl This macro checks if the user specified a dports tree dnl explicitly. If not, search for it # OD_PATH_DPORTSDIR(DEFAULT_DPORTSDIR) #--------------------------------------- AC_DEFUN([OD_PATH_DPORTSDIR],[ dnl For ease of reading, run after gcc has been found/configured AC_REQUIRE([AC_PROG_CC]) AC_ARG_WITH(dports-dir, [AC_HELP_STRING([--with-dports-dir=DIR], [Specify alternate dports directory])], [ dportsdir="$withval" ] ) AC_MSG_CHECKING([for dports tree]) if test "x$dportsdir" != "x" ; then if test -d "$dportsdir" -a -e "$dportsdir/PortIndex" ; then : else AC_MSG_ERROR([$dportsdir not a valid dports tree]) fi else dnl If the user didn't give a path, look for default if test "x$1" != "x" ; then if test -d "$1" -a -e "$1/PortIndex" ; then dportsdir=$1 fi fi fi if test "x$dportsdir" != "x" ; then AC_MSG_RESULT($dportsdir) DPORTSDIR="$dportsdir" AC_SUBST(DPORTSDIR) else AC_MSG_WARN([No dports tree found]) fi ]) # OD_PATH_PORTCONFIGDIR #--------------------------------------- AC_DEFUN([OD_PATH_PORTCONFIGDIR],[ dnl if the user actually specified --prefix, shift dnl portconfigdir to $prefix/etc/ports dnl AC_REQUIRE([OD_PATH_DPORTSDIR]) AC_MSG_CHECKING([for ports config directory]) portconfigdir='${sysconfdir}/ports' AC_MSG_RESULT([$portconfigdir]) PORTCONFIGDIR="$portconfigdir" AC_SUBST(PORTCONFIGDIR) ]) # OD_CHECK_INSTALLUSER #------------------------------------------------- AC_DEFUN([OD_CHECK_INSTALLUSER],[ dnl if with user specifies --with-install-user, dnl use it. otherwise default to platform defaults AC_REQUIRE([OD_PATH_PORTCONFIGDIR]) AC_ARG_WITH(install-user, [AC_HELP_STRING([--with-install-user=USER], [Specify user ownership of installed files])], [ DSTUSR=$withval ] ) AC_MSG_CHECKING([for install user]) if test "x$DSTUSR" = "x" ; then DSTUSR=root fi AC_MSG_RESULT([$DSTUSR]) AC_SUBST(DSTUSR) ]) # OD_CHECK_INSTALLGROUP #------------------------------------------------- AC_DEFUN([OD_CHECK_INSTALLGROUP],[ dnl if with user specifies --with-install-group, dnl use it. otherwise default to platform defaults AC_REQUIRE([OD_CHECK_INSTALLUSER]) AC_ARG_WITH(install-group, [AC_HELP_STRING([--with-install-group=GROUP], [Specify group ownership of installed files])], [ DSTGRP=$withval ] ) AC_MSG_CHECKING([for install group]) if test "x$DSTGRP" = "x" ; then case $host_os in darwin*) DSTGRP="admin" ;; *) DSTGRP="wheel" ;; esac fi AC_MSG_RESULT([$DSTGRP]) AC_SUBST(DSTGRP) ]) # OD_DIRECTORY_MODE #------------------------------------------------- AC_DEFUN([OD_DIRECTORY_MODE],[ dnl if with user specifies --with-directory-mode, dnl use the specified permissions for ${prefix} directories dnl otherwise use 0775 AC_REQUIRE([OD_PATH_PORTCONFIGDIR]) AC_ARG_WITH(directory-mode, [AC_HELP_STRING([--with-directory-mode=MODE], [Specify directory mode of installed directories])], [ DSTMODE=$withval ] ) AC_MSG_CHECKING([what permissions to use for installation directories]) if test "x$DSTMODE" = "x" ; then DSTMODE=0775 fi AC_MSG_RESULT([$DSTMODE]) AC_SUBST(DSTMODE) ]) # OD_LIB_MD5 #--------------------------------------- # Check for an md5 implementation AC_DEFUN([OD_LIB_MD5],[ # Check for libmd, which is prefered AC_CHECK_LIB([md], [MD5Update],[ AC_CHECK_HEADERS([md5.h], ,[ case $host_os in darwin*) AC_MSG_NOTICE([Please install the BSD SDK package from the Xcode Developer Tools CD.]) ;; *) AC_MSG_NOTICE([Please install the libmd developer headers for your platform.]) ;; esac AC_MSG_ERROR([libmd was found, but md5.h is missing.]) ]) AC_DEFINE([HAVE_LIBMD], ,[Define if you have the `md' library (-lmd).]) MD5_LIBS="-lmd"] ) if test "x$MD5_LIBS" = "x" ; then # If libmd is not found, check for libcrypto from OpenSSL AC_CHECK_LIB([crypto], [MD5_Update],[ AC_CHECK_HEADERS([openssl/md5.h],,[ case $host_os in darwin*) AC_MSG_NOTICE([Please install the BSD SDK package from the Xcode Developer Tools CD.]) ;; *) AC_MSG_NOTICE([Please install the libmd developer headers for your platform.]) ;; esac AC_MSG_ERROR([libcrypt was found, but header file openssl/md5.h is missing.]) ]) AC_DEFINE([HAVE_LIBCRYPTO],,[Define if you have the `crypto' library (-lcrypto).]) MD5_LIBS="-lcrypto" ], [ AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.]) ]) fi if test "x$MD5_LIBS" = "x"; then AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.]) fi AC_SUBST([MD5_LIBS]) ]) dnl This macro checks for X11 presence. If the libraries are dnl present, so must the headers be. If nothing is present, dnl print a warning # OD_CHECK_X11 # --------------------- AC_DEFUN([OD_CHECK_X11], [ AC_PATH_XTRA # Check for libX11 AC_CHECK_LIB([X11], [XOpenDisplay],[ has_x_runtime=yes ], [ has_x_runtime=no ], [-L/usr/X11R6/lib $X_LIBS]) # echo "------done---------" # echo "x_includes=${x_includes}" # echo "x_libraries=${x_libraries}" # echo "no_x=${no_x}" # echo "X_CFLAGS=${X_CFLAGS}" # echo "X_LIBS=${X_LIBS}" # echo "X_DISPLAY_MISSING=${X_DISPLAY_MISSING}" # echo "has_x_runtime=${has_x_runtime}" # echo "host_os=${host_os}" # echo "------done---------" state= case "__${has_x_runtime}__${no_x}__" in "__no__yes__") # either the user said --without-x, or it was not found # at all (runtime or headers) AC_MSG_WARN([X11 not available. You will not be able to use dports that use X11]) state=0 ;; "__yes__yes__") state=1 ;; "__yes____") state=2 ;; *) state=3 ;; esac case $host_os in darwin*) case $state in 1) cat <&1 | grep no-same-owner`] if test -z "$no_same_owner_support" ; then AC_MSG_RESULT([no]) else AC_MSG_RESULT([yes]) TAR_CMD="$TAR_CMD --no-same-owner" fi ]) #------------------------------------------------------------------------ # DP_CHECK_READLINK_IS_P1003_1A -- # # Check if readlink conforms to POSIX 1003.1a standard, define # READLINK_IS_NOT_P1003_1A if it doesn't. # # Arguments: # None. # # Requires: # None. # # Depends: # AC_LANG_PROGRAM # # Results: # Result is cached. # # If readlink doesn't conform to POSIX 1003.1a, defines the following variables: # READLINK_IS_NOT_P1003_1A # #------------------------------------------------------------------------ AC_DEFUN(DP_CHECK_READLINK_IS_P1003_1A, [ AC_MSG_CHECKING([if readlink conforms to POSIX 1003.1a]) AC_CACHE_VAL(dp_cv_readlink_is_posix_1003_1a, [ AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([ #include ssize_t readlink(const char *, char *, size_t); ], [ ]) ], [ dp_cv_readlink_is_posix_1003_1a="yes" ], [ dp_cv_readlink_is_posix_1003_1a="no" ] ) ]) AC_MSG_RESULT(${dp_cv_readlink_is_posix_1003_1a}) if test x"${dp_cv_readlink_is_posix_1003_1a}" = "xno"; then AC_DEFINE([READLINK_IS_NOT_P1003_1A], [], [Define to 1 if readlink does not conform with POSIX 1003.1a (where third argument is a size_t and return value is a ssize_t)]) fi AC_SUBST(READLINK_IS_NOT_P1003_1A) ])