summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorChris Reuter <chris@blit.ca>2013-11-04 17:11:33 -0500
committerChris Reuter <chris@blit.ca>2013-11-07 19:44:45 -0500
commit4378b8ded4004249ad13e24873c47b0627a6a1bd (patch)
treee196944185c42e2f8c0f8bad246569bde4622306 /configure.ac
parent38845577002f0af0d538e78e0ff44de82d6e28f2 (diff)
downloadlibgd-4378b8ded4004249ad13e24873c47b0627a6a1bd.tar.gz
gd.h now holds the canonical version number.
Up to now, the version numbers were defined in configure.ac and put into gd.h by generating it from gd.h.in, replacing the values of several C macros. This violates the DRY principle, won't work on a dumb build system, confuses some dev tools and is just a huge headache in general. This change makes gd.h (no longer generated) the home of the version number and provides a script (config/getver.pl) which can extract the requested version components from the header file. configure.ac now gets the version number from gd.h instead of vice versa. In addition, there are now C functions that return the values of the version macros. This is for the benefit of non-C code using the library without access to the header file. It also provides a way to get the version number of the library currently linked rather than the header the program was compiled against. (This could change if the shared library is updated without recompiling the program using it.)
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac34
1 files changed, 15 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index f1fe0dc..de6c684 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,16 +3,14 @@
AC_PREREQ(2.54)
-# Some m4 magic to have correct version number everywhere
-m4_define([gd_MAJOR],[2])dnl
-m4_define([gd_MINOR],[1])dnl
-m4_define([gd_REVISION],[1])dnl
-m4_define([gd_EXTRA],[dev])dnl
+# We extract version numbers from src/versions.h
+define([gv],[perl config/getver.pl ]$1)
-m4_if(m4_len(gd_EXTRA), 0,dnl
- [m4_define([gd_PKG_VERSION],[gd_MAJOR.gd_MINOR.gd_REVISION])],dnl
- [m4_define([gd_PKG_VERSION],[gd_MAJOR.gd_MINOR.gd_REVISION-gd_EXTRA])]dnl
-)dnl
+m4_define([gd_MAJOR],esyscmd(gv(MAJOR)))dnl
+m4_define([gd_MINOR],esyscmd(gv(MINOR)))dnl
+m4_define([gd_REVISION],esyscmd(gv(RELEASE)))dnl
+m4_define([gd_EXTRA],esyscmd(gv(EXTRA)))dnl
+m4_define([gd_PKG_VERSION],[gd_MAJOR.gd_MINOR.gd_REVISION]gd_EXTRA)]dnl
AC_INIT([GD], gd_PKG_VERSION, [https://bitbucket.org/libgd/gd-libgd/issues], [libgd], [http://lib.gd])
AC_CONFIG_SRCDIR([src/gd.c])
@@ -20,20 +18,19 @@ AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
-# This is not used anywhere
+# This is not used anywhere. However, Makefile.netware searches
+# through configure for these definitions to find the version numbers.
+# (Assuming anyone still uses Netware, that should be changed to use
+# gd.h via getver.pl instead.)
GDLIB_MAJOR=gd_MAJOR
GDLIB_MINOR=gd_MINOR
GDLIB_REVISION=gd_REVISION
GDLIB_EXTRA=gd_EXTRA
GDLIB_VERSION=gd_PKG_VERSION
-AC_SUBST(GDLIB_MAJOR)
-AC_SUBST(GDLIB_MINOR)
-AC_SUBST(GDLIB_REVISION)
-AC_SUBST(GDLIB_EXTRA)
-AC_SUBST(GDLIB_VERSION)
# Dynamic library version information
# See http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
+
GDLIB_CURRENT=3
GDLIB_REVISION=0
GDLIB_AGE=0
@@ -457,11 +454,10 @@ AC_MSG_RESULT([
AC_CONFIG_FILES([Makefile
src/Makefile
- src/gd.h
- tests/Makefile
- tests/test_config.h
+ tests/Makefile
+ tests/test_config.h
config/Makefile
config/gdlib-config
- config/gdlib.pc])
+ config/gdlib.pc])
AC_OUTPUT