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
|
AC_PREREQ(2.61)
AC_INIT([libproxy],[0.3],[nathaniel@natemccallum.com])
AC_CONFIG_SRCDIR([src/lib/proxy_factory.c])
AM_INIT_AUTOMAKE
### Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_LN_S
AC_PROG_MAKE_SET
### Checks for libraries for plugins.
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(gconf, gconf-2.0, have_gconf=yes, have_gconf=no)
PKG_CHECK_MODULES(mozjs, xulrunner-js, have_mozjs=yes,
[PKG_CHECK_MODULES(mozjs, firefox-js, have_mozjs=yes, have_mozjs=no)])
PKG_CHECK_MODULES(NetworkManager, NetworkManager,
have_networkmanager=yes, have_networkmanager=no)
# Environmental Variable
AC_ARG_WITH([envvar],
[AS_HELP_STRING([--with-envvar],
[build environmental variable configuration plugin @<:@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 plugin @<:@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 plugin @<:@automatic@:>@])],
[],
[test x$have_gconf == xyes &&
test x$have_x11 == xyes &&
test x$have_xmu == xyes &&
with_gnome=yes])
if test x$with_gnome = xyes; then
if test x$have_gconf == xyes && \
test x$have_x11 == xyes && \
test x$have_xmu == xyes; then
GNOME_CFLAGS="$x11_CFLAGS $xmu_CFLAGS $gconf_CFLAGS"
GNOME_LIBS="$x11_LIBS $xmu_LIBS $gconf_LIBS"
AC_SUBST(GNOME_CFLAGS)
AC_SUBST(GNOME_LIBS)
else
echo "GNOME plugin requires: x11, xmu and gconf!"
exit 1
fi
else
with_gnome=no
fi
AM_CONDITIONAL([WITH_GNOME], [test x$with_gnome = xyes])
# KDE
AC_ARG_WITH([kde],
[AS_HELP_STRING([--with-kde],
[build KDE configuration plugin @<:@automatic@:>@])],
[],
[test x$have_x11 == xyes &&
test x$have_xmu == xyes &&
with_kde=yes])
if test x$with_kde = xyes; then
if test x$have_x11 == xyes && \
test x$have_xmu == xyes; then
KDE_CFLAGS="$x11_CFLAGS $xmu_CFLAGS"
KDE_LIBS="$x11_LIBS $xmu_LIBS"
AC_SUBST(KDE_CFLAGS)
AC_SUBST(KDE_LIBS)
else
echo "KDE plugin requires: x11 and xmu!"
exit 1
fi
else
with_kde=no
fi
AM_CONDITIONAL([WITH_KDE], [test x$with_kde = xyes])
# Mozilla Javascript
AC_ARG_WITH([mozjs],
[AS_HELP_STRING([--with-mozjs],
[build Mozilla JavaScript PAC runner plugin @<:@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 plugin requires: mozjs!"
exit 1
fi
else
with_mozjs=no
fi
AM_CONDITIONAL([WITH_MOZJS], [test x$with_mozjs = xyes])
# NetworkManager
AC_ARG_WITH([networkmanager],
[AS_HELP_STRING([--with-networkmanager],
[build NetworkManager plugin @<:@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 plugin requires: NetworkManager!"
exit 1
fi
else
with_networkmanager=no
fi
AM_CONDITIONAL([WITH_NETWORKMANAGER], [test x$with_networkmanager = xyes])
### Check for binding requirements
# Python
AC_ARG_WITH([python],
[AS_HELP_STRING([--with-python],
[build Python bindings @<:@automatic@:>@])],
[AM_PATH_PYTHON([2.5], with_python=yes)],
[AM_PATH_PYTHON([2.5], with_python=yes, with_python=no)])
AM_CONDITIONAL([WITH_PYTHON], [test x$with_python = xyes])
# Java
with_java=no
AM_CONDITIONAL([WITH_JAVA], [test x$with_java = xyes])
# .NET
with_dotnet=no
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
PLUGINDIR=$libdir/$PACKAGE_NAME/$PACKAGE_VERSION/plugins
AC_SUBST(PLUGINDIR)
CFLAGS="-std=c99 $CFLAGS -DPLUGINDIR=\\\"$PLUGINDIR\\\" -DSYSCONFDIR=\\\"$sysconfdir\\\" -D_POSIX_C_SOURCE=1"
### Checks for library functions.
AC_FUNC_MALLOC
#AC_CHECK_FUNCS([gethostbyname gethostname memset socket strdup strstr])
AC_CONFIG_FILES([Makefile src/Makefile src/lib/Makefile src/plugins/Makefile
src/bin/Makefile src/bindings/Makefile src/bindings/python/Makefile
src/bindings/java/Makefile src/bindings/dotnet/Makefile])
AC_OUTPUT
### Print build summary
echo
echo "------------------------------------------------------"
echo -e "\tPlugins to build..."
echo -e "\t\tenvvar : $with_envvar"
echo -e "\t\tfile : $with_file"
echo -e "\t\tgnome : $with_gnome"
echo -e "\t\tkde : $with_kde"
echo -e "\t\tmozjs : $with_mozjs"
echo -e "\t\tnetworkmanager : $with_networkmanager"
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
|