diff options
author | Reuben Thomas <rrt@sc3d.org> | 2016-12-18 19:06:54 +0000 |
---|---|---|
committer | Hubert Figuière <hub@figuiere.net> | 2016-12-19 23:14:08 -0500 |
commit | e531961f06e9a491cd5f39160fce21224fd9a9d8 (patch) | |
tree | c971a3f8f9a01da42e30cb703ae3ce447eff3f08 | |
parent | 08787dfa91d788bb84237cfffc8b44c11114e257 (diff) | |
download | enchant-e531961f06e9a491cd5f39160fce21224fd9a9d8.tar.gz |
Modernise autotools use: use configure.ac and autoreconf
Explain use of autoreconf in HACKING, and also make some other minor
updates to that file.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .travis.yml | 1 | ||||
-rw-r--r-- | HACKING | 21 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rwxr-xr-x | autogen.sh | 98 | ||||
-rw-r--r-- | configure.ac (renamed from configure.in) | 57 | ||||
-rw-r--r-- | m4/.gitignore | 5 | ||||
-rw-r--r-- | m4/binreloc.m4 (renamed from ac-helpers/binreloc.m4) | 0 | ||||
-rw-r--r-- | m4/ssize_t.m4 (renamed from ac-helpers/ssize_t.m4) | 0 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/aspell/Makefile.am | 2 | ||||
-rw-r--r-- | src/ispell/Makefile.am | 2 | ||||
-rw-r--r-- | src/myspell/Makefile.am | 2 | ||||
-rw-r--r-- | src/uspell/Makefile.am | 2 | ||||
-rw-r--r-- | src/voikko/Makefile.am | 2 | ||||
-rw-r--r-- | src/zemberek/Makefile.am | 2 | ||||
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/enchant-ispell.c | 2 | ||||
-rw-r--r-- | tests/enchant-lsmod.c | 2 |
19 files changed, 65 insertions, 142 deletions
@@ -19,5 +19,6 @@ /libtool /ltmain.sh /missing +/INSTALL Makefile Makefile.in diff --git a/.travis.yml b/.travis.yml index ff1f997..24db8ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,5 +57,6 @@ before_install: script: - ./autogen.sh + - ./configure - make - make check @@ -1,8 +1,16 @@ -* Don't commit directly, instead send your diff to the authors (use - 'cvs diff -Nu'). +* Don't commit directly, instead make a pull request on GitHub. + + +Building from git +----------------- + +Before running ./configure in a fresh git checkout, run: + +./autogen.sh + Working in libenchant -------------------- +--------------------- When writing libenchant our priorities are @@ -21,6 +29,7 @@ loop 3% faster is not. Specifically, this means: - Make sure your code does not generate warnings at all. - Please follow the formatting style + Formatting style ---------------- @@ -55,7 +64,7 @@ modular chunks (as detailed by Linus). g_return_if_fail and g_return_val_if_fail macros to verify that the parameters passed are valid. - - Under no circunstances use magic variables. Use typedef + - Under no circumstances use magic variables. Use typedef enum { ... } type; to create enumerations. Do not use integers to hold references to enumerations, the compiler can help catch various errors. @@ -82,7 +91,7 @@ modular chunks (as detailed by Linus). that there is a clean and maintainable way to do it: - Fast code that is difficult to maintain has no place in - Gnumeric and will be dropped. + Enchant and will be dropped. - Follow the libenchant commenting style, which is not the Gtk style; @@ -99,4 +108,4 @@ might become a burden to the program maintainers. projects. Cleaning code in libenchant is more important than trying not to break -existing code. By all means, code clean ups are always welcome. +existing code. Code clean ups are always welcome. diff --git a/Makefile.am b/Makefile.am index b9e72b2..891a30e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,5 @@ +ACLOCAL_AMFLAGS = -I m4 + SUBDIRS=src tests doc data pkgconfigdir = $(libdir)/pkgconfig @@ -1,99 +1,3 @@ #!/bin/sh -# # Run this before configure -# -# This file blatantly ripped off from subversion. -# -# Note: this dependency on Perl is fine: only developers use autogen.sh -# and we can state that dev people need Perl on their machine -# - -rm -f autogen.err - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -olddir=`pwd` -cd $srcdir - -automake --version | perl -ne 'if (/\(GNU automake\) (([0-9]+).([0-9]+))/) {print; if ($2 < 1 || ($2 == 1 && $3 < 4)) {exit 1;}}' - -if [ $? -ne 0 ]; then - echo "Error: you need automake 1.4 or later. Please upgrade." - exit 1 -fi - -if test ! -d `aclocal --print-ac-dir 2>> autogen.err`; then - echo "Bad aclocal (automake) installation" - exit 1 -fi - -libtoolize="" -for found_lib in libtoolize glibtoolize ; do - $found_lib --version > /dev/null 2>&1 - if [ $? = 0 ]; then - libtoolize=$found_lib - break - fi -done - -$libtoolize --force --copy || { - echo "error: libtoolize failed" - exit 1 -} - -# Produce aclocal.m4, so autoconf gets the automake macros it needs -# -echo "Creating aclocal.m4: aclocal -I ac-helpers $ACLOCAL_FLAGS" - -aclocal -I ac-helpers $ACLOCAL_FLAGS 2>> autogen.err - -# Produce all the `GNUmakefile.in's and create neat missing things -# like `install-sh', etc. -# -echo "automake --add-missing --copy --foreign" - -automake --add-missing --copy --foreign 2>> autogen.err || { - echo "" - echo "* * * warning: possible errors while running automake - check autogen.err" - echo "" -} - -# If there's a config.cache file, we may need to delete it. -# If we have an existing configure script, save a copy for comparison. -if [ -f config.cache ] && [ -f configure ]; then - cp configure configure.$$.tmp -fi - -# Produce ./configure -# -echo "Creating configure..." - -autoconf 2>> autogen.err || { - echo "" - echo "* * * warning: possible errors while running automake - check autogen.err" - echo "" -} - -cd $olddir - -run_configure=true -for arg in $*; do - case $arg in - --no-configure) - run_configure=false - ;; - *) - ;; - esac -done - -if $run_configure; then - $srcdir/configure --enable-maintainer-mode "$@" - echo - echo "Now type 'make' to compile enchant." -else - echo - echo "Now run 'configure' and 'make' to compile enchant." -fi - +autoreconf -i diff --git a/configure.in b/configure.ac index 672b65f..cd197f1 100644 --- a/configure.in +++ b/configure.ac @@ -1,44 +1,45 @@ -AC_INIT(src/enchant.h) +AC_INIT([enchant],[1.6.1]) +AC_PACKAGE_VERSION +AC_CONFIG_SRCDIR(src/enchant.h) +AM_INIT_AUTOMAKE([no-define]) AC_CANONICAL_HOST +AM_MAINTAINER_MODE +AC_CONFIG_MACRO_DIR([m4]) -dnl Set release number +dnl Release number rules: dnl This is derived from "Versioning" chapter of info libtool documentation. -PACKAGE=enchant -dnl 4a) Increment when removing or changing interfaces. -ENCHANT_MAJOR_VERSION=1 -dnl 4a) 5) Increment when adding interfaces. -dnl 6) Set to zero when removing or changing interfaces. -ENCHANT_MINOR_VERSION=6 -dnl 3) Increment when interfaces not changed at all, +dnl Format is MAJOR:MIINOR:MICRO +dnl 4a) Increment major when removing or changing interfaces. +dnl 4a) 5) Increment minor when adding interfaces. +dnl 6) Set minor to zero when removing or changing interfaces. +dnl 3) Increment micro when interfaces not changed at all, dnl only bug fixes or internal changes made. -dnl 4b) Set to zero when adding, removing or changing interfaces. -ENCHANT_MICRO_VERSION=1 -dnl -dnl Set this too -MAJOR_VERSION_PLUS_MINOR_VERSION=`expr $ENCHANT_MAJOR_VERSION + $ENCHANT_MINOR_VERSION` -dnl -VERSION=$ENCHANT_MAJOR_VERSION.$ENCHANT_MINOR_VERSION.$ENCHANT_MICRO_VERSION +dnl 4b) Set micro to zero when adding, removing or changing interfaces. + +dnl First extract pieces from the version number string +ENCHANT_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'` +ENCHANT_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'` +ENCHANT_MICRO_VERSION=`echo $VERSION | awk -F. '{print $3}'` + dnl Version info for libraries = CURRENT:REVISION:AGE +MAJOR_VERSION_PLUS_MINOR_VERSION=`expr $ENCHANT_MAJOR_VERSION + $ENCHANT_MINOR_VERSION` VERSION_INFO=$MAJOR_VERSION_PLUS_MINOR_VERSION:$ENCHANT_MICRO_VERSION:$ENCHANT_MINOR_VERSION + AC_SUBST(VERSION_INFO) AC_SUBST(ENCHANT_MAJOR_VERSION) AC_SUBST(ENCHANT_MINOR_VERSION) AC_SUBST(ENCHANT_MICRO_VERSION) -AM_INIT_AUTOMAKE($PACKAGE, $VERSION) -AM_MAINTAINER_MODE - dnl Checks for programs. -AC_ISC_POSIX +AC_SEARCH_LIBS([strerror],[cposix]) AC_PROG_CC AC_PROG_CPP AC_PROG_OBJC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET -AC_STDC_HEADERS -AC_LIBTOOL_WIN32_DLL -AM_PROG_LIBTOOL +AC_HEADER_STDC +LT_INIT([win32-dll]) gt_TYPE_SSIZE_T AC_C_CONST @@ -61,7 +62,7 @@ AC_DEFUN([ENCHANT_CC_TRY_FLAG], [ enchant_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $1" - AC_COMPILE_IFELSE([ ], [enchant_cc_flag=yes], [enchant_cc_flag=no]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]])], [enchant_cc_flag=yes], [enchant_cc_flag=no]) CFLAGS="$enchant_save_CFLAGS" if test "x$enchant_cc_flag" = "xyes"; then @@ -80,7 +81,7 @@ AC_DEFUN([ENCHANT_CXX_TRY_FLAG], [ enchant_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $1" - AC_COMPILE_IFELSE([ ], [enchant_cxx_flag=yes], [enchant_cxx_flag=no]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]])], [enchant_cxx_flag=yes], [enchant_cxx_flag=no]) CXXFLAGS="$enchant_save_CXXFLAGS" if test "x$enchant_cxx_flag" = "xyes"; then @@ -255,8 +256,7 @@ glib_DEFUN([GLIB_LC_MESSAGES], [AC_CHECK_HEADERS([locale.h]) if test $ac_cv_header_locale_h = yes; then AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, - [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], - am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <locale.h>]], [[return LC_MESSAGES]])],[am_cv_val_LC_MESSAGES=yes],[am_cv_val_LC_MESSAGES=no])]) if test $am_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your <locale.h> file defines LC_MESSAGES.]) @@ -509,7 +509,7 @@ AM_CONDITIONAL(WITH_APPLESPELL, test "x$build_applespell" = "xyes") dnl ======================================================================================= -AC_OUTPUT([ +AC_CONFIG_FILES([ Makefile enchant.pc enchant-uninstalled.pc @@ -530,6 +530,7 @@ doc/Makefile data/Makefile autopackage/default.apspec ]) +AC_OUTPUT dnl =========================================================================================== diff --git a/m4/.gitignore b/m4/.gitignore new file mode 100644 index 0000000..94e6f26 --- /dev/null +++ b/m4/.gitignore @@ -0,0 +1,5 @@ +/libtool.m4 +/ltoptions.m4 +/ltsugar.m4 +/ltversion.m4 +/lt~obsolete.m4 diff --git a/ac-helpers/binreloc.m4 b/m4/binreloc.m4 index 071e49e..071e49e 100644 --- a/ac-helpers/binreloc.m4 +++ b/m4/binreloc.m4 diff --git a/ac-helpers/ssize_t.m4 b/m4/ssize_t.m4 index 4eaef93..4eaef93 100644 --- a/ac-helpers/ssize_t.m4 +++ b/m4/ssize_t.m4 diff --git a/src/Makefile.am b/src/Makefile.am index 7fa7b1a..4d79e73 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS=. aspell ispell uspell myspell hspell applespell voikko zemberek -INCLUDES=-I$(top_srcdir) $(ENCHANT_CFLAGS) $(CC_WARN_CFLAGS) -DENCHANT_GLOBAL_MODULE_DIR=\"$(libdir)/enchant\" -DENCHANT_GLOBAL_ORDERING=\"$(datadir)/enchant\" -D_ENCHANT_BUILD=1 -DENCHANT_VERSION_STRING=\"@ENCHANT_MAJOR_VERSION@.@ENCHANT_MINOR_VERSION@.@ENCHANT_MICRO_VERSION@\" +AM_CPPFLAGS=-I$(top_srcdir) $(ENCHANT_CFLAGS) $(CC_WARN_CFLAGS) -DENCHANT_GLOBAL_MODULE_DIR=\"$(libdir)/enchant\" -DENCHANT_GLOBAL_ORDERING=\"$(datadir)/enchant\" -D_ENCHANT_BUILD=1 -DENCHANT_VERSION_STRING=\"@ENCHANT_MAJOR_VERSION@.@ENCHANT_MINOR_VERSION@.@ENCHANT_MICRO_VERSION@\" lib_LTLIBRARIES = libenchant.la @@ -20,7 +20,7 @@ libenchant_includedir = $(includedir)/enchant libenchant_include_HEADERS = enchant.h enchant-provider.h enchant++.h if WITH_APPLESPELL -INCLUDES += @APPLESPELL_CFLAGS@ +AM_CPPFLAGS += @APPLESPELL_CFLAGS@ libenchant_la_LIBADD += @APPLESPELL_LIBS@ libenchant_la_LDFLAGS += @APPLESPELL_LDFLAGS@ libenchant_la_SOURCES += enchant_cocoa.m enchant_cocoa.h diff --git a/src/aspell/Makefile.am b/src/aspell/Makefile.am index 4b5c1a1..18bfcf1 100644 --- a/src/aspell/Makefile.am +++ b/src/aspell/Makefile.am @@ -4,7 +4,7 @@ else target_lib = endif -INCLUDES=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(CC_WARN_CFLAGS) @ASPELL_INC@ -D_ENCHANT_BUILD=1 @ASPELL_CFLAGS@ +AM_CPPFLAGS=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(CC_WARN_CFLAGS) @ASPELL_INC@ -D_ENCHANT_BUILD=1 @ASPELL_CFLAGS@ aspell_LTLIBRARIES = $(target_lib) aspelldir= $(libdir)/enchant diff --git a/src/ispell/Makefile.am b/src/ispell/Makefile.am index 48b3c62..da20b6d 100644 --- a/src/ispell/Makefile.am +++ b/src/ispell/Makefile.am @@ -4,7 +4,7 @@ else target_lib = endif -INCLUDES=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(CXX_WARN_CFLAGS) $(ISPELL_CFLAGS) -D_ENCHANT_BUILD=1 +AM_CPPFLAGS=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(CXX_WARN_CFLAGS) $(ISPELL_CFLAGS) -D_ENCHANT_BUILD=1 ispell_LTLIBRARIES = $(target_lib) ispelldir= $(libdir)/enchant diff --git a/src/myspell/Makefile.am b/src/myspell/Makefile.am index ae67d03..7facb38 100644 --- a/src/myspell/Makefile.am +++ b/src/myspell/Makefile.am @@ -4,7 +4,7 @@ else target_lib = endif -INCLUDES=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(MYSPELL_CFLAGS) $(CXX_WARN_CFLAGS) -D_ENCHANT_BUILD=1 +AM_CPPFLAGS=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(MYSPELL_CFLAGS) $(CXX_WARN_CFLAGS) -D_ENCHANT_BUILD=1 myspell_LTLIBRARIES = $(target_lib) myspelldir= $(libdir)/enchant diff --git a/src/uspell/Makefile.am b/src/uspell/Makefile.am index 5dc85c4..8a42796 100644 --- a/src/uspell/Makefile.am +++ b/src/uspell/Makefile.am @@ -4,7 +4,7 @@ else target_lib = endif -INCLUDES=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(USPELL_CFLAGS) $(CXX_WARN_CFLAGS) -D_ENCHANT_BUILD=1 +AM_CPPFLAGS=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(USPELL_CFLAGS) $(CXX_WARN_CFLAGS) -D_ENCHANT_BUILD=1 uspell_LTLIBRARIES = $(target_lib) uspelldir= $(libdir)/enchant diff --git a/src/voikko/Makefile.am b/src/voikko/Makefile.am index e12cbc0..3cda61a 100644 --- a/src/voikko/Makefile.am +++ b/src/voikko/Makefile.am @@ -4,7 +4,7 @@ else target_lib = endif -INCLUDES=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(CC_WARN_CFLAGS) @VOIKKO_INC@ -D_ENCHANT_BUILD=1 +AM_CPPFLAGS=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(CC_WARN_CFLAGS) @VOIKKO_INC@ -D_ENCHANT_BUILD=1 voikko_LTLIBRARIES = $(target_lib) voikkodir= $(libdir)/enchant diff --git a/src/zemberek/Makefile.am b/src/zemberek/Makefile.am index 7fd90dd..6e30006 100644 --- a/src/zemberek/Makefile.am +++ b/src/zemberek/Makefile.am @@ -4,7 +4,7 @@ else target_lib = endif -INCLUDES=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(ZEMBEREK_CFLAGS) $(CXX_WARN_CFLAGS) -D_ENCHANT_BUILD=1 +AM_CPPFLAGS=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) $(ZEMBEREK_CFLAGS) $(CXX_WARN_CFLAGS) -D_ENCHANT_BUILD=1 zemberek_LTLIBRARIES = $(target_lib) zemberekdir= $(libdir)/enchant diff --git a/tests/Makefile.am b/tests/Makefile.am index 0980415..2c84b62 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) +AM_CPPFLAGS=-I$(top_srcdir)/src $(ENCHANT_CFLAGS) EXTRA_DIST=test.pwl ispell.in diff --git a/tests/enchant-ispell.c b/tests/enchant-ispell.c index d42c32f..3910ac9 100644 --- a/tests/enchant-ispell.c +++ b/tests/enchant-ispell.c @@ -69,7 +69,7 @@ typedef enum static void print_version (FILE * to) { - fprintf (to, "@(#) International Ispell Version 3.1.20 (but really Enchant %s)\n", VERSION); + fprintf (to, "@(#) International Ispell Version 3.1.20 (but really Enchant %s)\n", PACKAGE_VERSION); fflush (to); } diff --git a/tests/enchant-lsmod.c b/tests/enchant-lsmod.c index 6bed5c2..7176c50 100644 --- a/tests/enchant-lsmod.c +++ b/tests/enchant-lsmod.c @@ -97,7 +97,7 @@ main (int argc, char **argv) g_free (lang_tag); return 0; } else if (!strcmp (argv[i], "-v") || !strcmp (argv[i], "-version")) { - printf ("%s %s\n", argv[0], VERSION); + printf ("%s %s\n", argv[0], PACKAGE_VERSION); if (lang_tag) g_free (lang_tag); return 0; |