configure.ac 8.99 KB
Newer Older
1
# Copyright © 2003  Noah Levitt
Christian Persch's avatar
Christian Persch committed
2
# Copyright © 2007, 2008, 2009 Christian Persch
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02110-1301  USA

Christian Persch's avatar
Christian Persch committed
18
m4_define([gucharmap_version_major],[3])
19
m4_define([gucharmap_version_minor],[18])
20
m4_define([gucharmap_version_micro],[3])
21
m4_define([gucharmap_version_extra],[])
Christian Persch's avatar
Christian Persch committed
22
m4_define([gucharmap_version],[gucharmap_version_major.gucharmap_version_minor.gucharmap_version_micro()gucharmap_version_extra])
23 24 25 26 27 28 29 30 31 32 33 34 35

# Before making a release, the libtool version should be modified.
# The string is of the form C:R:A.
# - If interfaces have been changed or added, but binary compatibility has
#   been preserved, change to C+1:0:A+1
# - If binary compatibility has been broken (eg removed or changed interfaces)
#   change to C+1:0:0
# - If the interface is the same as the previous version, change to C:R+1:A
m4_define([gucharmap_lt_current],[7])
m4_define([gucharmap_lt_revision],[0])
m4_define([gucharmap_lt_age],[0])
m4_define([gucharmap_lt_version_info],[gucharmap_lt_current:gucharmap_lt_revision:gucharmap_lt_age])
m4_define([gucharmap_lt_current_minus_age],[m4_eval(gucharmap_lt_current - gucharmap_lt_age)])
Noah Levitt's avatar
Noah Levitt committed
36

Behdad Esfahbod's avatar
Behdad Esfahbod committed
37
AC_PREREQ([2.56])
38

39
AC_INIT([GNOME Character Map],[gucharmap_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=gucharmap],[gucharmap])
40

Christian Persch's avatar
Christian Persch committed
41
AC_CONFIG_MACRO_DIR([m4])
42
AC_CONFIG_SRCDIR([gucharmap/gucharmap.h.in])
Behdad Esfahbod's avatar
Behdad Esfahbod committed
43
AC_CONFIG_HEADERS([config.h])
Christian Persch's avatar
Christian Persch committed
44

45 46
AM_INIT_AUTOMAKE([1.11 foreign dist-bzip2 no-dist-gzip])
AM_SILENT_RULES([yes])
47
AM_MAINTAINER_MODE([enable])
48

49
# checks for progs
Noah Levitt's avatar
Noah Levitt committed
50
AC_PROG_CC
Noah Levitt's avatar
Noah Levitt committed
51
AC_DISABLE_STATIC
52
AC_PROG_LIBTOOL
Christian Persch's avatar
Christian Persch committed
53
IT_PROG_INTLTOOL([0.40.0])
54

Christian Persch's avatar
Christian Persch committed
55 56
AM_PROG_CC_C_O

57
# checks for stuff
58 59
GNOME_DEBUG_CHECK

60
# User documentation
61
YELP_HELP_INIT([no-lc-media-links no-lc-dist])
62

63 64
GLIB_REQUIRED=2.32.0
GIO_REQUIRED=2.32.0
Allison Karlitskaya's avatar
Allison Karlitskaya committed
65

66 67 68 69 70 71 72 73 74 75 76 77
# check for win32
case "$host" in
  *-*-mingw*) os_win32="yes" ;; 
  *) os_win32="no" ;; 
esac

if test "x$os_win32" = "xyes"
then
    CFLAGS="$CFLAGS -mms-bitfields -mwindows"
fi
AM_CONDITIONAL(OS_WIN32, test "x$os_win32" = "xyes")

Christian Persch's avatar
Christian Persch committed
78 79 80 81
# Which gtk+ API version to compile against

AC_MSG_CHECKING([which gtk+ version to compile against])
AC_ARG_WITH([gtk],
82
  [AS_HELP_STRING([--with-gtk=3.0],[which gtk+ version to compile against (default: 3.0)])],
Christian Persch's avatar
Christian Persch committed
83
  [case "$with_gtk" in
Christian Persch's avatar
Christian Persch committed
84 85 86
     3.0) ;;
     2.0) AC_MSG_ERROR([unsupported gtk version $with_gtk specified]) ;;
     *) AC_MSG_ERROR([invalid gtk version $with_gtk specified]) ;;
Christian Persch's avatar
Christian Persch committed
87
   esac],
Christian Persch's avatar
Christian Persch committed
88
  [with_gtk=3.0])
Christian Persch's avatar
Christian Persch committed
89 90 91
AC_MSG_RESULT([$with_gtk])

case "$with_gtk" in
92
  3.0) GTK_API_VERSION=3.0
93
       GTK_REQUIRED=3.4.0
94 95 96 97
       GUCHARMAP_API_VERSION=2.90
       GUCHARMAP_API_MAJOR_VERSION=2
       GUCHARMAP_API_MINOR_VERSION=90
       GUCHARMAP_API_PC_VERSION=2.90
Christian Persch's avatar
Christian Persch committed
98 99 100 101 102 103
       GUCHARMAP_LIBRARY_SUFFIX="-$GUCHARMAP_API_VERSION"
       ;;
esac

AC_SUBST([GTK_API_VERSION])
AC_SUBST([GUCHARMAP_API_VERSION])
104
AC_SUBST([GUCHARMAP_API_VERSION_U],[AS_TR_SH([$GUCHARMAP_API_VERSION])])
Christian Persch's avatar
Christian Persch committed
105 106 107 108 109 110 111 112 113 114 115
AC_SUBST([GUCHARMAP_API_MAJOR_VERSION])
AC_SUBST([GUCHARMAP_API_MINOR_VERSION])
AC_SUBST([GUCHARMAP_API_PC_VERSION])
AC_SUBST([GUCHARMAP_LIBRARY_SUFFIX_U],[AS_TR_SH([$GUCHARMAP_LIBRARY_SUFFIX])])

AM_CONDITIONAL([HAVE_GTK_2],[test "$with_gtk" = "2.0"])
AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])


PKG_CHECK_MODULES([GTK],[
  glib-2.0 >= $GLIB_REQUIRED
Allison Karlitskaya's avatar
Allison Karlitskaya committed
116
  gio-2.0 >= $GIO_REQUIRED
Christian Persch's avatar
Christian Persch committed
117 118
  gtk+-$GTK_API_VERSION >= $GTK_REQUIRED
])
119

Christian Persch's avatar
Christian Persch committed
120 121 122 123 124
GLIB_GENMARSHAL="$($PKG_CONFIG --variable=glib_genmarshal glib-2.0)"
AC_SUBST([GLIB_GENMARSHAL])
GLIB_MKENUMS="$($PKG_CONFIG --variable=glib_mkenums glib-2.0)"
AC_SUBST([GLIB_MKENUMS])

Allison Karlitskaya's avatar
Allison Karlitskaya committed
125
GLIB_GSETTINGS
126

Christian Persch's avatar
Christian Persch committed
127 128 129
AC_MSG_CHECKING([whether to build the charmap programme])
AC_ARG_ENABLE([charmap],
  [AS_HELP_STRING([--disable-charmap],[disable building the charmap programme])],
130
  [],[enable_charmap=yes])
Christian Persch's avatar
Christian Persch committed
131 132 133 134
AC_MSG_RESULT([$enable_charmap])

AM_CONDITIONAL([ENABLE_CHARMAP],[test "$enable_charmap" = "yes"])

135 136 137
# checks for funcs 
AC_CHECK_FUNCS([bind_textdomain_codeset])

138 139 140
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

141 142 143
AH_TEMPLATE([ENABLE_UNIHAN], [Define if you want CJK ideograph information])
AC_ARG_ENABLE(unihan, 
              AC_HELP_STRING([--disable-unihan], 
144
                             [do not build in CJK ideograph information]))
145
if test "x$enable_unihan" != "xno" ; then
146
    AC_DEFINE([ENABLE_UNIHAN],[1],[Define if you want CJK ideograph information])
147 148
fi

Christian Persch's avatar
Christian Persch committed
149 150 151
# Some utilities
AC_PROG_LN_S

152 153 154 155 156 157
AC_ARG_VAR([GLIB_COMPILE_RESOURCES],[the glib-compile-resources programme])
AC_PATH_PROG([GLIB_COMPILE_RESOURCES],[glib-compile-resources],[false])
if test "$GLIB_COMPILE_RESOURCES" = "false"; then
    AC_MSG_ERROR([glib-compile-resources not found])
fi

Christian Persch's avatar
Christian Persch committed
158 159 160 161
# AC_PATH_PROG([GTK_BUILDER_CONVERT],[gtk-builder-convert],[false])
# if test "$GTK_BUILDER_CONVERT" = "false"; then
#   AC_MSG_ERROR([gtk-builder-convert not found])
# fi
162

163
AC_ARG_VAR([XMLLINT],[the xmllint programme])
164 165 166 167 168
AC_PATH_PROG([XMLLINT],[xmllint],[false])
if test "$XMLLINT" = "false"; then
  AC_MSG_ERROR([xmllint not found])
fi

Christian Persch's avatar
Christian Persch committed
169 170 171 172 173
# AC_PATH_PROG([HEXDUMP],[hexdump],[false])
# if test "$HEXDUMP" = "false"; then
#   AC_MSG_ERROR([hexdump not found])
# fi

174 175 176 177 178 179
AC_ARG_VAR([DESKTOP_FILE_VALIDATE],[the desktop-file-validate programme])
AC_PATH_PROG([DESKTOP_FILE_VALIDATE],[desktop-file-validate],[])
if test -z "$DESKTOP_FILE_VALIDATE"; then
  AC_MSG_ERROR([desktop-file-validate not found])
fi

Christian Persch's avatar
Christian Persch committed
180 181 182 183 184 185 186 187 188
# ****
# i18n
# ****

GETTEXT_PACKAGE=gucharmap
AC_SUBST([GETTEXT_PACKAGE])
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[The gucharmap gettext domain])
AM_GLIB_GNU_GETTEXT

189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
##########################################################
# 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])

BSYMBOLIC_LDFLAG=
if test "$enable_Bsymbolic" != "no"; then
  CC_CHECK_LDFLAGS(["-Wl,-Bsymbolic-functions"],
    [BSYMBOLIC_LDFLAG="-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])
fi

AC_SUBST([BSYMBOLIC_LDFLAG])

213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
# ***********
# Compilation
# ***********

CC_CHECK_CFLAGS_APPEND([ \
  -Wall -Wextra \
  -Wformat-nonliteral -Werror=format-security \
  -Wsign-compare -Werror=implicit-function-declaration \
  -Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
  -Waggregate-return -Wcast-align -Wimplicit -Wuninitialized \
  -Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
  -Wpacked -Wmissing-format-attribute -Wshadow \
  -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
  -Wdeclaration-after-statement -Wold-style-definition \
  -Wno-missing-field-initializers -Wno-unused-parameter \
228
  -Wformat-signedness \
229 230
  -fno-common -Wno-switch-enum])

231 232 233 234
# ********
# Bindings
# ********

235 236 237 238 239 240
# No automagic please!
if test -z "$enable_introspection"; then
  enable_introspection=yes
fi

GOBJECT_INTROSPECTION_CHECK([0.9.0])
241

242 243 244 245 246
# No automagic please!
if test -z "$enable_vala"; then
  enable_vala=no
fi
m4_ifdef([VAPIGEN_CHECK],
247
  [VAPIGEN_CHECK([0.16])],
248
  [AM_CONDITIONAL([ENABLE_VAPIGEN],[false])])
249 250 251 252 253 254 255 256 257 258 259 260

case "$with_gtk" in
  3.0) GUCHARMAP_GIR_VERSION=$GUCHARMAP_API_VERSION
       GUCHARMAP_VAPI_VERSION=$GUCHARMAP_API_VERSION
       ;;
esac

AC_SUBST([GUCHARMAP_GIR_VERSION])
AC_SUBST([GUCHARMAP_GIR_VERSION_U],[AS_TR_SH([$GUCHARMAP_GIR_VERSION])])
AC_SUBST([GUCHARMAP_VAPI_VERSION])
AC_SUBST([GUCHARMAP_VAPI_VERSION_U],[AS_TR_SH([$GUCHARMAP_VAPI_VERSION])])

Christian Persch's avatar
Christian Persch committed
261 262 263 264 265 266
# ***************
# API & User Docs
# ***************

GTK_DOC_CHECK([1.0])

Christian Persch's avatar
Christian Persch committed
267 268
# *****************************************************************************

269 270 271 272 273
AC_SUBST([GUCHARMAP_VERSION_MAJOR],[gucharmap_version_major])
AC_SUBST([GUCHARMAP_VERSION_MINOR],[gucharmap_version_minor])
AC_SUBST([GUCHARMAP_VERSION_MICRO],[gucharmap_version_micro])
AC_SUBST([LIBGUCHARMAP_LT_VERSION],[gucharmap_lt_version_info])
AC_SUBST([LIBGUCHARMAP_LT_CURRENT_MINUS_AGE],[gucharmap_lt_current_minus_age])
274

Christian Persch's avatar
Christian Persch committed
275 276 277 278
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_LDFLAGS])

Noah Levitt's avatar
Noah Levitt committed
279
AC_CONFIG_FILES([
280
Makefile
Christian Persch's avatar
Christian Persch committed
281 282 283
gucharmap.desktop.in
gucharmap.nsi
gucharmap.spec
284
data/Makefile
Christian Persch's avatar
Christian Persch committed
285 286
docs/Makefile
docs/reference/Makefile
287
gucharmap/Makefile
288
gucharmap/gucharmap.gresource.xml
289
gucharmap/gucharmap.h
Noah Levitt's avatar
Noah Levitt committed
290
help/Makefile
Christian Persch's avatar
Christian Persch committed
291 292
pixmaps/Makefile
po/Makefile.in
293
])
Noah Levitt's avatar
Noah Levitt committed
294

Christian Persch's avatar
Christian Persch committed
295 296
AC_CONFIG_FILES([gucharmap-${GUCHARMAP_API_PC_VERSION}.pc:gucharmap.pc.in],[GUCHARMAP_API_PC_VERSION=$GUCHARMAP_API_PC_VERSION])

Noah Levitt's avatar
Noah Levitt committed
297
AC_OUTPUT