forked from simplegeo/scribe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
acinclude.m4
253 lines (243 loc) · 5.74 KB
/
acinclude.m4
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
AC_DEFUN([FB_INITIALIZE],
[
AM_INIT_AUTOMAKE([ foreign 1.9.5 no-define ])
if test "x$1" = "xlocalinstall"; then
wdir=`pwd`
# To use $wdir undef quote.
#
##########
AC_PREFIX_DEFAULT([`pwd`/install])
echo
fi
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB(RANLIB, ranlib)
AC_PATH_PROGS(BASH, bash)
AC_PATH_PROGS(PERL, perl)
AC_PATH_PROGS(PYTHON, python)
AC_PATH_PROGS(AR, ar)
AC_PATH_PROGS(ANT, ant)
PRODUCT_MK=""
])
AC_DEFUN([FB_WITH_EXTERNAL_PATH],
[
cdir=`pwd`
AC_MSG_CHECKING([Checking EXTERNAL_PATH set to])
AC_ARG_WITH([externalpath],
[ --with-externalpath=DIR User specified path to external facebook components.],
[
if test "x${EXTERNAL_PATH}" != "x"; then
echo ""
echo "ERROR: You have already set EXTERNAL_PATH in your environment"
echo "Cannot override it using --with-externalpath. Unset EXTERNAL_PATH to use this option"
exit 1
fi
EXTERNAL_PATH=$withval
],
[
if test "x${EXTERNAL_PATH}" = "x"; then
EXTERNAL_PATH=$1
fi
]
)
if test "x${EXTERNAL_PATH}" = "x"; then
export EXTERNAL_PATH="$cdir/external"
GLOBAL_HEADER_MK="include ${EXTERNAL_PATH}/global_header.mk"
GLOBAL_FOOTER_MK="include ${EXTERNAL_PATH}/global_footer.mk"
else
export EXTERNAL_PATH
GLOBAL_HEADER_MK="include ${EXTERNAL_PATH}/global_header.mk"
GLOBAL_FOOTER_MK="include ${EXTERNAL_PATH}/global_footer.mk"
fi
AC_MSG_RESULT($EXTERNAL_PATH)
if test ! -d ${EXTERNAL_PATH}; then
echo ""
echo "ERROR: EXTERNAL_PATH set to an nonexistent directory ${EXTERNAL_PATH}"
exit 1
fi
AC_SUBST(EXTERNAL_PATH)
AC_SUBST(GLOBAL_HEADER_MK)
AC_SUBST(GLOBAL_FOOTER_MK)
])
# Set option to enable shared mode. Set DEBUG and OPT for use in Makefile.am.
AC_DEFUN([FB_ENABLE_DEFAULT_OPT_BUILD],
[
AC_MSG_CHECKING([whether to enable optimized build])
AC_ARG_ENABLE([opt],
[ --disable-opt Set up debug mode.],
[
ENABLED_OPT=$enableval
],
[
ENABLED_OPT="yes"
]
)
#if test "$ENABLED_OPT" = "yes"
#then
# CFLAGS="-Wall -O3 -I/usr/lib/jvm/java-6-sun-1.6.0.20/include -I/usr/lib/jvm/java-6-sun-1.6.0.20/include/linux -L/usr/lib/jvm/java-6-sun/jre/lib/$(DEB_BUILD_ARCH)/server"
# CXXFLAGS="-Wall -O3 -I/usr/lib/jvm/java-6-sun-1.6.0.20/include -I/usr/lib/jvm/java-6-sun-1.6.0.20/include/linux -L/usr/lib/jvm/java-6-sun/jre/lib/$(DEB_BUILD_ARCH)/server"
#else
# CFLAGS="-Wall -g"
# CXXFLAGS="-Wall -g"
#fi
AC_MSG_RESULT($ENABLED_OPT)
AM_CONDITIONAL([OPT], [test "$ENABLED_OPT" = yes])
AM_CONDITIONAL([DEBUG], [test "$ENABLED_OPT" = no])
])
# Set option to enable debug mode. Set DEBUG and OPT for use in Makefile.am.
AC_DEFUN([FB_ENABLE_DEFAULT_DEBUG_BUILD],
[
AC_MSG_CHECKING([whether to enable debug build])
AC_ARG_ENABLE([debug],
[ --disable-debug Set up opt mode.],
[
ENABLED_DEBUG=$enableval
],
[
ENABLED_DEBUG="yes"
]
)
#if test "$ENABLED_DEBUG" = "yes"
#then
# CFLAGS="-Wall -g"
# CXXFLAGS="-Wall -g"
#else
# CFLAGS="-Wall -O3"
# CXXFLAGS="-Wall -O3"
#fi
AC_MSG_RESULT($ENABLED_DEBUG)
AM_CONDITIONAL([DEBUG], [test "$ENABLED_DEBUG" = yes])
AM_CONDITIONAL([OPT], [test "$ENABLED_DEBUG" = no])
])
# Set option to enable static libs.
AC_DEFUN([FB_ENABLE_DEFAULT_STATIC],
[
SHARED=""
STATIC=""
AC_MSG_CHECKING([whether to enable static mode])
AC_ARG_ENABLE([static],
[ --disable-static Set up shared mode.],
[
ENABLED_STATIC=$enableval
],
[
ENABLED_STATIC="yes"
]
)
if test "$ENABLED_STATIC" = "yes"
then
LTYPE=".a"
else
LTYPE=".so"
SHARED_CXXFLAGS="-fPIC"
SHARED_CFLAGS="-fPIC"
SHARED_LDFLAGS="-shared -fPIC"
AC_SUBST(SHARED_CXXFLAGS)
AC_SUBST(SHARED_CFLAGS)
AC_SUBST(SHARED_LDFLAGS)
fi
AC_MSG_RESULT($ENABLED_STATIC)
AC_SUBST(LTYPE)
AM_CONDITIONAL([STATIC], [test "$ENABLED_STATIC" = yes])
AM_CONDITIONAL([SHARED], [test "$ENABLED_STATIC" = no])
])
# Set option to enable shared libs.
AC_DEFUN([FB_ENABLE_DEFAULT_SHARED],
[
SHARED=""
STATIC=""
AC_MSG_CHECKING([whether to enable shared mode])
AC_ARG_ENABLE([shared],
[ --disable-shared Set up static mode.],
[
ENABLED_SHARED=$enableval
],
[
ENABLED_SHARED="yes"
]
)
if test "$ENABLED_SHARED" = "yes"
then
LTYPE=".so"
SHARED_CXXFLAGS="-fPIC"
SHARED_CFLAGS="-fPIC"
SHARED_LDFLAGS="-shared -fPIC"
AC_SUBST(SHARED_CXXFLAGS)
AC_SUBST(SHARED_CFLAGS)
AC_SUBST(SHARED_LDFLAGS)
else
LTYPE=".a"
fi
AC_MSG_RESULT($ENABLED_SHARED)
AC_SUBST(LTYPE)
AM_CONDITIONAL([SHARED], [test "$ENABLED_SHARED" = yes])
AM_CONDITIONAL([STATIC], [test "$ENABLED_SHARED" = no])
])
# Generates define flags and conditionals as specified by user.
# This gets enabled *only* if user selects --enable-<FEATURE> otion.
AC_DEFUN([FB_ENABLE_FEATURE],
[
ENABLE=""
flag="$1"
value="$3"
AC_MSG_CHECKING([whether to enable $1])
AC_ARG_ENABLE([$2],
[ --enable-$2 Enable $2.],
[
ENABLE=$enableval
],
[
ENABLE="no"
]
)
AM_CONDITIONAL([$1], [test "$ENABLE" = yes])
if test "$ENABLE" = "yes"
then
if test "x${value}" = "x"
then
AC_DEFINE([$1])
else
AC_DEFINE_UNQUOTED([$1], [$value])
fi
fi
AC_MSG_RESULT($ENABLE)
])
# can also use eval $2=$withval;AC_SUBST($2)
AC_DEFUN([FB_WITH_PATH],
[
USRFLAG=""
USRFLAG=$1
AC_MSG_CHECKING([Checking $1 set to])
AC_ARG_WITH([$2],
[ --with-$2=DIR User specified path.],
[
LOC=$withval
eval $USRFLAG=$withval
],
[
LOC=$3
eval $USRFLAG=$3
]
)
AC_SUBST([$1])
AC_MSG_RESULT($LOC)
])
AC_DEFUN([FB_SET_FLAG_VALUE],
[
SETFLAG=""
AC_MSG_CHECKING([Checking $1 set to])
SETFLAG=$1
eval $SETFLAG=\"$2\"
AC_SUBST([$SETFLAG])
AC_MSG_RESULT($2)
])
# NOTES
# if using if else bourne stmt you must have more than a macro in it.
# EX1 is not correct. EX2 is correct
# EX1: if test "$XX" = "yes"; then
# AC_SUBST(xx)
# fi
# EX2: if test "$XX" = "yes"; then
# xx="foo"
# AC_SUBST(xx)
# fi