forked from erlyaws/yaws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
270 lines (207 loc) · 6.41 KB
/
configure.in
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
DNA define([AC_CACHE_LOAD], )dnl
dnl define([AC_CACHE_SAVE], )dnl
AC_INIT(Makefile)
dnl work out who the cpu, vendor and OS are
AC_CANONICAL_SYSTEM
AC_DEFINE_UNQUOTED(CPU_VENDOR_OS, "$target")
AC_PATH_PROG(ERL, erl)
AC_PATH_PROG(ERLC, erlc)
ERLBINDIR=`dirname "$ERL"` ; ERLBINDIR=`dirname "$ERLBINDIR"`/lib/erlang/bin
AC_SUBST(ERL)
AC_SUBST(ERLC)
AC_SUBST(ERLBINDIR)
AC_ARG_WITH(default-charset,
AS_HELP_STRING([--with-defaultcharset=String], [specify default charset, i.e UTF-8]))
if test "x$with_defaultcharset" = "x" ; then
DEFAULT_CHARSET=
else
DEFAULT_CHARSET=${with_defaultcharset}
fi
AC_SUBST(DEFAULT_CHARSET)
AC_ARG_WITH(extrainclude,
AS_HELP_STRING([--with-extrainclude=DIR], [dir to include if e.g. pam is installed in some odd place]))
if test "x$with_extrainclude" = "x" ; then
EXTRAINCLUDE=
else
EXTRAINCLUDE=-I${with_extrainclude}
fi
AC_SUBST(EXTRAINCLUDE)
AC_ARG_ENABLE(pam, AS_HELP_STRING([--disable-pam], [disables pam auth]), EPAM=, EPAM=../priv/epam)
AC_SUBST(EPAM)
dnl ----------------------------------------------------------------------
dnl
dnl BT_ERL_LIB_VSN figures out version of an erlang application
dnl and substitutes it as "APPNAME"_VSN
dnl
AC_DEFUN([BT_ERL_LIB_VSN],
[
AC_MSG_CHECKING([$1 version])
AC_CACHE_VAL(bt_cv_$1_vsn,
[bt_cv_$1_vsn=`ls "${ERLDIR}" "${ERLDIR}/lib" | \
awk -F- '/^$1-/ { if ([$]2 > v) v=[$]2; }
END { print v; }'`
case "$bt_cv_$1_vsn" in
"")
AC_MSG_ERROR("Could not figure out version Erlang library: $1")
;;
*)
;;
esac])
translit($1, [a-z], [A-Z])_VSN=$bt_cv_$1_vsn
AC_SUBST(translit($1, [a-z], [A-Z])_VSN)dnl
AC_MSG_RESULT($bt_cv_$1_vsn)
])dnl
dnl
dnl I keep the cugwin dll code in case I later learn how to
dnl compile a linked in driver on windows using gcc
dnl
case "$target_os" in
*cygwin*)
ERLDIR=`echo "${ERL}" | sed 's/\/bin\/*erl.*//'`
ERL_DLL_LIB="${ERLDIR}/usr/lib/erl_dll.lib"
AC_SUBST(ERL_DLL_LIB)
;;
*)
ERLDIR=`awk -F= '/ROOTDIR=/ { print [$]2; exit; }' $ERL`;;
esac
if test ! -d "$ERLDIR" ; then
AC_MSG_ERROR([Broken Erlang installation, $ERLDIR does not exist!])
fi
AC_SUBST(ERLDIR)
AC_SUBST(ERL_DLL_LIB)
BT_ERL_LIB_VSN(erts)
BT_ERL_LIB_VSN(kernel)
BT_ERL_LIB_VSN(stdlib)
BT_ERL_LIB_VSN(sasl)
BT_ERL_LIB_VSN(mnesia)
AC_PROG_CC
AC_PROG_GCC_TRADITIONAL
dnl ===============================================================
dnl Checks for programs.
dnl ===============================================================
case "$target_os" in
*cygwin*)
WIN32=win32
cat >> confdefs.h << EOF
#define WIN32 1
EOF
LD_SHARED="$CC -shared"
DLL=dll
DLL_LIBS="-lc \"$ERL_DLL_LIB\""
EXE=.exe
AC_SUBST(EXE)
DLL=dll
AC_SUBST(DLL)
OBJ=obj
AC_SUBST(OBJ)
;;
*)
LINKER=$CC
AC_SUBST(LINKER)
AC_SUBST(CFLAGS)
OUT="-o "
AC_SUBST(OUT)
DLL=so
AC_SUBST(DLL)
OBJ=o
AC_SUBST(OBJ)
;;
esac
AC_SUBST(DLL_LIBS)
AC_PROG_MAKE_SET
AC_PROG_INSTALL
dnl Make LaTeX and related commands configurable
dnl
dnl We might want to check whether latex is pdflatex and creates
dnl PDF instead of DVI without being given -output-format=dvi.
dnl However, this at least allows to give the working command at
dnl configure time.
AC_ARG_VAR([DVILATEX], [(pdf)latex command creating DVI file])
AC_CHECK_PROG([DVILATEX], [latex], [latex])
AC_ARG_VAR([DVIPS], [dvips command])
AC_CHECK_PROG([DVIPS], [dvips], [dvips])
AC_ARG_VAR([PDFLATEX], [(pdf)latex command creating PDF file])
AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex])
AC_ARG_VAR([EPSTOPDF], [epstopdf command])
AC_CHECK_PROG([EPSTOPDF], [epstopdf], [epstopdf])
AS_IF([test "x$DVILATEX" = "xno" || test "x$DVIPS" = "xno"],
[AC_SUBST([COND_DVILATEX], ["-"])],
[AC_SUBST([COND_DVILATEX], [""])])
AS_IF([test "x$PDFLATEX" = "xno" || test "x$EPSTOPDF" = "xno"],
[AC_SUBST([COND_PDFLATEX], ["-"])],
[AC_SUBST([COND_PDFLATEX], [""])])
dnl Sigh, pam headers do not seem to have a standard place. On FreeBSD and
dnl Linuces I've seen they are in /usr/include/security, but MacOS has them
dnl in /usr/include/pam... I'm too sick of M4 at this very moment to write
dnl a test that searches for the files, so hard coded for now...
dnl or use --with-extrainclude=....
CFLAGS="$CFLAGS -I/usr/include/security"
HAVE_SENDFILE=false
case "$target_os" in
*linux*)
AC_DEFINE(LINUX)
LD_SHARED="$CC -shared"
AC_SUBST(LD_SHARED)
FPIC=-fpic
AC_SUBST(FPIC)
HAVE_SENDFILE=true
;;
*solaris*)
AC_DEFINE(SOLARIS)
LD_SHARED="ld -G"
AC_SUBST(LD_SHARED)
LIBS="$LIBS -lsocket -lnsl -lresolv"
AC_SUBST(LIBS)
FPIC=-fpic
AC_SUBST(FPIC)
;;
*bsd*)
AC_DEFINE(BSD)
case "$target_os" in
freebsd*)
HAVE_SENDFILE=true
;;
bsdi*)
BSDI=bsdi
AC_DEFINE(BSDI)
AC_SUBST(BSDI)
;;
esac
LD_SHARED="ld -Bshareable"
AC_SUBST(LD_SHARED)
FPIC=-fpic
AC_SUBST(FPIC)
;;
*darwin*)
AC_CHECK_LIB([c],[sendfile],[HAVE_SENDFILE=true])
CFLAGS="$CFLAGS -I/usr/include/pam"
LD_SHARED="$CC -bundle -fPIC -flat_namespace -undefined suppress"
AC_SUBST(LD_SHARED)
FPIC=-fPIC
AC_SUBST(FPIC)
;;
*cygwin*)
AC_PATH_PROG(WERL, werl)
AC_SUBST(WERL)
AC_DEFINE(WIN32)
FPIC=-fpic
AC_SUBST(FPIC)
AC_SUBST(WIN32)
;;
*)
AC_MSG_RESULT(unknown)
AC_MSG_ERROR(Non-supported target OS!)
;;
esac
AC_ARG_ENABLE(sendfile, AS_HELP_STRING([--disable-sendfile], [disables use of sendfile system call]),
[ test "$enableval" = no && HAVE_SENDFILE=false ])
AC_SUBST(HAVE_SENDFILE)
YTOP=`pwd`
AC_SUBST(YTOP)
AC_OUTPUT(include.mk)
AC_OUTPUT(test/support/include.mk)
AC_OUTPUT(test/support/include.sh)
dnl pkg-config support
. ./vsn.mk
AC_SUBST(YAWS_VSN)
AC_OUTPUT(yaws.pc)