1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
|
dnl Function to test if a certain feature was enabled
AC_DEFUN([LIBEWF_TEST_ENABLE],
[AC_ARG_ENABLE(
[$1],
[AS_HELP_STRING(
[--enable-$1],
[$3 (default is $4)])],
[ac_cv_libewf_enable_$2=$enableval],
[ac_cv_libewf_enable_$2=$4])dnl
AC_CACHE_CHECK(
[whether to enable $3],
[ac_cv_libewf_enable_$2],
[ac_cv_libewf_enable_$2=$4])dnl
])
dnl Function to detect whether nl_langinfo supports CODESET
AC_DEFUN([LIBEWF_LANGINFO_CODESET],
[AC_CHECK_FUNCS(
[nl_langinfo],
[AC_CACHE_CHECK(
[for nl_langinfo CODESET support],
[ac_cv_libewf_langinfo_codeset],
[AC_LANG_PUSH(C)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <langinfo.h>]],
[[char* charset = nl_langinfo( CODESET );]] )],
[ac_cv_libewf_langinfo_codeset=yes],
[ac_cv_libewf_langinfo_codeset=no])
AC_LANG_POP(C) ]) ],
[ac_cv_libewf_langinfo_codeset=no] )
AS_IF(
[test "x$ac_cv_libewf_langinfo_codeset" = xyes],
[AC_DEFINE(
[HAVE_LANGINFO_CODESET],
[1],
[Define if nl_langinfo has CODESET support.]) ])
])
dnl Function to detect whether printf conversion specifier "%jd" is available
AC_DEFUN([LIBEWF_CHECK_PRINTF_JD],
[SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_LANG_PUSH(C)
AC_MSG_CHECKING(
[whether printf supports the conversion specifier "%jd"])
dnl First try to see if compilation and linkage without a parameter succeeds
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdio.h>]],
[[printf( "%jd" ); ]] )],
[AC_MSG_RESULT(
[no])],
dnl Second try to see if compilation and linkage with a parameter succeeds
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/types.h>
#include <stdio.h>]],
[[printf( "%jd", (off_t) 10 ); ]] )],
dnl Third try to see if the program runs correctly
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/types.h>
#include <stdio.h>]],
[[char string[ 3 ];
if( snprintf( string, 3, "%jd", (off_t) 10 ) < 0 ) return( 1 );
if( ( string[ 0 ] != '1' ) || ( string[ 1 ] != '0' ) ) return( 1 ); ]] )],
[AC_MSG_RESULT(
[yes])
AC_DEFINE(
[HAVE_PRINTF_JD],
[1],
[Define to 1 whether printf supports the conversion specifier "%jd".] )],
[AC_MSG_RESULT(
[no])],
[AC_MSG_RESULT(
[undetermined])] )],
[AC_MSG_RESULT(
[no])] )] )
AC_LANG_POP(C)
CFLAGS="$SAVE_CFLAGS"])
dnl Function to detect whether printf conversion specifier "%zd" is available
AC_DEFUN([LIBEWF_CHECK_PRINTF_ZD],
[SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_LANG_PUSH(C)
AC_MSG_CHECKING(
[whether printf supports the conversion specifier "%zd"])
dnl First try to see if compilation and linkage without a parameter succeeds
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdio.h>]],
[[printf( "%zd" ); ]] )],
[AC_MSG_RESULT(
[no])],
dnl Second try to see if compilation and linkage with a parameter succeeds
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/types.h>
#include <stdio.h>]],
[[printf( "%zd", (size_t) 10 ); ]] )],
dnl Third try to see if the program runs correctly
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/types.h>
#include <stdio.h>]],
[[char string[ 3 ];
if( snprintf( string, 3, "%zd", (size_t) 10 ) < 0 ) return( 1 );
if( ( string[ 0 ] != '1' ) || ( string[ 1 ] != '0' ) ) return( 1 ); ]] )],
[AC_MSG_RESULT(
[yes])
AC_DEFINE(
[HAVE_PRINTF_ZD],
[1],
[Define to 1 whether printf supports the conversion specifier "%zd".] )],
[AC_MSG_RESULT(
[no])],
[AC_MSG_RESULT(
[undetermined])] )],
[AC_MSG_RESULT(
[no])] )] )
AC_LANG_POP(C)
CFLAGS="$SAVE_CFLAGS"])
dnl Function to detect if ctime_r or ctime is available
dnl Also checks if ctime_t is defined according to the POSIX standard
AC_DEFUN([LIBEWF_CHECK_FUNC_CTIME],
[AC_CHECK_FUNC(
[ctime_r],
[AC_LANG_PUSH(C)
AC_MSG_CHECKING(
[if ctime_r is defined according to the POSIX definition])
AC_LINK_IFELSE(
AC_LANG_PROGRAM(
[[#include <time.h>]],
[[ctime_r(NULL,NULL,0)]]),
[AC_MSG_RESULT(
[ctime_r with additional size argument detected])
AC_DEFINE(
[HAVE_CTIME_R],
[1],
[Define to 1 if you have the ctime_r function.] )
AC_DEFINE(
[HAVE_CTIME_R_SIZE],
[1],
[Define to 1 if you have the ctime_r function with a third size argument.] )],
[AC_LINK_IFELSE(
AC_LANG_PROGRAM(
[[#include <time.h>]],
[[ctime_r(NULL,NULL)]]),
[AC_MSG_RESULT(
[yes])
AC_DEFINE(
[HAVE_CTIME_R],
[1],
[Define to 1 if you have the ctime_r function.] )],
[CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
AC_LINK_IFELSE(
AC_LANG_PROGRAM(
[[#include <time.h>]],
[[ctime_r(NULL,NULL)]] ),
[AC_MSG_RESULT(
[ctime_r requires additional compile flags])
AC_DEFINE(
[HAVE_CTIME_R],
[1],
[Define to 1 if you have the ctime_r function.] )],
[AC_MSG_WARN(
[Unable to determine how to compile ctime_r])
AC_CHECK_FUNCS(
[ctime],
[],
[AC_MSG_FAILURE(
[Missing function: ctime_r and ctime],
[1]) ]) ])
])
])
AC_LANG_POP(C) ],
[AC_CHECK_FUNCS(
[ctime],
[],
[AC_MSG_FAILURE(
[Missing function: ctime_r and ctime],
[1]) ]) ])
])
dnl Function to detect if posix_fadvise is available
AC_DEFUN([LIBEWF_CHECK_FUNC_POSIX_FADVISE],
[AC_CHECK_FUNCS(
[posix_fadvise],
[AC_LANG_PUSH(C)
AC_MSG_CHECKING(
[if posix_fadvise can be linked])
AC_LINK_IFELSE(
AC_LANG_PROGRAM(
[[#include <fcntl.h>]],
[[#if !defined( POSIX_FADV_SEQUENTIAL )
#define POSIX_FADV_SEQUENTIAL 2
#endif
posix_fadvise(0,0,0,POSIX_FADV_SEQUENTIAL)]]),
[AC_MSG_RESULT(
[yes])
AC_DEFINE(
[HAVE_POSIX_FADVISE],
[1],
[Define to 1 if you have the posix_fadvise unction.] )],
[AC_MSG_RESULT(
[no]) ])
AC_LANG_POP(C) ])
])
dnl Function to determine the operating system
AC_DEFUN([LIBEWF_DETERMINE_OPERATING_SYSTEM],
[ac_libewf_target_string="$target";
AS_IF(
[test "x$ac_libewf_target_string" = x],
[ac_libewf_target_string="$build"])
AS_CASE(
[$ac_libewf_target_string],
[*cygwin*], [ac_libewf_operating_system="Cygwin";],
[*darwin*], [ac_libewf_operating_system="Darwin";],
[*freebsd*], [ac_libewf_operating_system="FreeBSD";],
[*netbsd*], [ac_libewf_operating_system="NetBSD";],
[*openbsd*], [ac_libewf_operating_system="OpenBSD";],
[*linux*], [ac_libewf_operating_system="Linux";],
[*mingw*], [ac_libewf_operating_system="MingW";],
[*solaris*], [ac_libewf_operating_system="SunOS";],
[*], [ac_libewf_operating_system="Unknown";])
AC_DEFINE_UNQUOTED(
LIBEWF_OPERATING_SYSTEM,
"$ac_libewf_operating_system",
[Defines the fallback operating system string.]) ])
dnl Function to detect if Python build environment is available
AC_DEFUN([LIBEWF_CHECK_PYTHON_DEVEL],
[AC_REQUIRE([AM_PATH_PYTHON])
dnl Check for Python include path
AC_MSG_CHECKING(
[for Python include path])
PYTHON_INCLUDE_DIR=`$PYTHON -c "import distutils.sysconfig;print distutils.sysconfig.get_python_inc() "`;
AC_MSG_RESULT(
[$PYTHON_INCLUDE_DIR])
AC_SUBST(
[PYTHON_CPPFLAGS],
[-I$PYTHON_INCLUDE_DIR])
AS_IF(
[test ! -r $PYTHON_INCLUDE_DIR/Python.h],
[AC_MSG_ERROR(
[Missing Python include file])])
dnl Check for Python library path
AC_MSG_CHECKING(
[for Python library path])
python_path=`$PYTHON -c "import distutils.sysconfig;print distutils.sysconfig.get_python_lib() "`;
AC_MSG_RESULT(
[$python_path])
AC_SUBST(
[PYTHON_LDFLAGS],
["-L$python_path -lpython$PYTHON_VERSION"])
python_site=`echo $python_path | sed "s/config/site-packages/"`;
AC_SUBST(
[PYTHON_SITE_PKG],
[$python_site])
dnl Determine the Python libraries which must be linked in when embedding
AC_MSG_CHECKING(
[for Python extra libraries])
PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig;conf = distutils.sysconfig.get_config_var;print conf('LOCALMODLIBS')+' '+conf('LIBS')"`;
AC_MSG_RESULT(
[$PYTHON_EXTRA_LIBS])
AC_SUBST(
[PYTHON_EXTRA_LIBS]) ])
|