autotools: use autoreconf and gettext (#2938)
[geany-mirror.git] / configure.ac
blob39636c8825e3eb11738cc080409058529fa890ae
1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ([2.60])
4 AC_INIT([Geany], [1.39],
5                 [https://github.com/geany/geany/issues])
6 AC_CONFIG_SRCDIR([src/geany.h])
7 AC_CONFIG_AUX_DIR([build-aux])
8 AC_CONFIG_MACRO_DIR([m4])
9 AM_INIT_AUTOMAKE([1.11 -Wall parallel-tests subdir-objects])
10 AC_CONFIG_HEADERS([config.h])
12 AM_GNU_GETTEXT_VERSION([0.19.8])
13 AM_GNU_GETTEXT([external])
15 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
17 GEANY_PREFIX
18 GEANY_DOCDIR
20 GEANY_STATUS_ADD([Install Geany in], [${prefix}])
21 if test -n "${build}" -a -n "${target}"; then
22         GEANY_STATUS_ADD([Building Geany on], [${build}])
23         GEANY_STATUS_ADD([Building Geany for], [${target}])
26 # why do we use this?
27 AC_USE_SYSTEM_EXTENSIONS
29 m4_ifdef([AM_PROG_AR],[AM_PROG_AR])
30 LT_INIT([disable-static])
31 AC_PROG_CC
32 AC_PROG_CC_C99
33 AM_PROG_CC_C_O
35 AC_PROG_CXX
36 GEANY_PROG_CXX
37 AX_CXX_COMPILE_STDCXX_17
39 AC_PROG_INSTALL
40 AC_PROG_LN_S
42 # autoscan start
44 # Checks for header files.
45 AC_CHECK_HEADERS([fcntl.h glob.h stdlib.h sys/time.h errno.h limits.h])
47 # Checks for dependencies needed by ctags
48 AC_CHECK_HEADERS([fnmatch.h direct.h io.h sys/dir.h])
49 AC_DEFINE([HAVE_STDBOOL_H], [1], [whether or not to use <stdbool.h>.])
50 AC_CHECK_FUNC([regcomp],
51                 [have_regcomp=yes],
52                 [have_regcomp=no
53                  dnl various stuff for ctags/gnu_regex/
54                  AC_CHECK_HEADERS([langinfo.h locale.h libintl.h wctype.h wchar.h])
55                  AC_CHECK_FUNCS([memcpy isblank wcrtomb mbrtowc wcscoll])
56                  AC_FUNC_ALLOCA])
57 AM_CONDITIONAL([USE_BUNDLED_REGEX], [test "xno" = "x$have_regcomp"])
58 AC_CHECK_FUNC([fnmatch], [have_fnmatch=yes], [have_fnmatch=no])
59 AM_CONDITIONAL([USE_BUNDLED_FNMATCH], [test "xno" = "x$have_fnmatch"])
61 # Checks for typedefs, structures, and compiler characteristics.
62 AC_TYPE_OFF_T
63 AC_TYPE_SIZE_T
64 AC_STRUCT_TM
66 # Checks for library functions.
67 AC_CHECK_FUNCS([realpath])
69 # Function checks for u-ctags
70 AC_CHECK_FUNCS([strerror strstr asprintf])
71 AC_CHECK_FUNCS([mkstemp tempnam], [break])
72 AC_CHECK_FUNCS([strcasecmp stricmp], [break])
73 AC_CHECK_FUNCS([strncasecmp strnicmp], [break])
74 AC_CHECK_FUNCS([truncate ftruncate chsize], [break])
75 # non-functions checks for u-ctags.  Not that we really need those as we don't
76 # use u-ctags's main, but the corresponding macros have to be defined to
77 # something, so simply perform the actual checks.
78 AC_CHECK_DECLS([__environ],,,[[#include <unistd.h>]])
79 AC_CHECK_DECLS([_NSGetEnviron],,,[[#include <crt_externs.h>]])
81 # autoscan end
84 # check for VCS revision
85 GEANY_CHECK_REVISION([dnl force debug mode for a VCS working copy
86                                           CFLAGS="-g -DGEANY_DEBUG $CFLAGS"])
88 # GTK/GLib/GIO checks
89 gtk_modules="gtk+-3.0 >= 3.0 glib-2.0 >= 2.32"
90 gtk_modules_private="gio-2.0 >= 2.32 gmodule-no-export-2.0"
91 PKG_CHECK_MODULES([GTK], [$gtk_modules $gtk_modules_private])
92 AC_SUBST([DEPENDENCIES], [$gtk_modules])
93 AS_VAR_APPEND([GTK_CFLAGS], [" -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32"])
94 dnl Disable all GTK deprecations
95 AS_VAR_APPEND([GTK_CFLAGS], [" -DGDK_DISABLE_DEPRECATION_WARNINGS"])
96 AC_SUBST([GTK_CFLAGS])
97 AC_SUBST([GTK_LIBS])
98 GTK_VERSION=`$PKG_CONFIG --modversion gtk+-3.0`
99 AC_SUBST([GTK_VERSION])
100 GEANY_STATUS_ADD([Using GTK version], [${GTK_VERSION}])
101 # GTHREAD checks
102 gthread_modules="gthread-2.0"
103 PKG_CHECK_MODULES([GTHREAD], [$gthread_modules])
104 AC_SUBST([GTHREAD_CFLAGS])
105 AC_SUBST([GTHREAD_LIBS])
107 # --disable-deprecated switch for GTK purification
108 AC_ARG_ENABLE([deprecated],
109                 [AS_HELP_STRING([--disable-deprecated], [Disable deprecated GTK functions.])],
110                 [GTK_CFLAGS="$GTK_CFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"],
111                 [])
114 # Check for binary relocation support
115 GEANY_CHECK_BINRELOC
116 # CTags source compatibility (we actually use GRegex instead of POSIX regcomp)
117 AC_DEFINE([HAVE_REGCOMP], [1], [Should always be 1, required for CTags.])
118 # Plugins support
119 GEANY_CHECK_PLUGINS
120 # check for mingw specific settings
121 GEANY_CHECK_MINGW
123 GEANY_CHECK_SOCKET
124 GEANY_CHECK_VTE
125 GEANY_CHECK_MAC_INTEGRATION
126 GEANY_CHECK_THE_FORCE dnl hehe
128 AC_SUBST([GETTEXT_PACKAGE],[$PACKAGE])
129 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$PACKAGE"], [Gettext package.])
131 # double eval since datarootdir is usually defined as ${prefix}/share
132 AM_COND_IF([MINGW],
133   [pkgdatadir='${prefix}/data'],
134   [pkgdatadir='${datarootdir}/geany'])
135 AM_COND_IF([MINGW],[LIBS="$LIBS -liconv"])
136 AC_SUBST([GEANY_DATA_DIR], [$(eval echo $(eval echo $pkgdatadir))])
137 AC_SUBST([pkgdatadir])
139 # The default Python command.  On Windows, use the `py` launcher by default
140 AC_ARG_WITH([python-command],
141                         [AS_HELP_STRING([--with-python-command],
142                                                         [the default Python command [defaults to "py" on Windows and "python" otherwise]])],
143                         [with_python_command=$withval],
144                         [with_python_command=auto])
145 AS_IF([test "x$with_python_command" = xauto],
146           [AM_COND_IF([MINGW], [with_python_command=py], [with_python_command=python])])
147 AC_SUBST([PYTHON_COMMAND], [$with_python_command])
149 # Documentation tools
150 GEANY_CHECK_DOCUTILS
151 GEANY_CHECK_DOXYGEN
152 GEANY_CHECK_GTKDOC_HEADER
154 # libgeany
155 GEANY_LIB_INIT
157 # Output
158 AC_CONFIG_FILES([
159                 Makefile
160                 icons/Makefile
161                 icons/16x16/Makefile
162                 icons/24x24/Makefile
163                 icons/32x32/Makefile
164                 icons/48x48/Makefile
165                 icons/scalable/Makefile
166                 icons/tango/Makefile
167                 icons/tango/16x16/Makefile
168                 icons/tango/24x24/Makefile
169                 icons/tango/32x32/Makefile
170                 icons/tango/48x48/Makefile
171                 icons/tango/scalable/Makefile
172                 ctags/Makefile
173                 scintilla/Makefile
174                 src/Makefile
175                 src/tagmanager/Makefile
176                 plugins/Makefile
177                 po/Makefile.in
178                 data/Makefile
179                 data/filedefs/filetypes.python
180                 doc/Makefile
181                 doc/geany.1
182                 geany.pc
183                 geany.nsi
184                 doc/Doxyfile
185                 tests/Makefile
186                 tests/ctags/Makefile
188 AC_OUTPUT
190 # Summary
191 GEANY_STATUS_OUTPUT
192 echo ""
193 echo "Configuration is done OK."
194 echo ""