summaryrefslogtreecommitdiff
path: root/configure.ac
blob: b5ce4a61dabe712488f4766af47439e873f9257a (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
AC_INIT([Evince Browser Plugin],
        [0.2.0],
        [dbn.lists@gmail.com],
        [evince-browser-plugin])
AC_CONFIG_SRCDIR([src/evbp.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign])
LT_INIT([disable-static])
PKG_PROG_PKG_CONFIG
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

dnl We want C99 features
AC_PROG_CC_C99

dnl Required versions of dependencies.
GTK2_REQUIRED=2.14.0
GTK3_REQUIRED=3.0
GLIB_REQUIRED=2.18.0
EVINCE2_API=2.32
EVINCE3_API=3.0

dnl Check for NPAPI. Mozilla packages are split out because we only
dnl want their headers from MOZILLA_CFLAGS.
mozilla_pkgs="mozilla-plugin nspr"
PKG_CHECK_MODULES([MOZILLA], [$mozilla_pkgs])

dnl See if we want gtk2/evince2 and/or gtk3/evince3. This is important
dnl because mozilla currently only support gtk2 plugins and epiphany
dnl only supports gtk3 plugins. Default gtk2 to yes for now since firefox
dnl is the more likely browser. However, if epiphany is installed, also
dnl enable gtk3.
AC_MSG_CHECKING([if gtk+-2.0 should be used])
AC_ARG_ENABLE([gtk2],
              [AC_HELP_STRING([--enable-gtk2],
                              [use gtk+/evince version 2 (default: yes)])],
              [case "$enable_gtk2" in
               yes|no) ;;
               *) AC_MSG_ERROR([invalid option "$enable_gtk2"]) ;;
               esac],
              [enable_gtk2=yes])
AC_MSG_RESULT([$enable_gtk2])
AC_CHECK_PROG([have_epiphany], [epiphany], [yes], [no])
AC_MSG_CHECKING([if gtk+-3.0 should be used])
AC_ARG_ENABLE([gtk3],
              [AC_HELP_STRING([--enable-gtk3],
                              [use gtk+/evince version 3 ]dnl
                              [(default: yes if epiphany installed)])],
              [case "$enable_gtk3" in
               yes|no) ;;
               *) AC_MSG_ERROR([invalid option "$enable_gtk3"]) ;;
               esac],
              [enable_gtk3=$have_epiphany])
AC_MSG_RESULT([$enable_gtk3])

dnl Make sure we have one available toolkit
if test $enable_gtk2 = no && test $enable_gtk3 = no; then
    AC_MSG_ERROR([cannot disable both gtk2 and gtk3])
fi

evince2_pkgs="gtk+-2.0 >= $GTK2_REQUIRED gio-2.0 >= $GLIB_REQUIRED \
    evince-view-$EVINCE2_API evince-document-$EVINCE2_API"
evince3_pkgs="gtk+-3.0 >= $GTK3_REQUIRED gio-2.0 >= $GLIB_REQUIRED \
    evince-view-$EVINCE3_API evince-document-$EVINCE3_API"
if test $enable_gtk2 = yes; then
    PKG_CHECK_MODULES([EVINCE2], [$evince2_pkgs])
fi
AM_CONDITIONAL([ENABLE_GTK2], [test $enable_gtk2 = yes])
if test $enable_gtk3 = yes; then
    PKG_CHECK_MODULES([EVINCE3], [$evince3_pkgs])
fi
AM_CONDITIONAL([ENABLE_GTK3], [test $enable_gtk3 = yes])

GETTEXT_PACKAGE="$PACKAGE"
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
dnl AM_GLIB_GNU_GETTEXT
AC_DEFINE_UNQUOTED([G_LOG_DOMAIN], ["$PACKAGE"], [Logging prefix])

dnl Add extra C flags
AC_SUBST([E_CFLAGS])
AC_ARG_ENABLE([warnings],
              [AC_HELP_STRING([--disable-warnings],
                [C compiler warnings (default: yes)])],
              [warnings=$enableval],
              [warnings=yes])
if test "x$warnings" = xyes && test "x$GCC" = xyes; then
    E_CFLAGS="-Wall -Wmissing-prototypes -Wmissing-declarations \
-Wbad-function-cast"
    case `$CC -dumpversion` in
    3.4.* | 4.*)
        E_CFLAGS="$E_CFLAGS -Wold-style-definition \
-Wdeclaration-after-statement"
        ;;
    esac
fi

AC_CONFIG_FILES([
Makefile
src/Makefile
test/Makefile
test/firefox.sh
])

AC_CONFIG_COMMANDS([script],[
chmod +x test/firefox.sh
])

AC_OUTPUT