*** empty log message ***
[arla.git] / cf / func-ntohl.m4
blob4322db84adb38a1ddb58a0e49ec643039e173f70
1 dnl
2 dnl $Id$
3 dnl
4 dnl test for how to do ntohl
5 dnl
7 AC_DEFUN([AC_FUNC_NTOHL], [
8 AC_REQUIRE([AC_CANONICAL_TARGET])
9 AC_MSG_CHECKING(for efficient ntohl)
10 AC_CACHE_VAL(ac_cv_func_ntohl, [
11 case "$target_cpu" in
12 changequote(, )dnl
13 i[3-9]86) AC_TRY_RUN(
14 changequote([, ])dnl
16 #if defined(__GNUC__) && defined(i386)
17 unsigned long foo(unsigned long x)
19   asm("bswap %0" : "=r" (x) : "0" (x));
20   return x;
22 #endif
24 int main(void)
26   return foo(0x12345678) != 0x78563412;
29 ac_cv_func_ntohl="bswap",
30 ac_cv_func_ntohl="ntohl",
31 ac_cv_func_ntohl="ntohl") ;;
32 alpha) ac_cv_func_ntohl="bswap32" ;;
33 *) ac_cv_func_ntohl="ntohl" ;;
34 esac
36 AC_MSG_RESULT($ac_cv_func_ntohl)
37 AC_DEFINE_UNQUOTED(EFF_NTOHL, $ac_cv_func_ntohl, [how should ntohl be done?])