AC_INIT(types.h) AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE(rvm,1.01) AC_ARG_WITH( default-config-file, [ --with-default-config-file=FILE Default rvm config file (/etc/rvm.conf)], ac_cv_default_config_file=$with_default_config_file, ) AC_ARG_WITH( default-log-dir, [ --with-default-log-dir=DIR Default rvm log directory (/var/log/rvm)], ac_cv_default_log_dir=$with_default_log_dir, ) AC_ARG_WITH( rsync, [ --with-rsync=FILE Default path to the rsync program], local_rsync=$with_rsync, ) ac_cv_with_asserts=yes dnl AC_ARG_WITH( dnl asserts, dnl [ --with-asserts Enable debugging assert code], dnl ac_cv_with_asserts=$with_asserts, dnl ac_cv_with_asserts=no dnl ) ac_cv_with_debug=yes dnl AC_ARG_WITH( dnl debug, dnl [ --with-debug Enable debugging code], dnl ac_cv_with_debug=$with_debug, dnl ac_cv_with_debug=no dnl ) AC_PROG_CC AC_CHECK_HEADERS( \ stdlib.h \ unistd.h \ errno.h \ string.h \ pwd.h \ grp.h \ ctype.h \ fnmatch.h \ sys/wait.h \ signal.h \ sys/select.h \ fcntl.h \ ,,AC_MSG_ERROR([One or more required header files are missing])) AC_CHECK_HEADER(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H,1,[Define if OS has sys/time.h])) AC_CHECK_HEADER(sys/vfs.h, AC_DEFINE(HAVE_SYS_VFS_H,1,[Define if OS has sys/vfs.h])) AC_CHECK_HEADER(sys/statvfs.h, AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Define if OS has sys/statvfs.h])) AC_CHECK_HEADER(sys/param.h, AC_DEFINE(HAVE_SYS_PARAM_H,1,[Define if OS has sys/param.h])) AC_CHECK_HEADER(sys/mount.h, AC_DEFINE(HAVE_SYS_MOUNT_H,1,[Define if OS has sys/mount.h])) AC_CHECK_HEADER(sys/mkdev.h, AC_DEFINE(HAVE_SYS_MKDEV_H,1,[Define if OS has sys/mkdev.h])) dnl dnl The following tests for Large File support reverse-engineered from dnl the GNU core utilities: ftp://alpha.gnu.org/gnu/coreutils/ dnl AC_MSG_CHECKING([if filesystem supports Large Files natively]) if test "${ac_cv_c_native_large_file_support+set}" = set; then AC_MSG_RESULT([(cached)] $ac_cv_c_native_large_file_support) else AC_TRY_COMPILE( [ #include #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ] , [ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; ] , ac_cv_c_native_large_file_support=yes , ac_cv_c_native_large_file_support=no ) AC_MSG_RESULT($ac_cv_c_native_large_file_support) fi if test $ac_cv_c_native_large_file_support = no; then AC_MSG_CHECKING([if _FILE_OFFSET_BITS needed for Large Files]) AC_TRY_COMPILE( [ #define _FILE_OFFSET_BITS 64 #include #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ] , [ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; ] , ac_cv_c_need_file_offset_bits=yes AC_DEFINE(_FILE_OFFSET_BITS,64,[Define if OS needs it for Large Files]) AC_MSG_RESULT([yes]) , ac_cv_c_need_file_offset_bits=no AC_MSG_RESULT([no]) ) fi dnl if test $ac_cv_c_native_large_file_support = no; then dnl AC_MSG_CHECKING([if _LARGE_FILES needed for Large Files]) dnl AC_TRY_COMPILE( dnl [ dnl #define _LARGE_FILES 1 dnl #include dnl #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) dnl ] dnl , dnl [ dnl int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 dnl && LARGE_OFF_T % 2147483647 == 1) dnl ? 1 : -1]; dnl ] dnl , dnl ac_cv_c_need_large_files=yes dnl AC_DEFINE(_LARGE_FILES,1,[Define if OS needs it for Large Files]) dnl AC_MSG_RESULT([yes]) dnl , dnl ac_cv_c_need_large_files=no dnl AC_MSG_RESULT([no]) dnl ) dnl fi if test $ac_cv_c_native_large_file_support = no; then AC_MSG_CHECKING([if _LARGE_FILES needed for Large Files]) if test $ac_cv_c_need_file_offset_bits = yes; then ac_cv_c_need_large_files=no AC_MSG_RESULT([no]) else AC_TRY_COMPILE( [ #define _LARGE_FILES 1 #include #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ] , [ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; ] , ac_cv_c_need_large_files=yes AC_DEFINE(_LARGE_FILES,1,[Define if OS needs it for Large Files]) AC_MSG_RESULT([yes]) , ac_cv_c_need_large_files=no AC_MSG_RESULT([no]) ) fi fi AC_CHECK_FUNCS( \ getcwd \ ,,AC_MSG_ERROR([One or more required functions are missing])) AC_HEADER_DIRENT AC_STRUCT_ST_RDEV AC_HEADER_STAT AC_HEADER_TIME AC_STRUCT_TM AC_CHECK_SIZEOF(unsigned char) AC_CHECK_SIZEOF(unsigned short) AC_CHECK_SIZEOF(unsigned int) AC_CHECK_SIZEOF(unsigned long) AC_CHECK_SIZEOF(unsigned long long) AC_CHECK_SIZEOF(size_t) AC_PROG_CXX AC_LANG_CPLUSPLUS AC_CHECK_HEADERS( \ iostream \ string \ vector \ map \ exception \ cstdio \ cassert \ cerrno \ cctype \ ,,AC_MSG_ERROR([One or more required header files are missing])) AC_CHECK_HEADER(streambuf, AC_DEFINE(HAVE_STREAMBUF,1,[Define if C++ compiler has streambuf])) AC_CHECK_HEADER(limits, AC_DEFINE(HAVE_LIMITS,1,[Define if C++ compiler has numeric limits])) AC_MSG_CHECKING([if the stl throws an exception at memory allocation failure]) if test "${ac_cv_cxx_exception_on_failed_alloc+set}" = set; then AC_MSG_RESULT([(cached)] $ac_cv_cxx_exception_on_failed_alloc) else AC_TRY_RUN( #include #include int main(int argc, char **argv) { std::string str; str = "a"; while (true) { try { str += str; } catch(...) { return(0); } } return(0); } , AC_MSG_RESULT([yes]) ac_cv_cxx_exception_on_failed_alloc=yes , AC_MSG_RESULT([no]) ac_cv_cxx_exception_on_failed_alloc=no ) fi if test $ac_cv_cxx_exception_on_failed_alloc = yes; then AC_DEFINE(HAVE_EXCEPTION_ON_ALLOC_FAILURE,1,[Define if stl throws an exception in the event that memory allocation fails]) else AC_MSG_WARN([ *** NOTICE: This implementation of the STL does not throw an exception for memory allocation failure. (This feature is known to be lacking in at least some pre 3.x versions of the gcc compiler suite.) Memory allocation failure should not mean program termination, but without this feature in the STL, the author of this software package cannot guarentee the ability to handle memory allocation failure gracefully. ]) fi AC_PATH_PROG(local_rsync,rsync) AC_DEFINE_UNQUOTED( LOCAL_RSYNC, "$local_rsync", [The default location of the local rsync program] ) LOCAL_RSYNC=$local_rsync AC_SUBST(LOCAL_RSYNC) AC_CACHE_CHECK( [default config file], ac_cv_default_config_file, ac_cv_default_config_file=/etc/rvm.conf ) AC_DEFINE_UNQUOTED( CONFIGFILE, "$ac_cv_default_config_file", [Default rvm config file] ) CONFIGFILE=$ac_cv_default_config_file AC_SUBST(CONFIGFILE) AC_CACHE_CHECK( [default log dir], ac_cv_default_log_dir, ac_cv_default_log_dir=/var/log/rvm ) AC_DEFINE_UNQUOTED( LOGDIR, "$ac_cv_default_log_dir", [Default rvm log directory] ) LOGDIR=$ac_cv_default_log_dir AC_SUBST(LOGDIR) if test $ac_cv_with_asserts = yes; then AC_DEFINE(WITH_ASSERTS,1,[Define to compile with debugging assert support (--with-asserts)]) fi if test $ac_cv_with_debug = yes; then AC_DEFINE(DEBUG,1,[Define to compile with debugging support (--with-debug)]) fi AC_OUTPUT(Makefile rvm.1)