configure.ac 14.5 KB
Newer Older
1
m4_define([version_major],0)
2
m4_define([version_minor],55)
3
m4_define([version_micro],91)
4 5
m4_define([version_triplet],version_major.version_minor.version_micro)

6 7 8 9 10 11
AC_PREREQ([2.63])
AC_INIT([vte],
        [version_triplet],
        [http://bugzilla.gnome.org/enter_bug.cgi?product=vte],
        [vte])

Christian Persch's avatar
Christian Persch committed
12
AC_CONFIG_MACRO_DIR([m4])
13
AC_CONFIG_SRCDIR([src/app/app.cc])
14 15
AC_CONFIG_HEADERS([config.h])

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

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

20 21 22 23 24
if test -z "$enable_maintainer_mode"; then
  enable_maintainer_mode=yes
fi
AM_MAINTAINER_MODE([enable])

25 26 27 28
################################################################################
# GTK+
################################################################################

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

68
VTE_API_VERSION=$VTE_API_MAJOR_VERSION.$VTE_API_MINOR_VERSION
69 70 71 72 73 74

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])
75 76 77 78 79 80 81 82 83 84 85 86 87
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])
88

89 90
################################################################################

91
# Check for programs
92
PKG_PROG_PKG_CONFIG
93
AC_PROG_CC
94
AC_PROG_CXX
95
AC_USE_SYSTEM_EXTENSIONS
96
AC_HEADER_STDC
97
AM_PROG_CC_C_O
98
AC_PROG_SED
99

Christian Persch's avatar
Christian Persch committed
100
AX_CXX_COMPILE_STDCXX([17])
101

102 103
AC_SYS_LARGEFILE

104 105 106 107 108 109
# Initialize libtool
LT_PREREQ([2.2])
LT_INIT
LT_LANG([C])
LT_LANG([C++])

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

113 114 115 116 117 118 119 120 121 122 123 124
################################################################################
# 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
125

126 127 128 129
################################################################################
# i18n
################################################################################

130
IT_PROG_INTLTOOL([0.35.0])
131

132
GETTEXT_PACKAGE=vte-$VTE_API_VERSION
133 134 135
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
                   [Package translatable messages domain name.])
136
AM_GLIB_GNU_GETTEXT
137
AC_CHECK_DECLS(bind_textdomain_codeset,,,[#include "libintl.h"])
138

139 140 141 142
################################################################################
# Compilation
################################################################################

143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
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
158
  -Wmisleading-indentation dnl
159 160 161 162 163 164 165
  -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
166
  -Wno-packed dnl
167 168 169 170 171 172
  -Wshadow dnl
  -Wsign-compare dnl
  -Wstrict-aliasing=2 dnl
  -Wundef dnl
  -Wuninitialized dnl
  -Wunsafe-loop-optimizations dnl
Egmont Koblinger's avatar
Egmont Koblinger committed
173
  -Wvla dnl
174 175 176 177 178 179 180 181 182 183 184
  -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
185
  -Waggregate-return dnl
186
  -Wimplicit dnl
187
  -Wimplicit-fallthrough=3 dnl
188 189 190 191 192 193
  -Wnested-externs dnl
  -Wold-style-definition dnl
  -Wstrict-prototypes dnl
])

m4_define([compiler_flags_only_cxx],[ dnl
194
  -Wstrict-null-sentinel dnl
195
  -Wimplicit-fallthrough=5 dnl
196 197
  -fno-rtti dnl
  -fno-exceptions dnl
198 199
  -fvisibility=hidden dnl
  -fvisibility-inlines-hidden dnl
200
])
201

202 203 204 205 206 207
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++])

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

212 213 214 215 216 217 218 219 220 221 222 223
##########################################################
# 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
224
  CC_CHECK_LDFLAGS(["-Wl,-Bsymbolic-functions"],
225
    [VTE_LDFLAGS="$VTE_LDFLAGS -Wl,-Bsymbolic-functions"],
226 227 228 229 230 231 232 233 234
    [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"],
235
    [VTE_CXXLDFLAGS="$VTE_CXXLDFLAGS -Wl,-Bsymbolic-functions"],
236
    [if test "$enable_Bsymbolic" = "auto"; then
237
       AC_MSG_WARN([-Bsymbolic not supported by cxx ld; disabling])
238 239
       enable_Bsymbolic=no
     else
240
       AC_MSG_ERROR([-Bsymbolic requested but not supported by cxx ld. Use --disable-Bsymbolic to disable])
241
     fi])
242
  AC_LANG_POP([C++])
243 244 245
fi

AC_SUBST([VTE_LDFLAGS])
246
AC_SUBST([VTE_CXXLDFLAGS])
247

248 249 250 251
################################################################################
# Core
################################################################################

252 253
GLIB_REQUIRED=2.40.0
GIO_REQUIRED=2.40.0
254
PANGO_REQUIRED=1.22.0
255
GNUTLS_REQUIRED=3.2.7
256
PCRE2_REQUIRED=10.21
257 258

# GNUTLS
259

Christian Persch's avatar
Christian Persch committed
260
AC_MSG_CHECKING([whether GnuTLS support is requested])
261
AC_ARG_WITH([gnutls],
Christian Persch's avatar
Christian Persch committed
262
  [AS_HELP_STRING([--without-gnutls],[Disable GnuTLS support])],
263 264 265 266 267 268 269
  [],[with_gnutls=yes])
AC_MSG_RESULT([$with_gnutls])

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

Christian Persch's avatar
Christian Persch committed
270
  AC_DEFINE([WITH_GNUTLS],[1],[Define to 1 to enable GnuTLS support])
271 272 273 274
fi

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

275 276
# GLIB tools

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

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

283
# Check for headers.
284
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])
285 286
AC_HEADER_TIOCGWINSZ

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

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

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

295
# Misc I/O routines.
296
AC_CHECK_FUNCS([pread pwrite])
297
AC_CHECK_FUNCS([explicit_bzero])
298

299 300 301
# Misc string routines.
AC_CHECK_FUNCS([strchrnul])

302 303 304 305 306
# for vtespawn
AC_CHECK_HEADERS([sys/resource.h])
AC_CHECK_FUNCS([fdwalk])

# Math functions
307
AC_CHECK_FUNC(floor,,AC_CHECK_LIB(m,floor,LIBS=["$LIBS -lm"]))
308
AC_CHECK_FUNCS([ceil floor round])
309

310
# Search for the required modules.
311

Christian Persch's avatar
Christian Persch committed
312
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"
313 314
PKG_CHECK_MODULES([VTE],[$VTE_PKGS])
AC_SUBST([VTE_PKGS])
315

316 317 318 319
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])

320 321 322
PKG_CHECK_MODULES([APP],[
  glib-2.0 >= $GLIB_REQUIRED
  gobject-2.0
323
  cairo-gobject
324
  pango >= $PANGO_REQUIRED
325
  gdk-pixbuf-2.0
326 327
  gtk+-$GTK_API_VERSION >= $GTK_REQUIRED])

328 329 330 331 332 333 334 335 336 337 338 339 340 341
########################
# 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

342 343 344 345 346 347 348
################################################################################
# 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])],
349
  [],[enable_glade_catalogue=no])
350 351 352
AC_MSG_RESULT([$enable_glade_catalogue])

if test "$enable_glade_catalogue" = "yes"; then
353 354 355
  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)"
356 357

  if test -z "$GLADE_CATALOGUE_DIR" -o -z "$GLADE_MODULE_DIR"; then
358
    AC_MSG_ERROR([gladeui-$GLADE_API_VERSION not found])
359 360 361 362 363 364
  fi

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

Christian Persch's avatar
Christian Persch committed
368 369 370
# ********
# Bindings
# ********
Christian Persch's avatar
Christian Persch committed
371 372 373

# No automagic please!
if test -z "$enable_introspection"; then
374
  enable_introspection=yes
Christian Persch's avatar
Christian Persch committed
375 376
fi

377 378 379
m4_ifdef([GOBJECT_INTROSPECTION_CHECK],
  [GOBJECT_INTROSPECTION_CHECK([0.9.0])],
  [if test "$enable_introspection" = "yes"; then
380
    AC_MSG_ERROR([[Introspection requested but M4 macros not installed. Try --disable-introspection]])
381 382
   fi
   AM_CONDITIONAL([HAVE_INTROSPECTION],[false])])
Christian Persch's avatar
Christian Persch committed
383

Christian Persch's avatar
Christian Persch committed
384 385
# No automagic please!
if test -z "$enable_vala"; then
386
  enable_vala=yes
Christian Persch's avatar
Christian Persch committed
387 388
fi

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

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

401 402
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])
403 404

AM_CONDITIONAL([HAVE_GTK_3_16],[test "$have_gtk_3_16" = "yes"])
405
AM_CONDITIONAL([HAVE_VALA_0_31],[test "$have_vala_0_31" = "yes"])
406 407 408 409 410 411 412

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

AC_ARG_VAR([GLIB_COMPILE_RESOURCES],[the glib-compile-resources programme])
if test -z "$GLIB_COMPILE_RESOURCES"; then
413 414 415 416
  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
417 418 419 420
fi

AC_ARG_VAR([XMLLINT],[the xmllint programme])
if test -z "$XMLLINT"; then
421 422 423 424
  AC_PATH_PROG([XMLLINT],[xmllint],[])
  if test -z "$XMLLINT"; then
    AC_MSG_ERROR([xmllint not found])
  fi
425
fi
Christian Persch's avatar
Christian Persch committed
426

427 428
################################################################################

429 430 431
GTK_DOC_CHECK([1.13],[--flavour no-tmpl])

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

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

436 437 438
AC_SUBST([VTE_MAJOR_VERSION],[version_major])
AC_SUBST([VTE_MINOR_VERSION],[version_minor])
AC_SUBST([VTE_MICRO_VERSION],[version_micro])
439

440
AC_SUBST([AM_CPPFLAGS])
441
AC_SUBST([AM_CFLAGS])
442
AC_SUBST([AM_CXXFLAGS])
443 444
AC_SUBST([AM_LDFLAGS])

445 446
################################################################################

447
AC_CONFIG_FILES([
448 449
Makefile
src/Makefile
450
src/vte.gresource.xml
451
src/vte/vteversion.h
452
src/app/Makefile
453 454 455
bindings/Makefile
bindings/gir/Makefile
bindings/vala/Makefile
Behdad Esfahbod's avatar
Behdad Esfahbod committed
456
perf/Makefile
457
po/Makefile.in
458 459
doc/Makefile
doc/reference/Makefile
460
doc/reference/version.xml
461
glade/Makefile
462
])
463

Christian Persch's avatar
Christian Persch committed
464
AC_CONFIG_FILES([vte-${VTE_API_VERSION}.pc:vte.pc.in],[VTE_API_VERSION=${VTE_API_VERSION}])
465
AC_CONFIG_FILES([glade/vte-${VTE_API_VERSION}.xml.in:glade/vte.xml.in.in],[VTE_API_VERSION=${VTE_API_VERSION}])
466 467

AC_OUTPUT
468 469 470 471

#####################
# Print configuration
#####################
472 473 474 475 476 477
cat <<EOF | tee -a config.log

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

478
Configuration for libvte $VERSION for gtk+-$GTK_API_VERSION
Christian Persch's avatar
Christian Persch committed
479
	GnuTLS: $with_gnutls
480
	IConv: $with_iconv
481
	Installing Glade catalogue: $enable_glade_catalogue
482
	Debugging: $enable_debug
Christian Persch's avatar
Christian Persch committed
483 484
	Introspection: $enable_introspection
        Vala bindings: $enable_vala
485
EOF