summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 0b342d1d518d7f526699dcd937bd62a73a69ec42 (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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
m4_define([version_major],0)
m4_define([version_minor],43)
m4_define([version_micro],0)
m4_define([version_triplet],version_major.version_minor.version_micro)

AC_PREREQ([2.63])
AC_INIT([vte],
        [version_triplet],
        [http://bugzilla.gnome.org/enter_bug.cgi?product=vte],
        [vte])

AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/vteapp.c])
AC_CONFIG_HEADERS([config.h])

AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-bzip2 -Wno-portability])

m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

if test -z "$enable_maintainer_mode"; then
  enable_maintainer_mode=yes
fi
AM_MAINTAINER_MODE([enable])

################################################################################
# Libtool versioning
################################################################################
m4_define([lt_revision], m4_if(m4_eval(version_minor%2),1,0,version_micro))
m4_define([lt_age], m4_eval(version_minor*100+version_micro-lt_revision))
m4_define([lt_current], m4_eval(version_major+lt_age))
m4_define([lt_triplet],lt_current:lt_revision:lt_age)

LT_VERSION_INFO="lt_triplet()"
AC_SUBST([LT_VERSION_INFO])

################################################################################
# GTK+
################################################################################

VTE_API_MAJOR_VERSION=2
VTE_API_MINOR_VERSION=91
VTE_API_VERSION=$VTE_API_MAJOR_VERSION.$VTE_API_MINOR_VERSION
GTK_API_VERSION=3.0
GTK_REQUIRED=3.8.0
GLADE_API_VERSION=2.0

AC_SUBST([VTE_API_VERSION])
AC_SUBST([VTE_API_VERSION_U],[AS_TR_SH([$VTE_API_VERSION])])
AC_SUBST([VTE_API_MAJOR_VERSION])
AC_SUBST([VTE_API_MINOR_VERSION])
AC_SUBST([GTK_API_VERSION])

################################################################################

# Check for programs
AC_PROG_CC
AC_PROG_CXX
AC_USE_SYSTEM_EXTENSIONS
AC_HEADER_STDC
AM_PROG_CC_C_O
AC_PROG_SED

PKG_PROG_PKG_CONFIG

# Initialize libtool
LT_PREREQ([2.2])
LT_INIT

AM_CONDITIONAL([HAVE_GCC],[test "$GCC" = "yes"])
AM_CONDITIONAL([HAVE_GXX],[test "$GXX" = "yes"])

################################################################################
# Enable debugging messages and additional run-time checks.
################################################################################

AC_ARG_ENABLE([debug],
              [AS_HELP_STRING([--enable-debug],
                              [enable extra debugging checks and logging messages])],
              [],[enable_debug=no])
if test "x$enable_debug" = "xyes" ; then
        AC_MSG_RESULT([enabling debug checks and messages])
        AC_DEFINE(VTE_DEBUG,1,[Enable debugging messages.])
fi

################################################################################
# i18n
################################################################################

IT_PROG_INTLTOOL([0.35.0])

GETTEXT_PACKAGE=vte-$VTE_API_VERSION
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
                   [Package translatable messages domain name.])
AM_GLIB_GNU_GETTEXT
AC_CHECK_DECLS(bind_textdomain_codeset,,,[#include "libintl.h"])

################################################################################
# Compilation
################################################################################

m4_define([compiler_flags_common],[ dnl
  -pipe dnl
  -Waggregate-return dnl
  -Wall dnl
  -Wcast-align dnl
  -Wendif-labels dnl
  -Werror=declaration-after-statement dnl
  "-Werror=format=2 -Werror=format-nonliteral -Werror=format-security" dnl
  -Werror=implicit-function-declaration dnl
  -Werror=init-self dnl
  -Werror=missing-include-dirs dnl
  -Werror=missing-prototypes dnl
  -Werror=pointer-arith dnl
  -Wextra dnl
  -Wfloat-equal dnl
  -Wlogical-op dnl
  -Wmissing-declarations dnl
  -Wmissing-include-dirs dnl
  -Wmissing-format-attribute dnl
  -Wmissing-noreturn dnl
  -Wno-missing-field-initializers dnl
  -Wno-switch-enum dnl
  -Wno-unused-parameter dnl
  -Wno-packed dnl
  -Wshadow dnl
  -Wsign-compare dnl
  -Wstrict-aliasing=2 dnl
  -Wundef dnl
  -Wuninitialized dnl
  -Wunsafe-loop-optimizations dnl
  -Wwrite-strings dnl
  -fno-common dnl
  -fdiagnostics-show-option dnl
  -fno-strict-aliasing dnl
  -fstack-protector dnl
  -fstack-protector-strong dnl
  -fno-semantic-interposition dnl
  -Wno-deprecated-declarations dnl
])

m4_define([compiler_flags_only_c],[ dnl
  -Wimplicit dnl
  -Wnested-externs dnl
  -Wold-style-definition dnl
  -Wstrict-prototypes dnl
])

m4_define([compiler_flags_only_cxx],[ dnl
  -fno-rtti dnl
  -fno-exceptions dnl
])

CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[compiler_flags_common compiler_flags_only_c])

AC_LANG_PUSH([C++])
CC_CHECK_FLAGS_APPEND([AM_CXXFLAGS],[CXXFLAGS],[compiler_flags_common compiler_flags_only_cxx])
AC_LANG_POP([C++])

##########################################################
# Check for -Bsymbolic-functions linker flag used to avoid
# intra-library PLT jumps, if available.
##########################################################

AC_ARG_ENABLE([Bsymbolic],
  [AS_HELP_STRING([--disable-Bsymbolic],
                  [disable linking with -Bsymbolic])],
  [],[enable_Bsymbolic=yes])

VTE_LDFLAGS=
if test "$enable_Bsymbolic" != "no"; then
  CC_CHECK_LDFLAGS(["-Wl,-Bsymbolic-functions"],
    [VTE_LDFLAGS="$VTE_CXXLDFLAGS -Wl,-Bsymbolic-functions"],
    [if test "$enable_Bsymbolic" = "auto"; then
       AC_MSG_WARN([-Bsymbolic not supported by ld; disabling])
       enable_Bsymbolic=no
     else
       AC_MSG_ERROR([-Bsymbolic requested but not supported by ld. Use --disable-Bsymbolic to disable])
     fi])

  AC_LANG_PUSH([C++])
  CC_CHECK_LDFLAGS(["-Wl,-Bsymbolic-functions"],
    [VTE_LDFLAGS="$VTE_CXXLDFLAGS -Wl,-Bsymbolic-functions"],
    [if test "$enable_Bsymbolic" = "auto"; then
       AC_MSG_WARN([-Bsymbolic not supported by ld; disabling])
       enable_Bsymbolic=no
     else
       AC_MSG_ERROR([-Bsymbolic requested but not supported by ld. Use --disable-Bsymbolic to disable])
     fi])
  AC_LANG_POP([C++])
fi

AC_SUBST([VTE_LDFLAGS])
AC_SUBST([VTE_CXXLDFLAGS])

################################################################################
# Core
################################################################################

GLIB_REQUIRED=2.40.0
GIO_REQUIRED=2.40.0
PANGO_REQUIRED=1.22.0
GNUTLS_REQUIRED=3.2.7
PCRE2_REQUIRED=10.00

# GNUTLS

AC_MSG_CHECKING([whether gnutls support is requested])
AC_ARG_WITH([gnutls],
  [AS_HELP_STRING([--without-gnutls],[Disable gnutls support])],
  [],[with_gnutls=yes])
AC_MSG_RESULT([$with_gnutls])

GNUTLS_PKGS=
if test "$with_gnutls" = "yes"; then
  GNUTLS_PKGS="gnutls >= $GNUTLS_REQUIRED"

  AC_DEFINE([WITH_GNUTLS],[1],[Define to 1 to enable gnutls support])
fi

AM_CONDITIONAL([WITH_GNUTLS],[test "$with_gnutls" = "yes"])

# PCRE2

AC_MSG_CHECKING([whether PCRE2 support is requested])
AC_ARG_WITH([pcre2],
  [AS_HELP_STRING([--without-pcre2],[Disable pcre2 support])],
  [],[with_pcre2=yes])
AC_MSG_RESULT([$with_pcre2])

PCRE2_PKGS=
if test "$with_pcre2" = "yes"; then
  PCRE2_PKGS="libpcre2-8 >= $PCRE2_REQUIRED"

  PKG_CHECK_MODULES([PCRE2],[$PCRE2_PKGS],,
    [AC_MSG_ERROR([PCRE2 requested but libpcre2-8 not found. Use --without-pcre2 to disable PCRE2])])

  AC_DEFINE([WITH_PCRE2],[1],[Define to 1 to enable pcre2 support])
fi

AM_CONDITIONAL([WITH_PCRE2],[test "$with_pcre2" = "yes"])

# GLIB tools

AC_DEFINE(GDK_MULTIHEAD_SAFE,1,[Force use of GDK multihead-safe APIs.])

AC_PATH_PROG([GLIB_GENMARSHAL],[glib-genmarshal])
AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])

VTE_DEFAULT_TERM=xterm-256color
AC_DEFINE_UNQUOTED(VTE_DEFAULT_TERM,"$VTE_DEFAULT_TERM",[The default value $TERM is set to.])

# Check for headers.
AC_CHECK_HEADERS(sys/select.h sys/syslimits.h sys/termios.h sys/wait.h stropts.h termios.h util.h wchar.h)
AC_HEADER_TIOCGWINSZ

# Check for PTY handling functions.
AC_CHECK_FUNCS([cfmakeraw fork setsid setpgid getpgid getpt grantpt unlockpt posix_openpt ptsname ptsname_r tcgetattr tcsetattr])

# Misc I/O routines.
AC_CHECK_FUNCS([pread pwrite])

# Pull in the right libraries for various functions which might not be
# bundled into an exploded libc.
AC_CHECK_FUNC(openpty,[have_openpty=1],AC_CHECK_LIB(util,openpty,[have_openpty=1; LIBS="$LIBS -lutil"]))
if test x$have_openpty = x1 ; then
	AC_DEFINE(HAVE_OPENPTY,1,[Define if you have the openpty function.])
fi
AC_CHECK_FUNC(floor,,AC_CHECK_LIB(m,floor,LIBS=["$LIBS -lm"]))
AC_CHECK_FUNCS([ceil floor round])

# Search for the required modules.

VTE_PKGS="glib-2.0 >= $GLIB_REQUIRED gobject-2.0 pango >= $PANGO_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gobject-2.0 gio-2.0 gio-unix-2.0 zlib $GNUTLS_PKGS $PCRE2_PKGS"
PKG_CHECK_MODULES([VTE],[$VTE_PKGS])
AC_SUBST([VTE_PKGS])

PKG_CHECK_MODULES([GLIB],[glib-2.0 >= $GLIB_REQUIRED])
PKG_CHECK_MODULES([GOBJECT],[gobject-2.0])
PKG_CHECK_MODULES([GTK],[gtk+-$GTK_API_VERSION >= $GTK_REQUIRED])

wcs_funcs_includes="
#ifdef HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
#  include <memory.h>
# endif
# include <string.h>
#else
# ifdef HAVE_STRINGS_H
#  include <strings.h>
# endif
#endif
#ifdef HAVE_WCHAR_H
# include <wchar.h>
#endif
"

AC_CHECK_TYPES(wint_t, AC_DEFINE(HAVE_WINT_T, , [Defined when the wint_t type is supported]), ,$wcs_funcs_includes)

################################################################################
# Glade catalogue
################################################################################

AC_MSG_CHECKING([whether to install the glade catalogue])
AC_ARG_ENABLE([glade-catalogue],
  [AS_HELP_STRING([--disable-glade],[Disable installing the glade catalogue])],
  [],[enable_glade_catalogue=no])
AC_MSG_RESULT([$enable_glade_catalogue])

if test "$enable_glade_catalogue" = "yes"; then
  GLADE_CATALOGUE_DIR="$($PKG_CONFIG --variable=catalogdir gladeui-$GLADE_API_VERSION)"
  GLADE_ICON_DIR="$($PKG_CONFIG --variable=pixmapdir gladeui-$GLADE_API_VERSION)"
  GLADE_MODULE_DIR="$($PKG_CONFIG --variable=moduledir gladeui-$GLADE_API_VERSION)"

  if test -z "$GLADE_CATALOGUE_DIR" -o -z "$GLADE_MODULE_DIR"; then
    AC_MSG_ERROR([gladeui-$GLADE_API_VERSION not found])
  fi

  AC_SUBST([GLADE_CATALOGUE_DIR])
  AC_SUBST([GLADE_ICON_DIR])
  AC_SUBST([GLADE_MODULE_DIR])
fi
  
AM_CONDITIONAL([ENABLE_GLADE_CATALOGUE],[test "$enable_glade_catalogue" = "yes"])

# ********
# Bindings
# ********

# No automagic please!
if test -z "$enable_introspection"; then
  enable_introspection=yes
fi

GOBJECT_INTROSPECTION_CHECK([0.9.0])

# No automagic please!
if test -z "$enable_vala"; then
  enable_vala=yes
fi

VAPIGEN_CHECK([0.18])

# ****************
# Test Application
# ****************

AC_MSG_CHECKING([whether to build the test application])
AC_ARG_ENABLE([test-application],
        [AS_HELP_STRING([--disable-test-application],[Disable test application])],
        [],[enable_test_application=$enable_vala])
AC_MSG_RESULT([$enable_test_application])

AM_PROG_VALAC([0.18.0],[],[
  if test "$enable_test_application" != "no"; then
    AC_MSG_ERROR([vala support enabled by vala compiler not found])
  fi])

if test "$enable_test_application" = "yes"; then
  PKG_CHECK_MODULES([GTK_3_16],[gtk+-3.0 >= 3.16],[have_gtk_3_16=yes],[have_gtk_3_16=no])
else
  have_gtk_3_16=no
fi

AM_CONDITIONAL([ENABLE_TEST_APPLICATION],[test "$enable_test_application" = "yes"])
AM_CONDITIONAL([HAVE_GTK_3_16],[test "$have_gtk_3_16" = "yes"])

# ***************
# Auxiliary tools
# ***************

AC_ARG_VAR([GLIB_COMPILE_RESOURCES],[the glib-compile-resources programme])
AC_PATH_PROG([GLIB_COMPILE_RESOURCES],[glib-compile-resources],[])
if test -z "$GLIB_COMPILE_RESOURCES"; then
  AC_MSG_ERROR([glib-compile-resources not found])
fi

AC_ARG_VAR([XMLLINT],[the xmllint programme])
AC_PATH_PROG([XMLLINT],[xmllint],[])
if test -z "$XMLLINT"; then
  AC_MSG_ERROR([xmllint not found])
fi

################################################################################

GTK_DOC_CHECK([1.13],[--flavour no-tmpl])

AC_SUBST([GLIB_PREFIX],[$($PKG_CONFIG --variable=prefix glib-2.0)])
AC_SUBST([GTK_PREFIX],[$($PKG_CONFIG --variable=prefix gtk+-$GTK_API_VERSION)])

################################################################################

AC_SUBST([VTE_MAJOR_VERSION],[version_major])
AC_SUBST([VTE_MINOR_VERSION],[version_minor])
AC_SUBST([VTE_MICRO_VERSION],[version_micro])

AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_CXXFLAGS])
AC_SUBST([AM_LDFLAGS])

################################################################################

AC_CONFIG_FILES([
Makefile
src/Makefile
src/vte.gresource.xml
src/vte/vteversion.h
perf/Makefile
po/Makefile.in
doc/Makefile
doc/openi18n/Makefile
doc/reference/Makefile
doc/reference/version.xml
glade/Makefile
])

AC_CONFIG_FILES([vte-${VTE_API_VERSION}.pc:vte.pc.in],[VTE_API_VERSION=${VTE_API_VERSION}])
AC_CONFIG_FILES([glade/vte-${VTE_API_VERSION}.xml.in:glade/vte.xml.in.in],[VTE_API_VERSION=${VTE_API_VERSION}])

AC_OUTPUT

#####################
# Print configuration
#####################
cat <<EOF | tee -a config.log

## -------------- ##
## Configuration. ##
## -------------- ##

Configuration for libvte $VERSION for gtk+-$GTK_API_VERSION
	GNUTLS: $with_gnutls
        PCRE2: $with_pcre2
	Installing Glade catalogue: $enable_glade_catalogue
	Debugging: $enable_debug
	Introspection: $enable_introspection
        Vala bindings: $enable_vala
        Test application: $enable_test_application
EOF