Merged from Padraig.
[awesomized/libmemcached] / m4 / pandora_64bit.m4
1 dnl Copyright (C) 2009 Sun Microsystems
2 dnl This file is free software; Sun Microsystems
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
5
6 dnl ---------------------------------------------------------------------------
7 dnl Macro: PANDORA_64BIT
8 dnl ---------------------------------------------------------------------------
9 AC_DEFUN([PANDORA_64BIT],[
10
11 AC_ARG_ENABLE([64bit],[
12 AS_HELP_STRING([--disable-64bit],
13 [Build 64 bit binary @<:@default=on@:>@])],
14 [ac_enable_64bit="$enableval"],
15 [ac_enable_64bit="yes"])
16
17 AC_CHECK_PROGS(ISAINFO, [isainfo], [no])
18 AS_IF([test "x$ISAINFO" != "xno"],
19 [isainfo_b=`${ISAINFO} -b`],
20 [isainfo_b="x"])
21
22 AS_IF([test "$isainfo_b" != "x"],[
23
24 isainfo_k=`${ISAINFO} -k`
25 DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_k}"
26
27 AS_IF([test "x${ac_cv_env_CPPFLAGS_set}" = "x"],[
28 CPPFLAGS="-I/usr/local ${CPPFLAGS}"
29 ])
30
31 AS_IF([test "x${ac_cv_env_LDFLAGS_set}" = "x"],[
32 LDFLAGS="-L/usr/local/lib/${isainfo_k} ${LDFLAGS}"
33 ])
34
35 AS_IF([test "x$ac_enable_64bit" = "xyes"],[
36 AS_IF([test "x$libdir" = "x\${exec_prefix}/lib"],[
37 dnl The user hasn't overridden the default libdir, so we'll
38 dnl the dir suffix to match solaris 32/64-bit policy
39 libdir="${libdir}/${isainfo_k}"
40 ])
41
42 CPPFLAGS="-m64 ${CPPFLAGS}"
43 LDFLAGS="-m64 ${LDFLAGS}"
44 AS_IF([test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes"],[
45 AM_CFLAGS="-xmemalign=8s ${AM_CFLAGS}"
46 AM_CXXFLAGS="-xmemalign=8s ${AM_CXXFLAGS}"
47 ])
48 ])
49 ])
50 ])
51 dnl ---------------------------------------------------------------------------
52 dnl End Macro: PANDORA_64BIT
53 dnl ---------------------------------------------------------------------------