File: configure.in

package info (click to toggle)
msgpack-c 1.4.2-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,448 kB
  • ctags: 23,997
  • sloc: cpp: 74,169; ansic: 6,333; sh: 4,181; makefile: 619
file content (98 lines) | stat: -rw-r--r-- 3,412 bytes parent folder | download
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
AC_INIT(msgpack, m4_esyscmd([cat include/msgpack/version_master.h | tr -d "\n" | sed -e 's/#define MSGPACK_VERSION_MAJOR[[:space:]]*\([[:alnum:]]*\)/\1./g' -e 's/#define MSGPACK_VERSION_MINOR[[:space:]]*\([[:alnum:]]*\)/\1./g' -e 's/#define MSGPACK_VERSION_REVISION[[:space:]]*\([[:alnum:]]*\)/\1/g' | tr -d "\n"]))
AC_CONFIG_AUX_DIR(ac)
AM_INIT_AUTOMAKE
AC_CONFIG_HEADER(config.h)
AC_SUBST(CFLAGS)
CFLAGS="-O3 -Wall -Wextra -Werror $CFLAGS"

AC_SUBST(CXXFLAGS)
CXXFLAGS="-O3 -Wall -Wextra -Wno-mismatched-tags -Werror $CXXFLAGS"


AC_PROG_CC


AC_MSG_CHECKING([if C++ API is enabled])
AC_ARG_ENABLE(cxx,
    AS_HELP_STRING([--disable-cxx],
                   [don't build C++ API]) )   #'
AC_MSG_RESULT([$enable_cxx])
if test "$enable_cxx" != "no"; then
    AC_PROG_CXX
    AM_PROG_CC_C_O
fi
AM_CONDITIONAL(ENABLE_CXX, test "$enable_cxx" != "no")


AC_PROG_LIBTOOL
AM_PROG_AS


AC_MSG_CHECKING([if debug option is enabled])
AC_ARG_ENABLE(debug,
    AS_HELP_STRING([--disable-debug],
                   [disable assert macros and omit -g option]) )
AC_MSG_RESULT([$enable_debug])
if test "$enable_debug" != "no"; then
    CXXFLAGS="$CXXFLAGS -g"
    CFLAGS="$CFLAGS -g"
else
    CXXFLAGS="$CXXFLAGS -DNDEBUG"
    CFLAGS="$CFLAGS -DNDEBUG"
fi


AC_CACHE_CHECK([for __sync_* atomic operations], msgpack_cv_atomic_ops, [
    AC_TRY_LINK([
        int atomic_sub(int i) { return __sync_sub_and_fetch(&i, 1); }
        int atomic_add(int i) { return __sync_add_and_fetch(&i, 1); }
    ], [atomic_sub(1); atomic_add(1);], msgpack_cv_atomic_ops="yes")
])
if test "$msgpack_cv_atomic_ops" != "yes"; then
    if test "$enable_cxx" = "no"; then
        AC_MSG_ERROR([__sync_* atomic operations are not found. Try to enable C++ support.
If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:

  $ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
        ])
    fi

    AC_LANG_PUSH([C++])
    AC_CACHE_CHECK([for __gnu_cxx::__exchange_and_add], msgpack_cv_gcc_cxx_atomic_ops, [
        AC_TRY_LINK([
            #include <bits/atomicity.h>
            int atomic_sub(int i) { return __gnu_cxx::__exchange_and_add(&i, -1) - 1; }
            int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 1) + 1; }
        ], [atomic_sub(1); atomic_add(1);], msgpack_cv_gcc_cxx_atomic_ops="yes")
    ])
    AC_LANG_POP([C++])

    if test "$msgpack_cv_gcc_cxx_atomic_ops" != "yes"; then
        AC_MSG_ERROR([__sync_* atomic operations nor __gnu_cxx::__exchange_and_add are not found.

If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:

  $ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
        ])

    else
        enable_gcc_cxx_atomic=yes
    fi
fi

AM_CONDITIONAL(ENABLE_GCC_CXX_ATOMIC, test "$enable_gcc_cxx_atomic" = "yes")

major=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
minor=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
revision=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).\([[0-9]]*\).*/\3/'`
AC_SUBST(VERSION_MAJOR, $major)
AC_SUBST(VERSION_MINOR, $minor)
AC_SUBST(VERSION_REVISION, $revision)


AC_OUTPUT([Makefile
           msgpack.pc
           src/Makefile
           test/Makefile])