1
2AC_INIT(gtk-sharp, 2.99.3)
3
4AM_INIT_AUTOMAKE([1.10 no-dist-gzip dist-bzip2 tar-ustar foreign])
5AC_CANONICAL_HOST
6AC_CONFIG_HEADERS(config.h)
7AM_MAINTAINER_MODE
8AC_CONFIG_MACRO_DIR([m4])
9
10API_VERSION=3.0.0.0
11AC_SUBST(API_VERSION)
12CAIRO_API_VERSION=1.10.0.0
13AC_SUBST(CAIRO_API_VERSION)
14POLICY_VERSIONS=""
15AC_SUBST(POLICY_VERSIONS)
16
17PACKAGE_VERSION=gtk-sharp-3.0
18AC_SUBST(PACKAGE_VERSION)
19
20WIN64DEFINES=
21
22AC_MSG_CHECKING([whether we're on Windows])
23
24case "$host" in
25	x86_64-*-mingw*|x86_64-*-cygwin*)
26		WIN64DEFINES="-define:WIN64LONGS"
27		platform_win32=yes
28		AC_MSG_RESULT([yes, 64-bit])
29		AC_DEFINE(PLATFORM_WIN32,1,[Platform is Win32])
30		if test "x$cross_compiling" = "xno"; then
31			CC="gcc -g"
32			HOST_CC="gcc"
33		fi
34		;;
35	*-*-mingw*|*-*-cygwin*)
36		platform_win32=yes
37		AC_MSG_RESULT([yes, 32-bit])
38		AC_DEFINE(PLATFORM_WIN32,1,[Platform is Win32])
39		if test "x$cross_compiling" = "xno"; then
40			CC="gcc -g"
41			HOST_CC="gcc"
42		fi
43		;;
44	*)
45		platform_win32=no
46		AC_MSG_RESULT([no])
47		;;
48esac
49
50AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
51
52AC_CHECK_TOOL(CC, gcc, gcc)
53AC_PROG_CC
54AC_PROG_INSTALL
55
56dnl may require a specific autoconf version
57dnl AC_PROG_CC_FOR_BUILD
58dnl CC_FOR_BUILD not automatically detected
59CC_FOR_BUILD=$CC
60BUILD_EXEEXT=
61if test "x$cross_compiling" = "xyes"; then
62	CC_FOR_BUILD=cc
63	BUILD_EXEEXT=""
64fi
65AC_SUBST(CC_FOR_BUILD)
66AC_SUBST(HOST_CC)
67AC_SUBST(BUILD_EXEEXT)
68
69# Set STDC_HEADERS
70AC_HEADER_STDC
71AC_LIBTOOL_WIN32_DLL
72AM_PROG_LIBTOOL
73
74# not 64 bit clean in cross-compile
75AC_CHECK_SIZEOF(void *, 4)
76
77CFLAGS="${CFLAGS} -g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs  -Wshadow -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings"
78
79if test "x$enable_maintainer_mode" = "xyes"; then
80DEBUG_FLAGS='-debug'
81RUNTIME_DEBUG_FLAGS=' --debug'
82else
83DEBUG_FLAGS=
84RUNTIME_DEBUG_FLAGS=
85AC_ARG_ENABLE(debug, [  --enable-debug          Build debugger (.mdb) files for dlls],
86	DEBUG_FLAGS='-debug'
87)
88fi
89
90enable_msi="no"
91if test "x$platform_win32" = "xyes"; then
92	AC_PATH_PROG(WIX, candle, no)
93	if test "x$WIX" != "xno" ; then
94		enable_msi="yes"
95	fi
96fi
97
98AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
99if test "x$PKG_CONFIG" = "xno"; then
100	AC_MSG_ERROR([You need to install pkg-config])
101fi
102
103AC_CHECK_SIZEOF(off_t)
104OFF_T_FLAGS="-define:OFF_T_$ac_cv_sizeof_off_t"
105AC_SUBST(OFF_T_FLAGS)
106
107MONO_REQUIRED_VERSION=2.8
108PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)
109
110AC_PATH_PROG(GACUTIL, gacutil, no)
111if test "x$GACUTIL" = "xno" ; then
112	AC_MSG_ERROR([No gacutil tool found. You need to install either the mono or .Net SDK.])
113fi
114
115AC_PATH_PROG(AL, al, no)
116if test "x$AL" = "xno" ; then
117	AC_MSG_ERROR([No al tool found. You need to install either the mono or .Net SDK.])
118fi
119
120if test "x$has_mono" = "xtrue"; then
121GACUTIL_FLAGS='/package $(PACKAGE_VERSION) /gacdir $(DESTDIR)$(prefix)/lib'
122GENERATED_SOURCES_FILES=generated/*/*.cs
123GENERATED_SOURCES_OPTION=$GENERATED_SOURCES_FILES
124ASSEMBLYINFO=/AssemblyInfo.cs
125AC_PATH_PROG(RUNTIME, mono, no)
126
127# libmono and glib required for gui-thread-check profiler module
128PKG_CHECK_MODULES(PROFILER, mono-2 glib-2.0)
129AM_CONDITIONAL(ENABLE_THREADCHECK, true)
130
131# If mono is found, it's in the path.  Require it to be in the path at runtime as well
132if test "x$RUNTIME" != "no" ; then
133	RUNTIME="mono$RUNTIME_DEBUG_FLAGS"
134fi
135
136AC_PATH_PROG(CSC, gmcs, no)
137if test `uname -s` = "Darwin"; then
138	LIB_PREFIX=
139	LIB_SUFFIX=.dylib
140else
141	LIB_PREFIX=.so
142	LIB_SUFFIX=
143fi
144SDCHECK="`$GACUTIL /l |grep ^System.Drawing, | head -n1 |cut -f1 -d','`"
145if test "x$SDCHECK" = "xSystem.Drawing"; then
146	enable_dotnet=yes
147else
148	enable_dotnet=no
149fi
150dnl End of has_mono = true
151else
152dnl Check for .NET Framework
153AC_PATH_PROG(CSC, csc.exe, no)
154CSFLAGS="-nologo -platform:x86"
155GACUTIL_FLAGS=
156GENERATED_SOURCES_FILES="generated\\\\*.cs"
157GENERATED_SOURCES_OPTION="-recurse:$GENERATED_SOURCES_FILES"
158ASSEMBLYINFO=\\\\AssemblyInfo.cs
159AM_CONDITIONAL(ENABLE_THREADCHECK, false)
160enable_dotnet=yes
161
162RUNTIME=
163LIB_PREFIX=
164LIB_SUFFIX=.dylib
165fi
166
167CS="C#"
168if test "x$CSC" = "xno" ; then
169	AC_MSG_ERROR([No $CS compiler found. You need to install either mono (>=$MONO_REQUIRED_VERSION) or .Net])
170fi
171
172AC_SUBST(RUNTIME)
173AC_SUBST(CSC)
174AC_SUBST(GACUTIL)
175AC_SUBST(GACUTIL_FLAGS)
176AC_SUBST(LIB_PREFIX)
177AC_SUBST(LIB_SUFFIX)
178AC_SUBST(GENERATED_SOURCES_FILES)
179AC_SUBST(GENERATED_SOURCES_OPTION)
180AC_SUBST(ASSEMBLYINFO)
181
182GTK_REQUIRED_VERSION=3.0.0
183GLIB_REQUIRED_VERSION=2.28.0
184
185PKG_CHECK_MODULES(GLIB, gobject-2.0 >= $GLIB_REQUIRED_VERSION)
186AC_SUBST(GLIB_CFLAGS)
187AC_SUBST(GLIB_LIBS)
188
189PKG_CHECK_MODULES(GIO, gio-2.0 >= $GLIB_REQUIRED_VERSION)
190AC_SUBST(GIO_CFLAGS)
191AC_SUBST(GIO_LIBS)
192
193CSFLAGS="$CSFLAGS $DEBUG_FLAGS $WIN64DEFINES"
194AC_SUBST(CSFLAGS)
195
196PKG_CHECK_MODULES(GLIB_2_31,
197	glib-2.0 >= 2.31,
198	HAVE_GLIB_2_31_OR_HIGHER=yes, HAVE_GLIB_2_31_OR_HIGHER=no)
199if test "x$HAVE_GLIB_2_31_OR_HIGHER" = "xno" ; then
200	CSFLAGS="$CSFLAGS -define:ENABLE_GTHREAD_INIT"
201fi
202
203PKG_CHECK_MODULES(PANGO, pango)
204AC_SUBST(PANGO_CFLAGS)
205AC_SUBST(PANGO_LIBS)
206
207PKG_CHECK_MODULES(ATK, atk)
208AC_SUBST(ATK_CFLAGS)
209AC_SUBST(ATK_LIBS)
210
211PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED_VERSION)
212AC_SUBST(GTK_CFLAGS)
213AC_SUBST(GTK_LIBS)
214
215AC_PATH_PROG(MDOC, mdoc, no)
216if test "x$MDOC" = "xno"; then
217  enable_monodoc=no
218  doc_sources_dir=
219else
220  enable_monodoc=yes
221  doc_sources_dir="`pkg-config --variable=sourcesdir monodoc`"
222fi
223AC_SUBST(MDOC)
224
225AM_CONDITIONAL(ENABLE_DOTNET, test "x$enable_dotnet" = "xyes")
226AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_monodoc" = "xyes")
227AM_CONDITIONAL(ENABLE_MSI, test "x$enable_msi" = "xyes")
228
229AC_SUBST(CFLAGS)
230
231AC_OUTPUT([
232AssemblyInfo.cs
233Makefile
234policy.config
235sources/Makefile
236parser/Makefile
237parser/gapi-3.0.pc
238parser/gapi3-parser
239generator/Makefile
240generator/gapi3-codegen
241generator/gapi3-fixup
242glib/Makefile
243glib/glib-sharp-3.0.pc
244glib/glib-sharp.dll.config
245gio/Makefile
246gio/gio-sharp-3.0.pc
247gio/gio-sharp.dll.config
248gio/glue/Makefile
249cairo/AssemblyInfo.cs
250cairo/Makefile
251pango/Makefile
252pango/pango-sharp.dll.config
253pango/glue/Makefile
254atk/Makefile
255atk/atk-sharp.dll.config
256atk/glue/Makefile
257gdk/Makefile
258gdk/gdk-sharp-3.0.pc
259gdk/gdk-sharp.dll.config
260gtk/Makefile
261gtk/gtk-sharp-3.0.pc
262gtk/gtk-sharp.dll.config
263gtk/glue/Makefile
264gtk/gui-thread-check/Makefile
265gtk/gui-thread-check/profiler/Makefile
266gtkdotnet/Makefile
267gtkdotnet/gtk-dotnet.dll.config
268gtkdotnet/gtk-dotnet-3.0.pc
269doc/Makefile
270msi/gtk-sharp-3.0.wxs
271msi/Makefile
272msi/unmanaged/Makefile
273sample/GtkDemo/Makefile
274sample/Makefile
275sample/pixmaps/Makefile
276sample/test/Makefile
277sample/valtest/Makefile
278sample/valtest/valtest.exe.config
279sample/opaquetest/Makefile
280sample/opaquetest/opaquetest.exe.config
281sample/gio/Makefile
282sample/gtk-gio/Makefile
283])
284
285if test x$platform_win32 = xyes; then
286   # Get rid of 'cyg' prefixes in library names
287   sed -e "s/\/cyg\//\/\//" libtool > libtool.new; mv libtool.new libtool; chmod 755 libtool
288fi
289
290if test "x$enable_mono_cairo" = "xyes"; then
291  cairo_comment="building local copy"
292else
293  cairo_comment="using system assembly"
294fi
295
296echo "---"
297echo "Configuration summary"
298echo ""
299echo "   * Installation prefix = $prefix"
300echo "   * $CS compiler: $CSC $CSFLAGS"
301echo ""
302echo "   Optional assemblies included in the build:"
303echo ""
304echo "      * gtk-dotnet.dll: $enable_dotnet"
305echo ""
306echo "      NOTE: if any of the above say 'no' you may install the"
307echo "            corresponding development packages for them, rerun"
308echo "            autogen.sh to include them in the build."
309echo ""
310echo "   * Documentation build enabled: $enable_monodoc "
311if test "x$enable_monodoc" = "xyes" -a "x$doc_sources_dir" != "x$prefix/lib/monodoc/sources"; then
312  echo "      WARNING: The install prefix is different than the monodoc prefix."
313  echo "               Monodoc will not be able to load the documentation."
314fi
315echo "---"
316
317if test "x$has_mono" = "xtrue"; then
318	mono_prefix=`pkg-config --variable=prefix mono`
319	mono_prefix_canonical=`readlink -m $mono_prefix`
320	if test "x$mono_prefix_canonical" != "x$prefix"; then
321		AC_MSG_WARN(Prefix to use ($prefix) is not the same as Mono's ($mono_prefix_canonical).
322			Consider using ./configure --prefix=$mono_prefix_canonical
323			See the README for more information.
324		)
325	fi
326fi
327