Ignore:
Timestamp:
25/09/2011 19:39:00 (8 months ago)
Author:
chris
Message:

Move Box Backup's custom tests into own file, to share with Boxi.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/configure.ac

    r2956 r2999  
    2323fi 
    2424 
    25 case $build_os in 
    26 solaris*) 
    27   isa_bits=`isainfo -b` 
    28   AC_MSG_NOTICE([setting compiler to use -m$isa_bits on Solaris]) 
    29   CFLAGS="$CFLAGS -m$isa_bits" 
    30   CXXFLAGS="$CXXFLAGS -m$isa_bits" 
    31   LDFLAGS="$LDFLAGS -m$isa_bits" 
    32   ;; 
    33 esac 
    34  
    35 if test "x$GXX" = "xyes"; then 
    36   # Use -Wall if we have gcc. This gives better warnings 
    37   AC_SUBST([CXXFLAGS_STRICT], ['-Wall -Wundef']) 
    38  
    39   # Don't check for gcc -rdynamic on Solaris as it's broken, but returns 0. 
    40   case $build_os in 
    41   solaris*) 
    42     AC_MSG_NOTICE([skipping check for -rdynamic check on Solaris]) 
    43     ;; 
    44   *) 
    45     # Check whether gcc supports -rdynamic, thanks to Steve Ellcey 
    46     # [http://readlist.com/lists/gcc.gnu.org/gcc/6/31502.html] 
    47     # This is needed to get symbols in backtraces. 
    48     # Note that this apparently fails on HP-UX and Solaris 
    49     LDFLAGS="$LDFLAGS -rdynamic" 
    50     AC_MSG_CHECKING([whether gcc accepts -rdynamic]) 
    51     AC_TRY_LINK([], [return 0;], 
    52       [AC_MSG_RESULT([yes]); have_rdynamic=yes], 
    53       [AC_MSG_RESULT([no])]) 
    54     if test x"$have_rdynamic" = x"yes" ; then 
    55       AC_SUBST([LDADD_RDYNAMIC], ['-rdynamic']) 
    56     fi 
    57     ;; 
    58   esac 
    59 fi 
    60  
    61 AC_PATH_PROG([PERL], [perl], [AC_MSG_ERROR([[perl executable was not found]])]) 
    62  
    63 case $target_os in 
    64 mingw*)  
    65         TARGET_PERL=perl 
    66         ;; 
    67 *) 
    68         TARGET_PERL=$PERL 
    69         ;; 
    70 esac 
    71  
    72 AC_SUBST([TARGET_PERL]) 
    73 AC_DEFINE_UNQUOTED([PERL_EXECUTABLE], ["$TARGET_PERL"],  
    74         [Location of the perl executable]) 
    75  
    76 AC_CHECK_TOOL([AR],     [ar],     
    77         [AC_MSG_ERROR([[cannot find ar executable]])]) 
    78 AC_CHECK_TOOL([RANLIB], [ranlib], 
    79         [AC_MSG_ERROR([[cannot find ranlib executable]])]) 
    80  
    81 case $target_os in 
    82 mingw*)  
    83         AC_CHECK_TOOL([WINDRES], [windres], 
    84                 [AC_MSG_ERROR([[cannot find windres executable]])]) 
    85         ;; 
    86 esac 
    87  
    88 ### Checks for libraries. 
    89  
    90 case $target_os in 
    91 mingw32*) ;; 
    92 winnt)    ;; 
    93 *) 
    94   AC_SEARCH_LIBS([nanosleep], [rt], [ac_have_nanosleep=yes], 
    95                  [AC_MSG_ERROR([[cannot find a short sleep function (nanosleep)]])]) 
    96         ;; 
    97 esac 
    98  
    99 AC_CHECK_HEADER([zlib.h],, [AC_MSG_ERROR([[cannot find zlib.h]])]) 
    100 AC_CHECK_LIB([z], [zlibVersion],, [AC_MSG_ERROR([[cannot find zlib]])]) 
    101 VL_LIB_READLINE([have_libreadline=yes], [have_libreadline=no]) 
    102 AC_CHECK_FUNCS([rl_filename_completion_function]) 
    103  
    104 ## Check for Berkely DB. Restrict to certain versions 
    105 AX_PATH_BDB([1.x or 4.1], [ 
    106   LIBS="$BDB_LIBS $LIBS" 
    107   LDFLAGS="$BDB_LDFLAGS $LDFLAGS" 
    108   CPPFLAGS="$CPPFLAGS $BDB_CPPFLAGS" 
    109  
    110   AX_COMPARE_VERSION([$BDB_VERSION],[ge],[4.1],, 
    111     [AX_COMPARE_VERSION([$BDB_VERSION],[lt],[2],, 
    112       [AC_MSG_ERROR([[only Berkely DB versions 1.x or at least 4.1 are currently supported]])] 
    113       )] 
    114   ) 
    115   AX_SPLIT_VERSION([BDB_VERSION], [$BDB_VERSION]) 
    116 ]) 
    117  
    118 ## Check for Open SSL, use old versions only if explicitly requested 
    119 AC_SEARCH_LIBS([gethostbyname], [nsl socket resolv]) 
    120 AC_SEARCH_LIBS([shutdown], [nsl socket resolv]) 
    121 AX_CHECK_SSL(, [AC_MSG_ERROR([[OpenSSL is not installed but is required]])]) 
    122 AC_ARG_ENABLE( 
    123   [old-ssl], 
    124   [AC_HELP_STRING([--enable-old-ssl], 
    125                   [Allow use of pre-0.9.7 Open SSL - NOT RECOMMENDED, read the documentation])]) 
    126 AC_CHECK_LIB( 
    127   [crypto], 
    128   [EVP_CipherInit_ex],, [ 
    129   if test "x$enable_old_ssl" = "xyes"; then 
    130     AC_DEFINE([HAVE_OLD_SSL], 1, [Define to 1 if SSL is pre-0.9.7]) 
    131   else 
    132     AC_MSG_ERROR([[found an old (pre 0.9.7) version of SSL. 
    133 Upgrade or read the documentation for alternatives]]) 
    134   fi 
    135   ]) 
    136  
    137  
    138 ### Checks for header files. 
    139  
    140 case $target_os in 
    141 mingw32*) ;; 
    142 winnt*)   ;; 
    143 *) 
    144   AC_HEADER_DIRENT 
    145   ;; 
    146 esac 
    147  
    148 AC_HEADER_STDC 
    149 AC_HEADER_SYS_WAIT 
    150 AC_CHECK_HEADERS([dlfcn.h getopt.h process.h pwd.h signal.h]) 
    151 AC_CHECK_HEADERS([syslog.h time.h cxxabi.h]) 
    152 AC_CHECK_HEADERS([netinet/in.h]) 
    153 AC_CHECK_HEADERS([sys/file.h sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h]) 
    154 AC_CHECK_HEADERS([sys/uio.h sys/xattr.h]) 
    155 AC_CHECK_HEADERS([bsd/unistd.h]) 
    156  
    157 AC_CHECK_HEADERS([execinfo.h], [have_execinfo_h=yes]) 
    158  
    159 if test "$have_execinfo_h" = "yes"; then 
    160   AC_SEARCH_LIBS([backtrace],[execinfo]) 
    161 fi 
    162  
    163 AC_CHECK_HEADER([regex.h], [have_regex_h=yes]) 
    164  
    165 if test "$have_regex_h" = "yes"; then 
    166   AC_DEFINE([HAVE_REGEX_H], [1], [Define to 1 if regex.h is available]) 
    167 else 
    168   AC_CHECK_HEADER([pcreposix.h], [have_pcreposix_h=yes]) 
    169 fi 
    170  
    171 if test "$have_pcreposix_h" = "yes"; then 
    172   AC_DEFINE([PCRE_STATIC], [1], [Box Backup always uses static PCRE]) 
    173   AC_SEARCH_LIBS([regcomp], ["pcreposix -lpcre"],,[have_pcreposix_h=no_regcomp]) 
    174 fi 
    175  
    176 if test "$have_pcreposix_h" = "yes"; then 
    177   AC_DEFINE([HAVE_PCREPOSIX_H], [1], [Define to 1 if pcreposix.h is available]) 
    178 fi 
    179  
    180 if test "$have_regex_h" = "yes" -o "$have_pcreposix_h" = "yes"; then 
    181   have_regex_support=yes 
    182   AC_DEFINE([HAVE_REGEX_SUPPORT], [1], [Define to 1 if regular expressions are supported]) 
    183 else 
    184   have_regex_support=no 
    185 fi 
    186  
    187 AC_SEARCH_LIBS([dlsym], ["dl"]) 
    188 AC_CHECK_FUNCS([dlsym dladdr]) 
    189  
    190 ### Checks for typedefs, structures, and compiler characteristics. 
    191  
    192 AC_CHECK_TYPES([u_int8_t, u_int16_t, u_int32_t, u_int64_t]) 
    193 AC_CHECK_TYPES([uint8_t, uint16_t, uint32_t, uint64_t]) 
    194  
    195 AC_HEADER_STDBOOL 
    196 AC_C_CONST 
    197 AC_C_BIGENDIAN 
    198 AC_TYPE_UID_T 
    199 AC_TYPE_MODE_T 
    200 AC_TYPE_OFF_T 
    201 AC_TYPE_PID_T 
    202 AC_TYPE_SIZE_T 
    203  
    204 AC_CHECK_MEMBERS([struct stat.st_flags]) 
    205 AC_CHECK_MEMBERS([struct stat.st_mtimespec]) 
    206 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec]) 
    207 AC_CHECK_MEMBERS([struct stat.st_atimensec]) 
    208 AC_CHECK_MEMBERS([struct sockaddr_in.sin_len],,, [[ 
    209   #include <sys/types.h> 
    210   #include <netinet/in.h> 
    211   ]]) 
    212 AC_CHECK_MEMBERS([DIR.d_fd],,,  [[#include <dirent.h>]]) 
    213 AC_CHECK_MEMBERS([DIR.dd_fd],,, [[#include <dirent.h>]]) 
    214  
    215 AC_CHECK_DECLS([INFTIM],,, [[#include <poll.h>]]) 
    216 AC_CHECK_DECLS([SO_PEERCRED],,, [[#include <sys/socket.h>]]) 
    217 AC_CHECK_DECLS([O_BINARY],,,) 
    218  
    219 # Solaris provides getpeerucred() instead of getpeereid() or SO_PEERCRED 
    220 AC_CHECK_HEADERS([ucred.h]) 
    221 AC_CHECK_FUNCS([getpeerucred]) 
    222  
    223 AC_CHECK_DECLS([optreset],,, [[#include <getopt.h>]]) 
    224 AC_CHECK_DECLS([dirfd],,, 
    225         [[ 
    226                 #include <getopt.h> 
    227                 #include <dirent.h> 
    228         ]]) 
    229  
    230 AC_HEADER_TIME 
    231 AC_STRUCT_TM 
    232 AX_CHECK_DIRENT_D_TYPE 
    233 AC_SYS_LARGEFILE 
    234 AX_CHECK_DEFINE_PRAGMA 
    235 if test "x$ac_cv_c_bigendian" != "xyes"; then 
    236   AX_BSWAP64 
    237 fi 
    238  
    239 case $target_os in 
    240 mingw32*) ;; 
    241 winnt*)   ;; 
    242 *) 
    243   AX_RANDOM_DEVICE 
    244   AX_CHECK_MOUNT_POINT(,[ 
    245     AC_MSG_ERROR([[cannot work out how to discover mount points on your platform]]) 
    246   ]) 
    247   AC_CHECK_MEMBERS([struct dirent.d_ino],,, [[#include <dirent.h>]]) 
    248 ;; 
    249 esac 
    250  
    251 AX_CHECK_MALLOC_WORKAROUND 
    252  
    253  
    254 ### Checks for library functions. 
    255  
    256 AC_FUNC_CLOSEDIR_VOID 
    257 AC_FUNC_ERROR_AT_LINE 
    258 AC_TYPE_SIGNAL 
    259 AC_FUNC_STAT 
    260 AC_CHECK_FUNCS([getpeereid lchown setproctitle getpid gettimeofday waitpid ftruncate]) 
    261 AC_SEARCH_LIBS([setproctitle], ["bsd"]) 
    262  
    263 # NetBSD implements kqueue too differently for us to get it fixed by 0.10 
    264 # TODO: Remove this when NetBSD kqueue implementation is working 
    265 netbsd_hack=`echo $target_os | sed 's/netbsd.*/netbsd/'` 
    266 if test "$netbsd_hack" != "netbsd"; then 
    267   AC_CHECK_FUNCS([kqueue]) 
    268 fi 
    269  
    270 AX_FUNC_SYSCALL 
    271 AX_CHECK_SYSCALL_LSEEK 
    272 AC_CHECK_FUNCS([listxattr llistxattr getxattr lgetxattr setxattr lsetxattr]) 
    273 AC_CHECK_DECLS([XATTR_NOFOLLOW],,, [[#include <sys/xattr.h>]]) 
    274  
    275  
    276 ### Miscellaneous complicated feature checks 
    277  
    278 ## Check for large file support active. AC_SYS_LARGEFILE has already worked 
    279 ## out how to enable it if necessary, we just use this to report to the user 
    280 AC_CACHE_CHECK([if we have large file support enabled], 
    281   [box_cv_have_large_file_support], 
    282   [AC_TRY_RUN([ 
    283     $ac_includes_default 
    284     int main() 
    285     { 
    286       return sizeof(off_t)==4; 
    287     } 
    288     ], 
    289     [box_cv_have_large_file_support=yes], 
    290     [box_cv_have_large_file_support=no], 
    291     [box_cv_have_large_file_support=no # safe for cross-compile] 
    292     ) 
    293   ]) 
    294  
    295 if test "x$box_cv_have_large_file_support" = "xyes"; then 
    296         AC_DEFINE([HAVE_LARGE_FILE_SUPPORT], [1], 
    297                 [Define to 1 if large files are supported]) 
    298 fi 
    299  
    300 ## Find out how to do file locking 
    301 AC_CHECK_FUNCS([flock fcntl]) 
    302 AC_CHECK_DECLS([O_EXLOCK],,, [[#include <fcntl.h>]]) 
    303 AC_CHECK_DECLS([F_SETLK],,, [[#include <fcntl.h>]]) 
    304  
    305 case $target_os in 
    306 mingw32*) ;; 
    307 winnt*)   ;; 
    308 *) 
    309 if test "x$ac_cv_func_flock" != "xyes" && \ 
    310    test "x$ac_cv_have_decl_O_EXLOCK" != "xyes" && \ 
    311    test "x$ac_cv_have_decl_F_SETLK" != "xyes" 
    312 then 
    313   AC_MSG_ERROR([[cannot work out how to do file locking on your platform]]) 
    314 fi 
    315 ;; 
    316 esac 
     25m4_include([infrastructure/m4/boxbackup_tests.m4]) 
    31726 
    31827## Get tmpdir 
     
    447156EOC 
    448157 
     158cat > config.env <<EOC 
     159CC="$CC" 
     160CXX="$CXX" 
     161CXXFLAGS="$CXXFLAGS" 
     162LDFLAGS="$LDFLAGS" 
     163LIBS="$LIBS" 
     164EOC 
    449165 
    450166### Warnings at end for visibility 
Note: See TracChangeset for help on using the changeset viewer.