File: configure.in

package info (click to toggle)
yaws 1.65-4etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,164 kB
  • ctags: 3,907
  • sloc: erlang: 20,138; sh: 3,675; makefile: 556; ansic: 404; lisp: 79
file content (228 lines) | stat: -rw-r--r-- 4,376 bytes parent folder | download | duplicates (2)
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
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,
[  --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,
[  --with-extrainclude= 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, [--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)

AC_PROG_CC
AC_PROG_GCC_TRADITIONAL


dnl ===============================================================
dnl Checks for programs.
dnl ===============================================================



dnl
dnl cygwin code here is broken and not used ....
dnl


case "$target_os" in
     *cygwin*)
        WIN32=win32
	    cat >> confdefs.h <<\EOF
#define WIN32 1
EOF
	    LD_SHARED="gcc -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 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 to 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"

case "$target_os" in
	*linux*)
	   AC_DEFINE(LINUX)
	   LD_SHARED="ld -shared"
	   AC_SUBST(LD_SHARED)
	   FPIC=-fpic
	   AC_SUBST(FPIC)
	   ;;

	*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
		bsdi*)
                    BSDI=bsdi
		    AC_DEFINE(BSDI)
		    AC_SUBST(BSDI)
		    ;;
	   esac
	   LD_SHARED="ld -Bshareable"	  
	   AC_SUBST(LD_SHARED)
	   FPIC=-fpic
	   AC_SUBST(FPIC)
	   ;;
	 *darwin*)
	   CFLAGS="$CFLAGS -I/usr/include/pam"
	   LD_SHARED="gcc -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_OUTPUT(include.mk)