summaryrefslogtreecommitdiff
path: root/configure.ac
blob: d98caaf402f50cdc93c652b3431ce81fa4e6eb76 (plain)
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
271
272
273
AC_PREREQ(2.61)
AC_INIT([libproxy],[0.3.1],[nathaniel@natemccallum.com])
AC_CONFIG_SRCDIR([src/lib/proxy.c])
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

### Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_CC_C_O
AM_PATH_PYTHON

### Check for pthread
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_FUNCS(pthread_mutex_init)

### Check for socket functions (opensolaris requires -lsocket for example)
AC_SEARCH_LIBS([socket],[socket inet])
AC_SEARCH_LIBS([dlopen],[dl])

### Checks for module dependencies.
AC_PATH_PROG(GCONFTOOLBIN, gconftool-2)
PKG_CHECK_MODULES(x11, x11, have_x11=yes, have_x11=no)
PKG_CHECK_MODULES(xmu, xmu, have_xmu=yes, have_xmu=no)
PKG_CHECK_MODULES(webkit, webkit-1.0, have_webkit=yes, have_webkit=no)
PKG_CHECK_MODULES(mozjs, xulrunner-js, have_mozjs=yes, 
		[PKG_CHECK_MODULES(mozjs, firefox-js, have_mozjs=yes,
		[PKG_CHECK_MODULES(mozjs, mozilla-js, have_mozjs=yes, 
		[PKG_CHECK_MODULES(mozjs, seamonkey-js, have_mozjs=yes,have_mozjs=no)])])])
PKG_CHECK_MODULES(NetworkManager, NetworkManager dbus-1, 
					have_networkmanager=yes, have_networkmanager=no)
PKG_CHECK_MODULES(QtCore, QtCore, have_qtcore=yes, have_qtcore=no)

# Direct
AC_ARG_WITH([direct],
            [AS_HELP_STRING([--with-direct],
            [build direct configuration module @<:@default=yes@:>@])],
            [], [with_direct=yes])
AM_CONDITIONAL([WITH_DIRECT], [test x$with_direct = xyes])

# Environmental Variable
AC_ARG_WITH([envvar],
            [AS_HELP_STRING([--with-envvar],
            [build environmental variable configuration module @<:@default=yes@:>@])],
            [], [with_envvar=yes])
AM_CONDITIONAL([WITH_ENVVAR], [test x$with_envvar = xyes])

# File
AC_ARG_WITH([file],
            [AS_HELP_STRING([--with-file],
            [build file-based configuration module @<:@default=yes@:>@])],
            [], [with_file=yes])
AM_CONDITIONAL([WITH_FILE], [test x$with_envvar = xyes])
            
# GNOME
AC_ARG_WITH([gnome],
            [AS_HELP_STRING([--with-gnome],
            [build GNOME configuration module @<:@automatic@:>@])],
            [],
            [test x$have_x11   = xyes &&
             test x$have_xmu   = xyes &&
             with_gnome=yes])
if test x$with_gnome = xyes; then
	if test x$GCONFTOOLBIN != x && \
           test x$have_x11 = xyes && \
	   test x$have_xmu = xyes; then
		GNOME_CFLAGS="$x11_CFLAGS $xmu_CFLAGS"
		GNOME_LIBS="$x11_LIBS $xmu_LIBS"
		AC_SUBST(GCONFTOOLBIN)
		AC_SUBST(GNOME_CFLAGS)
		AC_SUBST(GNOME_LIBS)
	else
		echo "GNOME module requires: x11, xmu and gconftool-2!"
		exit 1
	fi
else
	with_gnome=no
fi
AM_CONDITIONAL([WITH_GNOME], [test x$with_gnome = xyes])

# KDE
AC_ARG_WITH([kde4],
            [AS_HELP_STRING([--with-kde4],
            [build KDE4 configuration module @<:@automatic@:>@])],
            [],
            [test x$have_qtcore = xyes &&
             test x$have_xmu    = xyes &&
             with_kde4=yes])
if test x$with_kde4 = xyes; then
	if test x$have_qtcore = xyes && \
	   test x$have_xmu = xyes; then
		KDE4_CFLAGS="$QtCore_CFLAGS"
		KDE4_LIBS="$QtCore_LIBS"
		AC_SUBST(KDE4_CFLAGS)
		AC_SUBST(KDE4_LIBS)
	else
		echo "KDE4 module requires: QtCore and libkdecore"
		exit 1
	fi
else
	with_kde=no
fi
AM_CONDITIONAL([WITH_KDE4], [test x$with_kde4 = xyes])

# WPAD
AC_ARG_WITH([wpad],
            [AS_HELP_STRING([--with-wpad],
            [build WPAD configuration module @<:@default=yes@:>@])],
            [], [with_wpad=yes])
AM_CONDITIONAL([WITH_WPAD], [test x$with_wpad = xyes])

# NetworkManager
AC_ARG_WITH([networkmanager],
            [AS_HELP_STRING([--with-networkmanager],
            [build NetworkManager module @<:@automatic@:>@])],
            [],
            [test x$have_networkmanager = xyes && with_networkmanager=yes])
if test x$with_networkmanager = xyes; then
	if test x$have_networkmanager = xyes; then
		NETWORKMANAGER_CFLAGS="$NetworkManager_CFLAGS"
		NETWORKMANAGER_LIBS="$NetworkManager_LIBS"
		AC_SUBST(NETWORKMANAGER_CFLAGS)
		AC_SUBST(NETWORKMANAGER_LIBS)
	else
		echo "NetworkManager module requires: NetworkManager!"
		exit 1
	fi
else
	with_networkmanager=no
fi
AM_CONDITIONAL([WITH_NETWORKMANAGER], [test x$with_networkmanager = xyes])

# Mozilla Javascript
AC_ARG_WITH([mozjs],
            [AS_HELP_STRING([--with-mozjs],
            [build Mozilla JavaScript PAC runner module @<:@automatic@:>@])],
            [],
            [test x$have_mozjs = xyes && with_mozjs=yes])
if test x$with_mozjs = xyes; then
	if test x$have_mozjs = xyes; then
		MOZJS_CFLAGS="$mozjs_CFLAGS"
		MOZJS_LIBS="$mozjs_LIBS"
		AC_SUBST(MOZJS_CFLAGS)
		AC_SUBST(MOZJS_LIBS)
	else
		echo "Mozilla JavaScript module requires: mozjs!"
		exit 1
	fi
else
	with_mozjs=no
fi
AM_CONDITIONAL([WITH_MOZJS], [test x$with_mozjs = xyes])

# WebKit Javascript
AC_ARG_WITH([webkit],
            [AS_HELP_STRING([--with-webkit],
            [build WebKit JavaScriptCore PAC runner module @<:@automatic@:>@])],
            [],
            [test x$have_webkit = xyes && with_webkit=yes])
if test x$with_webkit = xyes; then
	if test x$have_webkit = xyes; then
		WEBKIT_CFLAGS="$webkit_CFLAGS"
		WEBKIT_LIBS="$webkit_LIBS"
		AC_SUBST(WEBKIT_CFLAGS)
		AC_SUBST(WEBKIT_LIBS)
	else
		echo "WebKit JavaScriptCore module requires: WebKit!"
		exit 1
	fi
else
	with_webkit=no
fi
AM_CONDITIONAL([WITH_WEBKIT], [test x$with_webkit = xyes])

### Check for binding requirements
# Python
AC_ARG_WITH([python],
            [AS_HELP_STRING([--with-python],
            [build Python bindings @<:@automatic@:>@])],
            [AM_PATH_PYTHON([2.5], have_python=yes, have_python=no)],
            [have_python=yes && with_python=yes])
AM_CONDITIONAL([WITH_PYTHON], [test x$with_python = xyes])

# Java
with_java=no
AM_CONDITIONAL([WITH_JAVA], [test x$with_java = xyes])

# .NET
AC_ARG_WITH([dotnet],
            [AS_HELP_STRING([--with-dotnet],
            [build .NET/Mono bindings @<:@automatic@:>@])],
            [PKG_CHECK_MODULES(MONO,mono >= 2.0.0, have_dotnet=yes, have_dotnet=no)],
            [test x$have_dotnet = xyes && with_dotnet=yes])
if test x$with_dotnet = xyes; then
    if test x$have_dotnet = xyes; then
	    AC_PATH_PROG(MCS, gmcs)
        AC_PATH_PROG(GACUTIL, gacutil)
        ASSEMBLY_NAME="$PACKAGE-sharp"
        ASSEMBLY_VERSION="$VERSION"
        DOTNET_CFLAGS="$dotnet_CFLAGS"
        DOTNET_LIBS="$dotnet_LIBS"
        AC_SUBST(DOTNET_CFLAGS)
        AC_SUBST(DOTNET_LIBS)
        AC_SUBST(ASSEMBLY_NAME)
        AC_SUBST(ASSEMBLY_VERSION)
    else
        echo ".Net / Mono mindings requires: mono!"
        exit 1
    fi
else
	with_dotnet=no
fi
AM_CONDITIONAL([WITH_DOTNET], [test x$with_dotnet = xyes])

### Checks for header files.
AC_HEADER_STDC
#AC_CHECK_HEADERS([netdb.h stdlib.h string.h sys/socket.h unistd.h])

### Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T
MODULEDIR=$libdir/$PACKAGE_NAME/$PACKAGE_VERSION/modules
AC_SUBST(MODULEDIR)
AC_SUBST(SYSCONFDIR)
AC_SUBST(DIR_SEPARATOR)

### Checks for library functions.
#AC_FUNC_MALLOC
#AC_CHECK_FUNCS([gethostbyname gethostname memset socket strdup strstr])

### OS Specific checks
AM_CONDITIONAL([MINGW32], [test "x$host_os" = xmingw32])
case $host in
  *-*-mingw*)
     AC_CHECK_LIB(ws2_32, main)
esac

CFLAGS="-g -Wall -pedantic $CFLAGS"
AC_CONFIG_FILES([libproxy-1.0.pc Makefile libproxy.spec src/Makefile src/lib/Makefile
                 src/modules/Makefile src/bin/Makefile src/bindings/Makefile
                 src/bindings/python/Makefile src/bindings/java/Makefile
                 src/platform/Makefile src/platform/win32/Makefile
                 src/bindings/dotnet/Makefile src/bindings/dotnet/libproxy-sharp-1.0.pc
                 src/bindings/dotnet/AssemblyInfo.cs])
AC_OUTPUT

### Print build summary
echo
echo "------------------------------------------------------"
echo -e "\tModules to build..."
echo -e "\t\tdirect          : $with_direct"
echo -e "\t\tenvvar          : $with_envvar"
echo -e "\t\tfile            : $with_file"
echo -e "\t\tgnome           : $with_gnome"
echo -e "\t\tkde4            : $with_kde4"
echo -e "\t\twpad            : $with_wpad"
echo -e "\t\tnetworkmanager  : $with_networkmanager"
echo -e "\t\tmozjs           : $with_mozjs"
echo -e "\t\twebkit          : $with_webkit"
echo
echo -e "\tBindings to build..."
echo -e "\t\tpython          : $with_python"
echo -e "\t\tjava            : $with_java"
echo -e "\t\tdotnet          : $with_dotnet"
echo "------------------------------------------------------"
echo