forked from silnrsi/grcompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
153 lines (125 loc) · 3.79 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
144
145
146
147
148
149
150
151
152
153
AC_PREREQ(2.54)
AC_INIT(grcompiler, 5.1, [email protected])
AC_CONFIG_SRCDIR(compiler/GrpParser.g)
AC_CONFIG_AUX_DIR(admin)
# setup automake
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
# System checks.
AC_CANONICAL_HOST
AM_ICONV
# Optional features
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug], [build with debugging. (default=no)]),
[enable_debug=yes], [enable_debug=no])
AC_ARG_ENABLE(final,
AC_HELP_STRING([--enable-final], [build with optimizations and no debugging. (default=no)]),
[enable_final=yes], [enable_final=no])
AC_ARG_ENABLE(profile,
AC_HELP_STRING([--enable-profile], [allow profiling (default=no)]),
[enable_profile=yes], [enable_profile=no])
AC_ARG_ENABLE(profilefn,
AC_HELP_STRING([--enable-profilefn], [allow functioncheck profiling (default=no)]),
[enable_profilefn=yes],[enable_profilefn=no])
# Checks for programs.
AC_PROG_CXX
#AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PATH_PROG(LSB_RELEASE, lsb_release, no)
# docbook2man utility
AC_ARG_VAR(DOCBOOK2MAN, [Program used to process XML man pages])
AC_CHECK_PROGS(DOCBOOK2MAN, docbook2x-man docbook2man, no)
if test "$DOCBOOK2MAN" = no; then
AC_MSG_FAILURE([Could not find a program to process XML man pages])
fi
# ICU configuration
AC_ARG_VAR(ICU_CONFIG, [Check for ICU configuration helper])
AC_CHECK_PROGS(ICU_CONFIG, icu-config, no)
# Set default language for tests
AC_LANG(C++)
# Checks for libraries.
if test "$ICU_CONFIG" == no; then
AC_MSG_FAILURE([Could not find icu-config])
else
LIBS="$LIBS `$ICU_CONFIG --ldflags-libsonly`"
fi
# Checks for header files.
# need to check for icu .h files as in unicode/uchar.h
AC_CHECK_HEADER(unicode/uchar.h,,)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
# Checks for library functions.
AC_CHECK_DECLS([program_invocation_short_name],,,[[#include <errno.h>]])
# Setup the build compiler flags and linker flags.
# Enable debug
if test "$enable_debug" != no; then
CFLAGS="$CFLAGS -O0"
CXXFLAGS="$CXXFLAGS -O0"
test "$ac_cv_prog_cc_g" = yes && CFLAGS="$CFLAGS -g"
test "$ac_cv_prog_cxx_g" = yes && CXXFLAGS="$CXXFLAGS -g"
CFLAGS="$CFLAGS -Wno-unknown-pragmas -Wparentheses -Werror "
CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas -Wparentheses -Werror "
else
CFLAGS="$CFLAGS -DNDEBUG"
CXXFLAGS="$CXXFLAGS -DNDEBUG"
fi
# Enable final
if test "$enable_final" != no; then
CFLAGS="-O3 -DNDEBUG"
CXXFLAGS="-O3 -DNDEBUG"
fi
# Enable profile
if test "$enable_profile" != no; then
CFLAGS="$CFLAGS -pg "
CXXFLAGS="$CXXFLAGS -pg "
fi
if test "$enable_profilefn" != no; then
CFLAGS="$CFLAGS -g -finstrument-functions "
CXXFLAGS="$CXXFLAGS -g -finstrument-functions "
LIBS="$LIBS -g -finstrument-functions -lfnccheck "
fi
# Find distrib codename
AC_MSG_CHECKING(if already have REL_CODENAME)
if test -z "${REL_CODENAME}"; then
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if have lsb_release)
if test "${LSB_RELEASE}" = "no"; then
AC_MSG_RESULT(no)
REL_CODENAME="unstable"
else
AC_MSG_RESULT(yes)
AC_MSG_CHECKING(if LSB_RELEASE is empty)
if test -z ${LSB_RELEASE}; then
AC_MSG_RESULT(yes)
REL_CODENAME="unstable"
else
AC_MSG_RESULT(no)
CODENAME=`${LSB_RELEASE} -c | sed -e 's/^\S*\s*//'`
AC_MSG_CHECKING(if release is sid)
if test ${CODENAME} = 'sid'; then
AC_MSG_RESULT(yes)
REL_CODENAME="unstable"
else
AC_MSG_RESULT(no, ${CODENAME})
REL_CODENAME=${CODENAME}
fi
fi
fi
else
AC_MSG_RESULT(yes)
fi
AC_SUBST(REL_CODENAME)
#CXXFLAGS="$CXXFLAGS -DGR_NAMESPACE=1"
AC_CONFIG_FILES(Makefile \
doc/Makefile \
preprocessor/Makefile \
compiler/Makefile \
compiler/Generic/Makefile \
compiler/Grammar/Makefile \
compiler/LZ4/Makefile \
test/Makefile)
AC_CONFIG_SUBDIRS([test/GrcRegressionTest])
AC_OUTPUT