Changeset 5574


Ignore:
Timestamp:
Mar 29, 2017 5:07:47 AM (8 years ago)
Author:
riza
Message:

Fix #2006: Fix android build failed using NDK r14 caused by by the removal of android_alarm.h.

Location:
pjproject/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/aconfigure

    r5549 r5574  
    756756oldincludedir 
    757757includedir 
     758runstatedir 
    758759localstatedir 
    759760sharedstatedir 
     
    878879sharedstatedir='${prefix}/com' 
    879880localstatedir='${prefix}/var' 
     881runstatedir='${localstatedir}/run' 
    880882includedir='${prefix}/include' 
    881883oldincludedir='/usr/include' 
     
    11301132    silent=yes ;; 
    11311133 
     1134  -runstatedir | --runstatedir | --runstatedi | --runstated \ 
     1135  | --runstate | --runstat | --runsta | --runst | --runs \ 
     1136  | --run | --ru | --r) 
     1137    ac_prev=runstatedir ;; 
     1138  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ 
     1139  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ 
     1140  | --run=* | --ru=* | --r=*) 
     1141    runstatedir=$ac_optarg ;; 
     1142 
    11321143  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) 
    11331144    ac_prev=sbindir ;; 
     
    12671278                datadir sysconfdir sharedstatedir localstatedir includedir \ 
    12681279                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ 
    1269                 libdir localedir mandir 
     1280                libdir localedir mandir runstatedir 
    12701281do 
    12711282  eval ac_val=\$$ac_var 
     
    14201431  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com] 
    14211432  --localstatedir=DIR     modifiable single-machine data [PREFIX/var] 
     1433  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run] 
    14221434  --libdir=DIR            object code libraries [EPREFIX/lib] 
    14231435  --includedir=DIR        C header files [PREFIX/include] 
     
    54165428 
    54175429 
     5430case $target in 
     5431  *android*) 
     5432        ac_fn_c_check_header_mongrel "$LINENO" "linux/android_alarm.h" "ac_cv_header_linux_android_alarm_h" "$ac_includes_default" 
     5433if test "x$ac_cv_header_linux_android_alarm_h" = xyes; then : 
     5434  $as_echo "#define PJ_HAS_ANDROID_ALARM_H 1" >>confdefs.h 
     5435 
     5436fi 
     5437 
     5438 
     5439        ;; 
     5440esac 
     5441 
    54185442ac_fn_c_check_func "$LINENO" "localtime_r" "ac_cv_func_localtime_r" 
    54195443if test "x$ac_cv_func_localtime_r" = xyes; then : 
  • pjproject/trunk/aconfigure.ac

    r5549 r5574  
    266266                  #endif 
    267267                 ]) 
     268 
     269case $target in 
     270  *android*) 
     271        AC_CHECK_HEADER(linux/android_alarm.h,[AC_DEFINE(PJ_HAS_ANDROID_ALARM_H,1)]) 
     272        ;; 
     273esac 
    268274 
    269275AC_CHECK_FUNC(localtime_r,[AC_DEFINE(PJ_HAS_LOCALTIME_R,1)]) 
  • pjproject/trunk/pjlib/src/pj/os_timestamp_posix.c

    r5501 r5574  
    164164 
    165165#include <errno.h> 
    166 #include <linux/android_alarm.h> 
    167 #include <fcntl.h> 
    168166#include <time.h> 
    169167 
     168#if defined(PJ_HAS_ANDROID_ALARM_H) && PJ_HAS_ANDROID_ALARM_H != 0 
     169#  include <linux/android_alarm.h> 
     170#  include <fcntl.h> 
     171#endif 
     172 
    170173#define NSEC_PER_SEC    1000000000 
    171174 
     175#if defined(ANDROID_ALARM_GET_TIME) 
    172176static int s_alarm_fd = -1; 
    173177 
     
    178182    s_alarm_fd = -1; 
    179183} 
     184#endif 
    180185 
    181186PJ_DEF(pj_status_t) pj_get_timestamp(pj_timestamp *ts) 
     
    184189    int err = -1; 
    185190 
     191#if defined(ANDROID_ALARM_GET_TIME) 
    186192    if (s_alarm_fd == -1) { 
    187193        int fd = open("/dev/alarm", O_RDONLY); 
     
    196202              ANDROID_ALARM_GET_TIME(ANDROID_ALARM_ELAPSED_REALTIME), &tp); 
    197203    } 
     204#elif defined(CLOCK_BOOTTIME) 
     205    err = clock_gettime(CLOCK_BOOTTIME, &tp); 
     206#endif 
    198207     
    199208    if (err != 0) { 
    200209        /* Fallback to CLOCK_MONOTONIC if /dev/alarm is not found, or 
    201          * getting ANDROID_ALARM_ELAPSED_REALTIME fails. 
     210         * getting ANDROID_ALARM_ELAPSED_REALTIME fails, or  
     211         * CLOCK_BOOTTIME fails. 
    202212         */ 
    203213        err = clock_gettime(CLOCK_MONOTONIC, &tp); 
Note: See TracChangeset for help on using the changeset viewer.