summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 02d50a16a1ce6ccbc8f4064fe868460de0194f53 (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
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
m4_define([version_major],0)
m4_define([version_minor],55)
m4_define([version_micro],92)
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/app/app.cc])
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])

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

AC_MSG_CHECKING([which gtk+ version to compile against])
AC_ARG_WITH([gtk],
  [AS_HELP_STRING([--with-gtk=3.0|3.90],[which gtk+ version to compile against (default: 3.0)])],
  [case "$with_gtk" in
     3.0) ;;
     3.9[02468]) ;;
     2.0) AC_MSG_ERROR([unsupported gtk version $with_gtk specified]) ;;
     *) AC_MSG_ERROR([invalid gtk version $with_gtk specified]) ;;
   esac],
  [with_gtk=3.0])
AC_MSG_RESULT([$with_gtk])

case "$with_gtk" in
  3.0) GTK_API_VERSION=3.0
       GTK_API_MAJOR_VERSION=3
       GTK_API_MINOR_VERSION=0
       GTK_REQUIRED=3.8.0
       GTK_MIN_REQUIRED=3.8
       GTK_MAX_ALLOWED=3.20
       VTE_API_MAJOR_VERSION=2
       VTE_API_MINOR_VERSION=91
       GLADE_API_VERSION=2.0
       ;;
  3.9[02468]) GTK_API_VERSION=4.0
              GTK_API_MAJOR_VERSION=4
              GTK_API_MINOR_VERSION=0
              GTK_REQUIRED=3.89.0
              GTK_MIN_REQUIRED=3.8
              GTK_MAX_ALLOWED=3.20
              VTE_API_MAJOR_VERSION=3
              VTE_API_MINOR_VERSION=91
              # GLADE_API_VERSION=4.0 ?
              # remove the following when they're ready
              enable_glade_catalogue=no
              enable_introspection=no
              enable_vala=no
             ;;
esac

VTE_API_VERSION=$VTE_API_MAJOR_VERSION.$VTE_API_MINOR_VERSION

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])
AC_SUBST([GTK_API_MAJOR_VERSION])
AC_SUBST([GTK_API_MINOR_VERSION])

################################################################################
# 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])

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

# Check for programs
PKG_PROG_PKG_CONFIG
AC_PROG_CC
AC_PROG_CXX
AC_USE_SYSTEM_EXTENSIONS
AC_HEADER_STDC
AM_PROG_CC_C_O
AC_PROG_SED

AX_CXX_COMPILE_STDCXX([17])

AC_SYS_LARGEFILE

# Initialize libtool
LT_PREREQ([2.2])
LT_INIT
LT_LANG([C])
LT_LANG([C++])

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
  -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
  -Wmisleading-indentation 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
  -Wvla 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
  -Waggregate-return dnl
  -Wimplicit dnl
  -Wimplicit-fallthrough=3 dnl
  -Wnested-externs dnl
  -Wold-style-definition dnl
  -Wstrict-prototypes dnl
])

m4_define([compiler_flags_only_cxx],[ dnl
  -Wstrict-null-sentinel dnl
  -Wimplicit-fallthrough=5 dnl
  -fno-rtti dnl
  -fno-exceptions dnl
  -fvisibility=hidden dnl
  -fvisibility-inlines-hidden 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++])

if test "$cc_cv_cxx_CXXFLAGS__fvisibility_hidden" != "yes"; then
  AC_MSG_ERROR([$CXX doesn't support required flag -fvisibility=hidden])
fi

##########################################################
# 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_LDFLAGS -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_CXXLDFLAGS="$VTE_CXXLDFLAGS -Wl,-Bsymbolic-functions"],
    [if test "$enable_Bsymbolic" = "auto"; then
       AC_MSG_WARN([-Bsymbolic not supported by cxx ld; disabling])
       enable_Bsymbolic=no
     else
       AC_MSG_ERROR([-Bsymbolic requested but not supported by cxx 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.21

# 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"])

# GLIB tools

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 pty.h])
AC_HEADER_TIOCGWINSZ

# Check for how to open a new PTY. We support posix_openpt and BSDs openpty

AC_CHECK_FUNCS([posix_openpt grantpt unlockpt ptsname],[],
  [AC_MSG_ERROR([no support for Unix98 PTY found])])

# Misc PTY handling functions
AC_CHECK_FUNCS([cfmakeraw fork setsid setpgid getpgid tcgetattr tcsetattr])

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

# Misc string routines.
AC_CHECK_FUNCS([strchrnul])

# for vtespawn
AC_CHECK_HEADERS([sys/resource.h])
AC_CHECK_FUNCS([fdwalk])

# Math functions
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 libpcre2-8 >= $PCRE2_REQUIRED $GNUTLS_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])

PKG_CHECK_MODULES([APP],[
  glib-2.0 >= $GLIB_REQUIRED
  gobject-2.0
  cairo-gobject
  pango >= $PANGO_REQUIRED
  gdk-pixbuf-2.0
  gtk+-$GTK_API_VERSION >= $GTK_REQUIRED])

########################
# Legacy Charset Support
########################

AC_MSG_CHECKING([whether to enable legacy charset support using iconv])
AC_ARG_WITH([iconv],
              [AS_HELP_STRING([--without-iconv],
                              [Disable legacy charset support using iconv])],
              [],[with_iconv=yes])
AC_MSG_RESULT([$with_iconv])
if test "$with_iconv" = "yes"; then
        AC_DEFINE([WITH_ICONV],[1],[Enable legacy charset support using iconv])
fi

################################################################################
# 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

m4_ifdef([GOBJECT_INTROSPECTION_CHECK],
  [GOBJECT_INTROSPECTION_CHECK([0.9.0])],
  [if test "$enable_introspection" = "yes"; then
    AC_MSG_ERROR([[Introspection requested but M4 macros not installed. Try --disable-introspection]])
   fi
   AM_CONDITIONAL([HAVE_INTROSPECTION],[false])])

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

m4_ifdef([VAPIGEN_CHECK],
  [VAPIGEN_CHECK([0.24])],
  [if test "$enable_vala" = "yes"; then
     AC_MSG_ERROR([[Vala requested but M4 macros not installed. Try --disable-vala]])
   fi
   AM_CONDITIONAL([ENABLE_VAPIGEN],[false])])

AM_PROG_VALAC([0.24.0],[],[
  if test "$enable_vala" != "no"; then
    AC_MSG_ERROR([Vala requested but vala compiler >= 0.24.0 not found])
  fi])

PKG_CHECK_MODULES([GTK_3_16],[gtk+-$GTK_API_VERSION >= 3.16],[have_gtk_3_16=yes],[have_gtk_3_16=no])
AM_PROG_VALAC([0.31.1],[have_vala_0_31=yes],[have_vala_0_31=no])

AM_CONDITIONAL([HAVE_GTK_3_16],[test "$have_gtk_3_16" = "yes"])
AM_CONDITIONAL([HAVE_VALA_0_31],[test "$have_vala_0_31" = "yes"])

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

AC_ARG_VAR([GLIB_COMPILE_RESOURCES],[the glib-compile-resources programme])
if test -z "$GLIB_COMPILE_RESOURCES"; then
  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
fi

AC_ARG_VAR([XMLLINT],[the xmllint programme])
if test -z "$XMLLINT"; then
  AC_PATH_PROG([XMLLINT],[xmllint],[])
  if test -z "$XMLLINT"; then
    AC_MSG_ERROR([xmllint not found])
  fi
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
src/app/Makefile
bindings/Makefile
bindings/gir/Makefile
bindings/vala/Makefile
perf/Makefile
po/Makefile.in
doc/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
	IConv: $with_iconv
	Installing Glade catalogue: $enable_glade_catalogue
	Debugging: $enable_debug
	Introspection: $enable_introspection
        Vala bindings: $enable_vala
EOF