-
Notifications
You must be signed in to change notification settings - Fork 22
/
configure.ac
143 lines (124 loc) · 4.36 KB
/
configure.ac
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([fcml], [1.3.0], [[email protected]])
AM_INIT_AUTOMAKE
LT_PREREQ([2.2])
LT_INIT[win32-dll]
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([include/fcml_common.h])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_AWK
AC_PROG_INSTALL
AM_PROG_LEX
AC_PROG_YACC
AM_PROG_CC_C_O
AC_PROG_LN_S
AC_PROG_MAKE_SET
# Configure options: --enable-debug[=no].
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[enable debug code @<:@default=no@:>@])],
[debug="$withval"], [debug=no])
# Configure options: --disable-cpp-wrapper[=no].
AC_ARG_ENABLE([cpp_wrapper],
[AS_HELP_STRING([--disable-cpp-wrapper],
[disables c++ wrapper tests])],
[], [cpp_wrapper=yes])
# Checks for libraries.
# Checks for header files.
AC_FUNC_ALLOCA
AC_CHECK_HEADERS([inttypes.h libintl.h malloc.h stddef.h stdint.h stdlib.h string.h unistd.h limits.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INT8_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([memset strtoul strtoull vsnprintf memcpy strchr strtol])
# Configure DEBUG source code, if requested.
AS_IF([test "x$debug" = xyes],
[AC_DEFINE([FCML_DEBUG], [1], [Define to enable FCML debug features])])
# Doxygen
AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen])
if test -z "$DOXYGEN"; then
AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
fi
# Disable the internal part of unit tests for cygwin and mingw,
# due to the way Windows exports symbols in shared libraries.
AS_CASE(
[$host_os], [cygwin*|mingw*],
[internal_test=no
# Maybe not the most beatiful way to write it, but as least it doesn't have
# to be written in one line and Eclipse's parser doesn't complain.
internal_test_msg="(Don't be afraid of disabled internal unit tests for"
internal_test_msg="$internal_test_msg"$'\n'" this configuration. Integration tests which are"
internal_test_msg="$internal_test_msg"$'\n'" built on top of the public API are still executed.)"
],
[internal_test=yes]
)
AM_CONDITIONAL([CPP_WRAPPER], [ [test -n "$CXX"] && [test "x$cpp_wrapper" = xyes] ])
AM_CONDITIONAL([ENABLE_INTERNAL_TESTS], [test "x$internal_test" = xyes])
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([docs/doxygen/doxyfile])])
# Configuration files.
AC_CONFIG_FILES([Makefile
src/Makefile
check/Makefile
check/stf/Makefile
check/internal-tests/Makefile
check/public-tests/Makefile
check/cpp-tests/Makefile
example/Makefile
example/fcml-disasm/Makefile
example/fcml-asm/Makefile
example/hsdis/Makefile
win32/Makefile
include/Makefile
docs/doxygen/Makefile])
# Enable __declspec(dllimport) for linking public tests with shared DLL.
AC_CANONICAL_HOST
AS_CASE(
[$enable_shared], [yes],
[AS_CASE(
[$host_os], [cygwin*|mingw*],
[FCML_IMPORT_LIB="-DLIBFCML_DLL_IMPORT"
AC_SUBST([FCML_IMPORT_LIB])]
)]
)
# Check whether the compiler can hide symbols
VISIBILITY_CFLAGS=""
AS_COMPILER_FLAG([-fvisibility=hidden], [VISIBILITY_CFLAGS="-fvisibility=hidden"])
AC_SUBST(VISIBILITY_CFLAGS)
AS_IF([test -n "$VISIBILITY_CFLAGS"],
[AC_DEFINE([SUPPORT_VISIBILITY_HIDDEN], [1], [Support for -fvisibility=hidden flag.])])
CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
AC_OUTPUT
echo "***************************************************
${PACKAGE_NAME} version ${PACKAGE_VERSION}
Host CPU.............: $host_cpu
Host OS:.............: $host_os
Prefix:..............: ${prefix}
Debug Build..........: $debug
C++ wrapper tests....: ${cpp_wrapper:-no}
Internal unit tests..: ${internal_test} ${internal_test_msg}
Shared Library.......: $enable_shared
C Compiler...........: ${CC} ${CFLAGS} ${CPPFLAGS}
C++ Compiler.........: ${CXX} ${CXXFLAGS}
Linker...............: $LD $LDFLAGS $LIBS
Doxygen..............: ${DOXYGEN:-NONE}
***************************************************
"