Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 343 lines (273 sloc) 9.378 kb
a056469 @vinoski set 2.61 as minimum required autoconf version
vinoski authored
1 AC_PREREQ([2.61])
2
fdfd9e3 @klacke cvs fixes + install scripts gentoo/suse/redhat
authored
3 DNA define([AC_CACHE_LOAD], )dnl
f674082 @klacke ""
authored
4 dnl define([AC_CACHE_SAVE], )dnl
5
6 AC_INIT(Makefile)
7
8
9 dnl work out who the cpu, vendor and OS are
10 AC_CANONICAL_SYSTEM
3cdb645 @vinoski teach linux build to distinguish 32- and 64-bit erlang
vinoski authored
11 AC_DEFINE_UNQUOTED(CPU_VENDOR_OS, "$host")
f674082 @klacke ""
authored
12
5018bcc @vinoski determine gcc flags for 32-bit or 64-bit Erlang on OS X Snow Leopard
vinoski authored
13 AC_ERLANG_NEED_ERL
f674082 @klacke ""
authored
14 AC_PATH_PROG(ERLC, erlc)
28e4c73 @klacke first attempt to run properly under cygwin
authored
15
f674082 @klacke ""
authored
16 AC_SUBST(ERL)
17 AC_SUBST(ERLC)
18
189188b @klacke rm configure
authored
19 AC_ARG_WITH(defaultcharset,
cd68727 @vinoski add --disable-sendfile option to configure, fix src/Makefile to clean ya...
vinoski authored
20 AS_HELP_STRING([--with-defaultcharset=String], [specify default charset, i.e UTF-8]))
177f03b @klacke addded configure option -with-defaultcharset
authored
21
22
23 if test "x$with_defaultcharset" = "x" ; then
24 DEFAULT_CHARSET=
25 else
26 DEFAULT_CHARSET=${with_defaultcharset}
27 fi
28
29 AC_SUBST(DEFAULT_CHARSET)
30
c9778e0 @klacke added support for 2 additional configure
authored
31
32
33 AC_ARG_WITH(extrainclude,
cd68727 @vinoski add --disable-sendfile option to configure, fix src/Makefile to clean ya...
vinoski authored
34 AS_HELP_STRING([--with-extrainclude=DIR], [dir to include if e.g. pam is installed in some odd place]))
c9778e0 @klacke added support for 2 additional configure
authored
35
36
37 if test "x$with_extrainclude" = "x" ; then
38 EXTRAINCLUDE=
39 else
40 EXTRAINCLUDE=-I${with_extrainclude}
41 fi
42
43 AC_SUBST(EXTRAINCLUDE)
44
45
46
cd68727 @vinoski add --disable-sendfile option to configure, fix src/Makefile to clean ya...
vinoski authored
47 AC_ARG_ENABLE(pam, AS_HELP_STRING([--disable-pam], [disables pam auth]), EPAM=, EPAM=../priv/epam)
c9778e0 @klacke added support for 2 additional configure
authored
48 AC_SUBST(EPAM)
49
50
51
fdfd9e3 @klacke cvs fixes + install scripts gentoo/suse/redhat
authored
52 dnl ----------------------------------------------------------------------
53 dnl
54 dnl BT_ERL_LIB_VSN figures out version of an erlang application
55 dnl and substitutes it as "APPNAME"_VSN
56 dnl
b4aab16 @vinoski let configure handle erlang built from git clone
vinoski authored
57 dnl Note that in the non-erts case, if checking ERLDIR for a versioned
58 dnl directory fails, it could be because the user is using a git clone
59 dnl of the Erlang/OTP repository. In that case, check for a vsn.mk file
60 dnl in the application subdirectory under the repository lib directory,
61 dnl and if found use the version found there.
fdfd9e3 @klacke cvs fixes + install scripts gentoo/suse/redhat
authored
62
f7d5ad8 @klacke configure patch by dnz
authored
63 AC_DEFUN([BT_ERL_LIB_VSN],
fdfd9e3 @klacke cvs fixes + install scripts gentoo/suse/redhat
authored
64 [
65 AC_MSG_CHECKING([$1 version])
66 AC_CACHE_VAL(bt_cv_$1_vsn,
b4aab16 @vinoski let configure handle erlang built from git clone
vinoski authored
67 [case "$1" in
68 erts)
69 bt_cv_$1_vsn=`"${ERL}" -noshell -eval 'io:format("~s~n",[[erlang:system_info(version)]]), erlang:halt().' | tail -1`
70 ;;
71 *)
72 bt_cv_$1_vsn=`ls -1 "${ERLDIR}" "${ERLDIR}/lib" | \
73 awk -F- '/^$1-/ { if ([$]2 > v) v=[$]2; }
74 END { print v; }'`
75 if test -z "$bt_cv_$1_vsn" ; then
76 bt_cv_$1_vsn=`sed -e 's/^.*= *//' "${ERLDIR}/lib/$1/vsn.mk" 2>/dev/null`
77 fi
78 ;;
79 esac
fdfd9e3 @klacke cvs fixes + install scripts gentoo/suse/redhat
authored
80 case "$bt_cv_$1_vsn" in
81 "")
82 AC_MSG_ERROR("Could not figure out version Erlang library: $1")
83 ;;
84 *)
85 ;;
86 esac])
87 translit($1, [a-z], [A-Z])_VSN=$bt_cv_$1_vsn
88 AC_SUBST(translit($1, [a-z], [A-Z])_VSN)dnl
89 AC_MSG_RESULT($bt_cv_$1_vsn)
90 ])dnl
91
92
f674082 @klacke ""
authored
93
28e4c73 @klacke first attempt to run properly under cygwin
authored
94
6b56677 @vinoski filter erl output for setting ERLDIR
vinoski authored
95 ERLDIR=`"${ERL}" -noshell -eval 'io:format("~s~n",[[code:root_dir()]]), erlang:halt().' | tail -1`
e7e6404 @jamesleegwu configure ERLBINDIR relative to ERLDIR
jamesleegwu authored
96 ERLBINDIR="${ERLDIR}/bin"
855d191 apparently erl can ?? soon be an executable, canot grep in script
Claes Wikstrom authored
97 ERL_DLL_LIB="${ERLDIR}/usr/lib/erl_dll.lib"
98
f674082 @klacke ""
authored
99
28e4c73 @klacke first attempt to run properly under cygwin
authored
100 if test ! -d "$ERLDIR" ; then
0be3c7e @klacke untabified all of yaws
authored
101 AC_MSG_ERROR([Broken Erlang installation, $ERLDIR does not exist!])
f674082 @klacke ""
authored
102 fi
103 AC_SUBST(ERLDIR)
e7e6404 @jamesleegwu configure ERLBINDIR relative to ERLDIR
jamesleegwu authored
104 AC_SUBST(ERLBINDIR)
28e4c73 @klacke first attempt to run properly under cygwin
authored
105 AC_SUBST(ERL_DLL_LIB)
f674082 @klacke ""
authored
106
b4aab16 @vinoski let configure handle erlang built from git clone
vinoski authored
107 BT_ERL_LIB_VSN(erts)
108
1a888aa @vinoski fix configure's ERTS version checking for file:sendfile/5
vinoski authored
109 set `echo $bt_cv_erts_vsn | sed 's/\./ /g'`
110 ERTS_MAJOR=$1
111 ERTS_MINOR=$2
112 ERTS_MAINT=${3:-0}
f5eb9d5 @klacke conditional compile of websockets
authored
113 AC_SUBST(ERTS_MINOR)
114 AC_SUBST(ERTS_MAJOR)
115
35a5c1a @vinoski add configure detection of erts bits support
vinoski authored
116 if test $ERTS_MAJOR -gt 5 -o '(' $ERTS_MAJOR -eq 5 -a $ERTS_MINOR -gt 6 ')'; then
117 BITS_SUPPORT=true
118 fi
119 AC_SUBST(BITS_SUPPORT)
120
2ae9701 @klacke Added a 'make release' target in the top makefile. he release
authored
121 BT_ERL_LIB_VSN(kernel)
122 BT_ERL_LIB_VSN(stdlib)
123 BT_ERL_LIB_VSN(sasl)
b45c0a4 @klacke dialyzer work
authored
124 BT_ERL_LIB_VSN(ssl)
2ae9701 @klacke Added a 'make release' target in the top makefile. he release
authored
125 BT_ERL_LIB_VSN(mnesia)
126
f5eb9d5 @klacke conditional compile of websockets
authored
127
28e4c73 @klacke first attempt to run properly under cygwin
authored
128 AC_PROG_CC
129 AC_PROG_GCC_TRADITIONAL
f674082 @klacke ""
authored
130
131
28e4c73 @klacke first attempt to run properly under cygwin
authored
132 dnl ===============================================================
133 dnl Checks for programs.
134 dnl ===============================================================
f674082 @klacke ""
authored
135
136
137
3cdb645 @vinoski teach linux build to distinguish 32- and 64-bit erlang
vinoski authored
138 case "$host_os" in
f674082 @klacke ""
authored
139 *cygwin*)
140 WIN32=win32
8a5d8e7 @klacke Configure script broken on openbsd due to cygwin weirdness
authored
141 cat >> confdefs.h << EOF
28e4c73 @klacke first attempt to run properly under cygwin
authored
142 #define WIN32 1
143 EOF
c73cff6 yaws [PATCH] Use $CC instead of gcc
dnz@bk.ru authored
144 LD_SHARED="$CC -shared"
0be3c7e @klacke untabified all of yaws
authored
145 DLL=dll
6ed3cb4 @klacke configure woes
authored
146 DLL_LIBS="-lc \"$ERL_DLL_LIB\""
5018bcc @vinoski determine gcc flags for 32-bit or 64-bit Erlang on OS X Snow Leopard
vinoski authored
147
f674082 @klacke ""
authored
148
0be3c7e @klacke untabified all of yaws
authored
149 EXE=.exe
150 AC_SUBST(EXE)
f674082 @klacke ""
authored
151
0be3c7e @klacke untabified all of yaws
authored
152 DLL=dll
153 AC_SUBST(DLL)
f674082 @klacke ""
authored
154
0be3c7e @klacke untabified all of yaws
authored
155 OBJ=obj
156 AC_SUBST(OBJ)
157 ;;
f674082 @klacke ""
authored
158 *)
159
160
0be3c7e @klacke untabified all of yaws
authored
161 LINKER=$CC
162 AC_SUBST(LINKER)
f674082 @klacke ""
authored
163
0be3c7e @klacke untabified all of yaws
authored
164 AC_SUBST(CFLAGS)
f674082 @klacke ""
authored
165
0be3c7e @klacke untabified all of yaws
authored
166 OUT="-o "
167 AC_SUBST(OUT)
f674082 @klacke ""
authored
168
0be3c7e @klacke untabified all of yaws
authored
169 DLL=so
170 AC_SUBST(DLL)
171 OBJ=o
172 AC_SUBST(OBJ)
f674082 @klacke ""
authored
173
174
0be3c7e @klacke untabified all of yaws
authored
175 ;;
f674082 @klacke ""
authored
176 esac
177
28e4c73 @klacke first attempt to run properly under cygwin
authored
178
179 AC_SUBST(DLL_LIBS)
180
f674082 @klacke ""
authored
181 AC_PROG_MAKE_SET
182 AC_PROG_INSTALL
183
184
6c7d7a4 @klacke configure/latex support and also slightly nicer listdir output by Hans U...
authored
185 dnl Make LaTeX and related commands configurable
186 dnl
187 dnl We might want to check whether latex is pdflatex and creates
188 dnl PDF instead of DVI without being given -output-format=dvi.
189 dnl However, this at least allows to give the working command at
190 dnl configure time.
191 AC_ARG_VAR([DVILATEX], [(pdf)latex command creating DVI file])
192 AC_CHECK_PROG([DVILATEX], [latex], [latex])
193
194 AC_ARG_VAR([DVIPS], [dvips command])
195 AC_CHECK_PROG([DVIPS], [dvips], [dvips])
196
197 AC_ARG_VAR([PDFLATEX], [(pdf)latex command creating PDF file])
198 AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex])
199
200 AC_ARG_VAR([EPSTOPDF], [epstopdf command])
201 AC_CHECK_PROG([EPSTOPDF], [epstopdf], [epstopdf])
202
203 AS_IF([test "x$DVILATEX" = "xno" || test "x$DVIPS" = "xno"],
204 [AC_SUBST([COND_DVILATEX], ["-"])],
205 [AC_SUBST([COND_DVILATEX], [""])])
206
207 AS_IF([test "x$PDFLATEX" = "xno" || test "x$EPSTOPDF" = "xno"],
208 [AC_SUBST([COND_PDFLATEX], ["-"])],
209 [AC_SUBST([COND_PDFLATEX], [""])])
210
211
7285034 @sstrollo Handle pam include files in different location...
sstrollo authored
212 dnl Sigh, pam headers do not seem to have a standard place. On FreeBSD and
213 dnl Linuces I've seen they are in /usr/include/security, but MacOS has them
47c0c70 @vinoski add pkg-config support contributed by Olivier Girondel
vinoski authored
214 dnl in /usr/include/pam... I'm too sick of M4 at this very moment to write
7285034 @sstrollo Handle pam include files in different location...
sstrollo authored
215 dnl a test that searches for the files, so hard coded for now...
c9778e0 @klacke added support for 2 additional configure
authored
216 dnl or use --with-extrainclude=....
7285034 @sstrollo Handle pam include files in different location...
sstrollo authored
217 CFLAGS="$CFLAGS -I/usr/include/security"
2150708 @tuncer Use file:sendfile/5 if available
tuncer authored
218 HAVE_YAWS_SENDFILE=false
7285034 @sstrollo Handle pam include files in different location...
sstrollo authored
219
3cdb645 @vinoski teach linux build to distinguish 32- and 64-bit erlang
vinoski authored
220 case "$host_os" in
0be3c7e @klacke untabified all of yaws
authored
221 *linux*)
222 AC_DEFINE(LINUX)
98f8db9 @yrashk Fix configure failing to determine word size on Linux platform.
yrashk authored
223 AC_LANG(Erlang)
3cdb645 @vinoski teach linux build to distinguish 32- and 64-bit erlang
vinoski authored
224 AC_RUN_IFELSE(
225 [AC_LANG_PROGRAM([],[dnl
11b272b @vinoski use {wordsize, external} in configure script
vinoski authored
226 halt(try erlang:system_info({wordsize,external}) of
227 8 -> 0; 4 -> 1
228 catch _:badarg ->
229 case erlang:system_info(wordsize) of
230 8 -> 0; 4 -> 1
231 end end)])],
3cdb645 @vinoski teach linux build to distinguish 32- and 64-bit erlang
vinoski authored
232 [AC_MSG_NOTICE(found 64-bit Erlang)
233 case "$host_cpu" in
234 x86_64) CBIT= ;;
235 *) CBIT=-m64 ;;
236 esac],
237 [AC_MSG_NOTICE(found 32-bit Erlang)
238 case "$host_cpu" in
239 i?86) CBIT= ;;
1c4d428 @vinoski support Raspberry Pi in configure.in (Anders Nygren)
vinoski authored
240 armv6l) CBIT= ;;
3cdb645 @vinoski teach linux build to distinguish 32- and 64-bit erlang
vinoski authored
241 *) CBIT=-m32 ;;
242 esac])
243 CFLAGS="$CFLAGS $CBIT"
244 LD_SHARED="$CC $CBIT -shared"
0be3c7e @klacke untabified all of yaws
authored
245 AC_SUBST(LD_SHARED)
246 FPIC=-fpic
247 AC_SUBST(FPIC)
2150708 @tuncer Use file:sendfile/5 if available
tuncer authored
248 HAVE_YAWS_SENDFILE=true
0be3c7e @klacke untabified all of yaws
authored
249 ;;
250
251 *solaris*)
252 AC_DEFINE(SOLARIS)
253 LD_SHARED="ld -G"
254 AC_SUBST(LD_SHARED)
255 LIBS="$LIBS -lsocket -lnsl -lresolv"
256 AC_SUBST(LIBS)
257 FPIC=-fpic
258 AC_SUBST(FPIC)
259 ;;
260
261 *bsd*)
262 AC_DEFINE(BSD)
3cdb645 @vinoski teach linux build to distinguish 32- and 64-bit erlang
vinoski authored
263 case "$host_os" in
12471ad @klacke added configure support for sendfile
authored
264 freebsd*)
2150708 @tuncer Use file:sendfile/5 if available
tuncer authored
265 HAVE_YAWS_SENDFILE=true
12471ad @klacke added configure support for sendfile
authored
266 ;;
0be3c7e @klacke untabified all of yaws
authored
267 bsdi*)
f674082 @klacke ""
authored
268 BSDI=bsdi
0be3c7e @klacke untabified all of yaws
authored
269 AC_DEFINE(BSDI)
270 AC_SUBST(BSDI)
271 ;;
272 esac
5018bcc @vinoski determine gcc flags for 32-bit or 64-bit Erlang on OS X Snow Leopard
vinoski authored
273 LD_SHARED="ld -Bshareable"
0be3c7e @klacke untabified all of yaws
authored
274 AC_SUBST(LD_SHARED)
275 FPIC=-fpic
276 AC_SUBST(FPIC)
277 ;;
278 *darwin*)
98f8db9 @yrashk Fix configure failing to determine word size on Linux platform.
yrashk authored
279 AC_LANG(C)
2150708 @tuncer Use file:sendfile/5 if available
tuncer authored
280 AC_CHECK_LIB([c],[sendfile],[HAVE_YAWS_SENDFILE=true])
3cdb645 @vinoski teach linux build to distinguish 32- and 64-bit erlang
vinoski authored
281 case "$host_os" in
c61e0c0 @vinoski changes for OS X Lion for build and test
vinoski authored
282 darwin1?*)
5018bcc @vinoski determine gcc flags for 32-bit or 64-bit Erlang on OS X Snow Leopard
vinoski authored
283 AC_LANG(Erlang)
284 AC_RUN_IFELSE(
285 [AC_LANG_PROGRAM([],[dnl
11b272b @vinoski use {wordsize, external} in configure script
vinoski authored
286 halt(try erlang:system_info({wordsize,external}) of
287 8 -> 0; 4 -> 1
288 catch _:badarg ->
289 case erlang:system_info(wordsize) of
290 8 -> 0; 4 -> 1
291 end end)])],
5018bcc @vinoski determine gcc flags for 32-bit or 64-bit Erlang on OS X Snow Leopard
vinoski authored
292 [AC_MSG_NOTICE(found 64-bit Erlang)
293 CBIT=-m64],
294 [AC_MSG_NOTICE(found 32-bit Erlang)
295 CBIT=-m32])
296 ;;
297 *)
298 CBIT=""
299 ;;
300 esac
301 CFLAGS="$CFLAGS $CBIT -I/usr/include/pam"
302 LD_SHARED="$CC $CBIT -bundle -fPIC -flat_namespace -undefined suppress"
10febe6 @vinoski added sendfile check for Darwin, since no sendfile is available on OS X ...
vinoski authored
303 AC_SUBST(LD_SHARED)
0be3c7e @klacke untabified all of yaws
authored
304 FPIC=-fPIC
305 AC_SUBST(FPIC)
306 ;;
307 *cygwin*)
308 AC_PATH_PROG(WERL, werl)
309 AC_SUBST(WERL)
310 AC_DEFINE(WIN32)
311 FPIC=-fpic
312 AC_SUBST(FPIC)
313 AC_SUBST(WIN32)
314 ;;
315 *)
f674082 @klacke ""
authored
316 AC_MSG_RESULT(unknown)
3cdb645 @vinoski teach linux build to distinguish 32- and 64-bit erlang
vinoski authored
317 AC_MSG_ERROR(Unsupported host OS!)
0be3c7e @klacke untabified all of yaws
authored
318 ;;
f674082 @klacke ""
authored
319 esac
320
cd68727 @vinoski add --disable-sendfile option to configure, fix src/Makefile to clean ya...
vinoski authored
321 AC_ARG_ENABLE(sendfile, AS_HELP_STRING([--disable-sendfile], [disables use of sendfile system call]),
2150708 @tuncer Use file:sendfile/5 if available
tuncer authored
322 [ test "$enableval" = no && HAVE_YAWS_SENDFILE=false ])
323 file_sendfile=`"${ERL}" -noshell -eval 'io:format("~p~n",[[erlang:function_exported(file, sendfile, 5)]]), erlang:halt().' | tail -1`
1a888aa @vinoski fix configure's ERTS version checking for file:sendfile/5
vinoski authored
324 if test "$file_sendfile" = true -a \
325 '(' $ERTS_MAJOR -gt 5 -o \
326 '(' $ERTS_MAJOR -eq 5 -a $ERTS_MINOR -gt 9 ')' -o \
327 '(' $ERTS_MAJOR -eq 5 -a $ERTS_MINOR -eq 9 -a $ERTS_MAINT -ge 1 ')' ')' ; then
2150708 @tuncer Use file:sendfile/5 if available
tuncer authored
328 HAVE_YAWS_SENDFILE=false
329 AC_MSG_NOTICE(found file:sendfile/5)
330 fi
331 AC_SUBST(HAVE_YAWS_SENDFILE)
332
45a3567 @klacke test case number 1
authored
333 YTOP=`pwd`
334 AC_SUBST(YTOP)
f674082 @klacke ""
authored
335 AC_OUTPUT(include.mk)
45a3567 @klacke test case number 1
authored
336 AC_OUTPUT(test/support/include.mk)
337 AC_OUTPUT(test/support/include.sh)
47c0c70 @vinoski add pkg-config support contributed by Olivier Girondel
vinoski authored
338
339 dnl pkg-config support
340 . ./vsn.mk
341 AC_SUBST(YAWS_VSN)
342 AC_OUTPUT(yaws.pc)
Something went wrong with that request. Please try again.