Changeset 18769


Ignore:
Timestamp:
Jul 27, 2006, 10:45:30 PM (14 years ago)
Author:
pguyot (Paul Guyot)
Message:

Fix darwintrace.c on 10.3 (tentative, no 10.3 box here) by determining with
autoconf if readlink conforms to POSIX 1003.1a as in 10.4+ or not (as in 10.3).

Location:
trunk/base
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/aclocal.m4

    r17269 r18769  
    822822])
    823823
     824#------------------------------------------------------------------------
     825# DP_CHECK_READLINK_IS_P1003_1A --
     826#
     827#       Check if readlink conforms to POSIX 1003.1a standard, define
     828#       READLINK_IS_NOT_P1003_1A if it doesn't.
     829#
     830# Arguments:
     831#       None.
     832#
     833# Requires:
     834#       None.
     835#
     836# Depends:
     837#               AC_LANG_PROGRAM
     838#
     839# Results:
     840#       Result is cached.
     841#
     842#       If readlink doesn't conform to POSIX 1003.1a, defines the following variables:
     843#               READLINK_IS_NOT_P1003_1A
     844#
     845#------------------------------------------------------------------------
     846AC_DEFUN(DP_CHECK_READLINK_IS_P1003_1A, [
     847        AC_MSG_CHECKING([if readlink conforms to POSIX 1003.1a])
     848
     849        AC_CACHE_VAL(dp_cv_readlink_is_posix_1003_1a, [
     850                AC_COMPILE_IFELSE([
     851                        AC_LANG_PROGRAM([
     852                                        #include <unistd.h>
     853                                        ssize_t readlink(const char *, char *, size_t);
     854                                ], [
     855                        ])
     856                        ], [
     857                                dp_cv_readlink_is_posix_1003_1a="yes"
     858                        ], [
     859                                dp_cv_readlink_is_posix_1003_1a="no"
     860                        ]
     861                )
     862        ])
     863
     864        AC_MSG_RESULT(${dp_cv_readlink_is_posix_1003_1a})
     865
     866        if test x"${dp_cv_readlink_is_posix_1003_1a}" = "xno"; then
     867                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)])
     868        fi
     869
     870        AC_SUBST(READLINK_IS_NOT_P1003_1A)
     871])
  • trunk/base/configure

    r17346 r18769  
    315315
    316316ac_subdirs_all="$ac_subdirs_all src/thread2.6"
    317 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE LN_S CVS RSYNC HAVE_LAUNCHD LAUNCHCTL XCODEBUILD TAR GNUTAR TAR_CMD CFLAGS_QUICHEEATERS MTREE subdirs ENABLE_LAUNCHD_SUPPORT HAVE_FRAMEWORK_COREFOUNDATION HAVE_FRAMEWORK_SYSTEMCONFIGURATION HAVE_FRAMEWORK_IOKIT HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER REPLACEMENT_PROGS EXTRA_PROGS DPORTSDIR PORTCONFIGDIR SQLITE3_DIR DSTUSR DSTGRP DSTMODE CPP EGREP MD5_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDES TCLSH TCL_PACKAGE_DIR CURL_CONFIG CFLAGS_LIBCURL LDFLAGS_LIBCURL OUR_INCLUDED_PACKAGES INCLUDES CFLAGS_DEBUG CFLAGS_OPTIMIZE TCL_DEFS STLIB_LD SHLIB_LD SHLIB_CFLAGS SHLIB_LDFLAGS SHLIB_SUFFIX TCL_CC prefix_expanded PORTCONFIGDIR_EXPANDED localstatedir_expanded LIBOBJS LTLIBOBJS'
     317ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE LN_S CVS RSYNC HAVE_LAUNCHD LAUNCHCTL XCODEBUILD TAR GNUTAR TAR_CMD CFLAGS_QUICHEEATERS MTREE subdirs ENABLE_LAUNCHD_SUPPORT HAVE_FRAMEWORK_COREFOUNDATION HAVE_FRAMEWORK_SYSTEMCONFIGURATION HAVE_FRAMEWORK_IOKIT HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER REPLACEMENT_PROGS EXTRA_PROGS DPORTSDIR PORTCONFIGDIR SQLITE3_DIR DSTUSR DSTGRP DSTMODE CPP EGREP READLINK_IS_NOT_P1003_1A MD5_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDES TCLSH TCL_PACKAGE_DIR CURL_CONFIG CFLAGS_LIBCURL LDFLAGS_LIBCURL OUR_INCLUDED_PACKAGES INCLUDES CFLAGS_DEBUG CFLAGS_OPTIMIZE TCL_DEFS STLIB_LD SHLIB_LD SHLIB_CFLAGS SHLIB_LDFLAGS SHLIB_SUFFIX TCL_CC prefix_expanded PORTCONFIGDIR_EXPANDED localstatedir_expanded LIBOBJS LTLIBOBJS'
    318318ac_subst_files=''
    319319
     
    56505650fi
    56515651done
     5652
     5653
     5654        echo "$as_me:$LINENO: checking if readlink conforms to POSIX 1003.1a" >&5
     5655echo $ECHO_N "checking if readlink conforms to POSIX 1003.1a... $ECHO_C" >&6
     5656
     5657        if test "${dp_cv_readlink_is_posix_1003_1a+set}" = set; then
     5658  echo $ECHO_N "(cached) $ECHO_C" >&6
     5659else
     5660
     5661                cat >conftest.$ac_ext <<_ACEOF
     5662
     5663                        /* confdefs.h.  */
     5664_ACEOF
     5665cat confdefs.h >>conftest.$ac_ext
     5666cat >>conftest.$ac_ext <<_ACEOF
     5667/* end confdefs.h.  */
     5668
     5669                                        #include <unistd.h>
     5670                                        ssize_t readlink(const char *, char *, size_t);
     5671
     5672int
     5673main ()
     5674{
     5675
     5676
     5677  ;
     5678  return 0;
     5679}
     5680
     5681_ACEOF
     5682rm -f conftest.$ac_objext
     5683if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
     5684  (eval $ac_compile) 2>conftest.er1
     5685  ac_status=$?
     5686  grep -v '^ *+' conftest.er1 >conftest.err
     5687  rm -f conftest.er1
     5688  cat conftest.err >&5
     5689  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5690  (exit $ac_status); } &&
     5691         { ac_try='test -z "$ac_c_werror_flag"
     5692                         || test ! -s conftest.err'
     5693  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     5694  (eval $ac_try) 2>&5
     5695  ac_status=$?
     5696  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5697  (exit $ac_status); }; } &&
     5698         { ac_try='test -s conftest.$ac_objext'
     5699  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     5700  (eval $ac_try) 2>&5
     5701  ac_status=$?
     5702  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     5703  (exit $ac_status); }; }; then
     5704
     5705                                dp_cv_readlink_is_posix_1003_1a="yes"
     5706
     5707else
     5708  echo "$as_me: failed program was:" >&5
     5709sed 's/^/| /' conftest.$ac_ext >&5
     5710
     5711
     5712                                dp_cv_readlink_is_posix_1003_1a="no"
     5713
     5714
     5715fi
     5716rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
     5717
     5718fi
     5719
     5720
     5721        echo "$as_me:$LINENO: result: ${dp_cv_readlink_is_posix_1003_1a}" >&5
     5722echo "${ECHO_T}${dp_cv_readlink_is_posix_1003_1a}" >&6
     5723
     5724        if test x"${dp_cv_readlink_is_posix_1003_1a}" = "xno"; then
     5725
     5726cat >>confdefs.h <<\_ACEOF
     5727#define READLINK_IS_NOT_P1003_1A
     5728_ACEOF
     5729
     5730        fi
     5731
     5732
    56525733
    56535734
     
    96289709s,@CPP@,$CPP,;t t
    96299710s,@EGREP@,$EGREP,;t t
     9711s,@READLINK_IS_NOT_P1003_1A@,$READLINK_IS_NOT_P1003_1A,;t t
    96309712s,@MD5_LIBS@,$MD5_LIBS,;t t
    96319713s,@X_CFLAGS@,$X_CFLAGS,;t t
  • trunk/base/configure.ac

    r17346 r18769  
    7575AC_FUNC_STRERROR_R
    7676AC_CHECK_FUNCS([bzero memset dup2 regcomp strdup strerror strtol fgetln lockf flock setmode strcasecmp strncasecmp copyfile])
     77DP_CHECK_READLINK_IS_P1003_1A
    7778
    7879# Check for md5 implementation
  • trunk/base/src/config.h.in

    r17346 r18769  
    222222#undef PACKAGE_VERSION
    223223
     224/* Define to 1 if readlink does not conform with POSIX 1003.1a (where third
     225   argument is a size_t and return value is a ssize_t) */
     226#undef READLINK_IS_NOT_P1003_1A
     227
    224228/* Define to 1 if static build is requested */
    225229#undef STATIC_BUILD
  • trunk/base/src/darwintracelib1.0/darwintrace.c

    r18721 r18769  
    44 * All rights reserved.
    55 *
    6  * $Id: darwintrace.c,v 1.16 2006/07/25 04:01:33 pguyot Exp $
     6 * $Id: darwintrace.c,v 1.17 2006/07/27 22:45:30 pguyot Exp $
    77 *
    88 * @APPLE_BSD_LICENSE_HEADER_START@
     
    5454#include <sys/paths.h>
    5555#include <errno.h>
     56#include <sys/cdefs.h>
    5657
    5758/*
     
    432433   Only logs files where the readlink succeeds.
    433434*/
    434 
     435#ifdef READLINK_IS_NOT_P1003_1A
     436int  readlink(const char * path, char * buf, int bufsiz) {
     437#else
    435438ssize_t  readlink(const char * path, char * buf, size_t bufsiz) {
     439#endif
    436440#define readlink(x,y,z) syscall(SYS_readlink, (x), (y), (z))
    437441        ssize_t result;
Note: See TracChangeset for help on using the changeset viewer.