summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2021-11-07 18:04:18 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2021-11-07 18:57:43 +0100
commitae171a9c1bec28e6ac4daf30d11c67230d108cae (patch)
tree37a8cb8d0f2c672c865b6bf2b71ff76eda86db6d
parent9e0efee77b50047f8542b47593e2ca5b73decada (diff)
downloadlibgphoto2-ae171a9c1bec28e6ac4daf30d11c67230d108cae.tar.gz
Consistent checks for asm .symver and version-script
Use the same checks for asm .symver and -Wl,--version-script support for both libgphoto2.la and libgphoto2_port.la. This also reorganizes the Makefile.am files for libgphoto2.la and libgphoto2_port.la so that things belonging together are actually grouped together, so that inconsistencies can become more visible. This does not change what actually happens with when linking the libraries: * libgphoto2.la is still linked with just a --export-symbols libgphoto2.sym list of exported symbols. * libgphoto2_port.la is still linked with a -Wl,--version-script=libgphoto2_port.ver version script. However, the two library Makefile.am are now organized in such a way that you can actually see that. We should examine what those two symbol export methods actually do on Linux/ELF (complete support for version script semantics), and on non-ELF systems such as MacOSX dylib or Windows DLL.
-rw-r--r--configure.ac21
-rw-r--r--gphoto-m4/Makefile-files2
-rw-r--r--gphoto-m4/gp-asm-symver-ifelse.m430
-rw-r--r--gphoto-m4/gp-asm-symver-support.m421
-rw-r--r--libgphoto2/Makefile.am116
-rw-r--r--libgphoto2_port/configure.ac21
-rw-r--r--libgphoto2_port/gphoto-m4/Makefile-files2
-rw-r--r--libgphoto2_port/gphoto-m4/gp-asm-symver-ifelse.m430
-rw-r--r--libgphoto2_port/gphoto-m4/gp-asm-symver-support.m421
-rw-r--r--libgphoto2_port/libgphoto2_port/Makefile.am79
10 files changed, 228 insertions, 115 deletions
diff --git a/configure.ac b/configure.ac
index c49a14c68..352229a74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -289,26 +289,7 @@ AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\"${localedir}\\\""
AC_SYS_LARGEFILE
-AC_MSG_CHECKING([for asm .symver support])
-AC_COMPILE_IFELSE([dnl
- AC_LANG_PROGRAM([[
- void f1(void);
- void f1() {}
- void f2(void);
- void f2() {}
- asm(".symver f1, f@VER1");
- asm(".symver f2, f@@VER2");
- ]],[])dnl
-],[
- AC_DEFINE([HAVE_ASM_SYMVERS], [1],
- [Define if there is asm .symver support.])
- VERSIONMAPLDFLAGS="-Wl,--version-script=\$(srcdir)/libgphoto2.ver"
- AC_MSG_RESULT([yes])
-],[
- VERSIONMAPLDFLAGS=""
- AC_MSG_RESULT([no])
-])
-AC_SUBST([VERSIONMAPLDFLAGS])
+GP_ASM_SYMVER_SUPPORT
dnl ---------------------------------------------------------------------------
dnl FIXME: What is this good for?
diff --git a/gphoto-m4/Makefile-files b/gphoto-m4/Makefile-files
index 70fc5439a..bb3564f12 100644
--- a/gphoto-m4/Makefile-files
+++ b/gphoto-m4/Makefile-files
@@ -3,6 +3,8 @@
EXTRA_DIST += %reldir%/README.md
EXTRA_DIST += %reldir%/gphoto-m4-sync
+EXTRA_DIST += %reldir%/gp-asm-symver-ifelse.m4
+EXTRA_DIST += %reldir%/gp-asm-symver-support.m4
EXTRA_DIST += %reldir%/gp-byteorder.m4
EXTRA_DIST += %reldir%/gp-camlibs.m4
EXTRA_DIST += %reldir%/gp-check-doxygen.m4
diff --git a/gphoto-m4/gp-asm-symver-ifelse.m4 b/gphoto-m4/gp-asm-symver-ifelse.m4
new file mode 100644
index 000000000..33174f8f5
--- /dev/null
+++ b/gphoto-m4/gp-asm-symver-ifelse.m4
@@ -0,0 +1,30 @@
+dnl ####################################################################
+dnl GP_ASM_SYMVER_IFELSE([ACTION-IF-TRUE], [ACTION-IF-FALSE])
+dnl ####################################################################
+dnl
+AC_DEFUN([GP_ASM_SYMVER_IFELSE], [dnl
+AC_MSG_CHECKING([for asm .symver support])
+AC_COMPILE_IFELSE([dnl
+ AC_LANG_PROGRAM([[
+ void f1(void);
+ void f1() {}
+ void f2(void);
+ void f2() {}
+ asm(".symver f1, f@VER1");
+ asm(".symver f2, f@@VER2");
+ ]], [[
+ ]])dnl
+], [dnl
+AC_MSG_RESULT([yes])
+$1
+], [dnl
+AC_MSG_RESULT([no])
+$2
+])
+])dnl
+dnl
+dnl ####################################################################
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End:
diff --git a/gphoto-m4/gp-asm-symver-support.m4 b/gphoto-m4/gp-asm-symver-support.m4
new file mode 100644
index 000000000..1b1826474
--- /dev/null
+++ b/gphoto-m4/gp-asm-symver-support.m4
@@ -0,0 +1,21 @@
+dnl ####################################################################
+dnl If compiler supports asm .symver, define HAVE_ASM_SYMVER C preprocessor macro and Automake conditional
+dnl ####################################################################
+dnl
+AC_DEFUN([GP_ASM_SYMVER_SUPPORT], [dnl
+GP_ASM_SYMVER_IFELSE([dnl
+ have_asm_symver=yes
+ AC_DEFINE([HAVE_ASM_SYMVERS], [1],
+ [Define if there is asm .symver support.])
+], [dnl
+ have_asm_symver=no
+])
+AM_CONDITIONAL([HAVE_ASM_SYMVER],
+ [test "x$have_asm_symver" = xyes])
+])dnl
+dnl
+dnl ####################################################################
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End:
diff --git a/libgphoto2/Makefile.am b/libgphoto2/Makefile.am
index 18809dcfb..a3328d56d 100644
--- a/libgphoto2/Makefile.am
+++ b/libgphoto2/Makefile.am
@@ -1,59 +1,93 @@
-lib_LTLIBRARIES = libgphoto2.la
+EXTRA_DIST =
+
+
+# included by all *.c files containing translated string literals as
+# libgphoto2/i18n.h
+EXTRA_DIST += i18n.h
+
+
+# dummy file needed by gtk-doc
+EXTRA_DIST += gphoto2-library.c
+
+
+lib_LTLIBRARIES = libgphoto2.la
+libgphoto2_la_CFLAGS =
+libgphoto2_la_CPPFLAGS =
+libgphoto2_la_DEPENDENCIES =
+libgphoto2_la_LDFLAGS =
+libgphoto2_la_LIBADD =
+libgphoto2_la_SOURCES =
+
+libgphoto2_la_CPPFLAGS += -I$(top_srcdir)
+libgphoto2_la_CPPFLAGS += -I$(top_builddir)
+
+libgphoto2_la_CPPFLAGS += -I$(top_srcdir)/libgphoto2_port
+libgphoto2_la_CPPFLAGS += -I$(top_builddir)/libgphoto2_port
+
+libgphoto2_la_CPPFLAGS += $(AM_CPPFLAGS)
+
+libgphoto2_la_LDFLAGS += -no-undefined
# Notes about the list of exported symbols:
# gp_* also contains internal symbols which are intended for
# INTERNAL USE ONLY and should be converted into gpi_* symbols
# gpi_* are for libgphoto2/camlib internal use only
# NEVER USE gpi_* in frontends!
-# gp_* gphoto2 API, used in
+# gp_* gphoto2 API, used in
# - frontends
# BE AWARE that NOT ALL gp_* FUNCTIONS ARE CONSIDERED PUBLIC.
#
# Yes, this is messy, but we are going to clean this up.
-libgphoto2_la_CPPFLAGS = \
- -I$(top_srcdir) -I$(top_builddir) \
- -I$(top_srcdir)/libgphoto2_port -I$(top_builddir)/libgphoto2_port \
- $(AM_CPPFLAGS) $(CPPFLAGS) \
- $(LTDLINCL) \
- $(LIBEXIF_CFLAGS)
-
-libgphoto2_la_LDFLAGS = \
- -no-undefined \
- -export-symbols $(srcdir)/libgphoto2.sym \
- -version-info @LIBGPHOTO2_VERSION_INFO@
-
-libgphoto2_la_SOURCES = \
- gphoto2-abilities-list.c\
- ahd_bayer.c \
- bayer.c bayer.h bayer-types.h \
- gphoto2-camera.c \
- gphoto2-context.c \
- exif.c exif.h \
- gphoto2-file.c \
- gphoto2-filesys.c \
- gamma.c gamma.h \
- jpeg.c jpeg.h \
- gphoto2-list.c \
- gphoto2-result.c \
- gphoto2-version.c \
- gphoto2-setting.c \
- gphoto2-widget.c
-
-libgphoto2_la_LIBADD = \
- $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la \
- $(LIBLTDL) \
- $(LIBEXIF_LIBS) \
- -lm $(INTLLIBS)
+# Keep on using libgphoto2.sym until we actually have a libgphoto2.ver
+# version script.
+# EXTRA_DIST += libgphoto2.ver
+EXTRA_DIST += libgphoto2.sym
+# if HAVE_ASM_SYMVER
+# libgphoto2_la_DEPENDENCIES += libgphoto2.ver
+# libgphoto2_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libgphoto2.ver
+# else
+libgphoto2_la_DEPENDENCIES += libgphoto2.sym
+libgphoto2_la_LDFLAGS += -export-symbols $(srcdir)/libgphoto2.sym
+# endif
+
+libgphoto2_la_LDFLAGS += -version-info @LIBGPHOTO2_VERSION_INFO@
+
+libgphoto2_la_LIBADD += $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la
+
# The libtool docs describe these params, but they don't build.
# "-dlopen" self \
# "-dlopen" $(top_builddir)/camlibs/canon/....la \
# "-dlopen" $(top_builddir)/camlibs/ptp2/....la
-libgphoto2_la_DEPENDENCIES = \
- $(top_srcdir)/gphoto2/gphoto2-version.h \
- $(srcdir)/libgphoto2.sym
+libgphoto2_la_CPPFLAGS += $(LTDLINCL)
+libgphoto2_la_LIBADD += $(LIBLTDL)
-EXTRA_DIST = gphoto2-library.c libgphoto2.sym
+libgphoto2_la_CPPFLAGS += $(LIBEXIF_CFLAGS)
+libgphoto2_la_LIBADD += $(LIBEXIF_LIBS)
-EXTRA_DIST += i18n.h
+libgphoto2_la_LIBADD += -lm
+libgphoto2_la_LIBADD += $(INTLLIBS)
+
+libgphoto2_la_SOURCES += gphoto2-abilities-list.c
+libgphoto2_la_SOURCES += ahd_bayer.c
+libgphoto2_la_SOURCES += bayer.c
+libgphoto2_la_SOURCES += bayer.h
+libgphoto2_la_SOURCES += bayer-types.h
+libgphoto2_la_SOURCES += gphoto2-camera.c
+libgphoto2_la_SOURCES += gphoto2-context.c
+libgphoto2_la_SOURCES += exif.c
+libgphoto2_la_SOURCES += exif.h
+libgphoto2_la_SOURCES += gphoto2-file.c
+libgphoto2_la_SOURCES += gphoto2-filesys.c
+libgphoto2_la_SOURCES += gamma.c
+libgphoto2_la_SOURCES += gamma.h
+libgphoto2_la_SOURCES += jpeg.c
+libgphoto2_la_SOURCES += jpeg.h
+libgphoto2_la_SOURCES += gphoto2-list.c
+libgphoto2_la_SOURCES += gphoto2-result.c
+libgphoto2_la_SOURCES += gphoto2-version.c
+libgphoto2_la_SOURCES += gphoto2-setting.c
+libgphoto2_la_SOURCES += gphoto2-widget.c
+
+libgphoto2_la_DEPENDENCIES += $(top_srcdir)/gphoto2/gphoto2-version.h
diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac
index b29166bc3..ab83dafe9 100644
--- a/libgphoto2_port/configure.ac
+++ b/libgphoto2_port/configure.ac
@@ -184,26 +184,7 @@ AC_CHECK_HEADER([regex.h],
[])
AC_CHECK_LIB([regex], [regexec])
-AC_MSG_CHECKING([for asm .symver support])
-AC_COMPILE_IFELSE([dnl
- AC_LANG_PROGRAM([[
- void f1(void);
- void f1() {}
- void f2(void);
- void f2() {}
- asm(".symver f1, f@VER1");
- asm(".symver f2, f@@VER2");
- ]], [[]])dnl
-], [dnl
- AC_DEFINE([HAVE_ASM_SYMVERS], [1],
- [Define if there is asm .symver support.])
- VERSIONMAPLDFLAGS="-Wl,--version-script=\$(srcdir)/libgphoto2_port.ver"
- AC_MSG_RESULT([yes])
-], [dnl
- VERSIONMAPLDFLAGS=""
- AC_MSG_RESULT([no])
-])
-AC_SUBST([VERSIONMAPLDFLAGS])
+GP_ASM_SYMVER_SUPPORT
dnl Check for mnt_mountp in struct mnttab
AC_MSG_CHECKING([for mnt_mountp in struct mnttab])
diff --git a/libgphoto2_port/gphoto-m4/Makefile-files b/libgphoto2_port/gphoto-m4/Makefile-files
index 2a89dd2d8..f426c6282 100644
--- a/libgphoto2_port/gphoto-m4/Makefile-files
+++ b/libgphoto2_port/gphoto-m4/Makefile-files
@@ -3,6 +3,8 @@
EXTRA_DIST += %reldir%/README.md
EXTRA_DIST += %reldir%/gphoto-m4-sync
+EXTRA_DIST += %reldir%/gp-asm-symver-ifelse.m4
+EXTRA_DIST += %reldir%/gp-asm-symver-support.m4
EXTRA_DIST += %reldir%/gp-byteorder.m4
EXTRA_DIST += %reldir%/gp-camlibs.m4
EXTRA_DIST += %reldir%/gp-check-doxygen.m4
diff --git a/libgphoto2_port/gphoto-m4/gp-asm-symver-ifelse.m4 b/libgphoto2_port/gphoto-m4/gp-asm-symver-ifelse.m4
new file mode 100644
index 000000000..33174f8f5
--- /dev/null
+++ b/libgphoto2_port/gphoto-m4/gp-asm-symver-ifelse.m4
@@ -0,0 +1,30 @@
+dnl ####################################################################
+dnl GP_ASM_SYMVER_IFELSE([ACTION-IF-TRUE], [ACTION-IF-FALSE])
+dnl ####################################################################
+dnl
+AC_DEFUN([GP_ASM_SYMVER_IFELSE], [dnl
+AC_MSG_CHECKING([for asm .symver support])
+AC_COMPILE_IFELSE([dnl
+ AC_LANG_PROGRAM([[
+ void f1(void);
+ void f1() {}
+ void f2(void);
+ void f2() {}
+ asm(".symver f1, f@VER1");
+ asm(".symver f2, f@@VER2");
+ ]], [[
+ ]])dnl
+], [dnl
+AC_MSG_RESULT([yes])
+$1
+], [dnl
+AC_MSG_RESULT([no])
+$2
+])
+])dnl
+dnl
+dnl ####################################################################
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End:
diff --git a/libgphoto2_port/gphoto-m4/gp-asm-symver-support.m4 b/libgphoto2_port/gphoto-m4/gp-asm-symver-support.m4
new file mode 100644
index 000000000..1b1826474
--- /dev/null
+++ b/libgphoto2_port/gphoto-m4/gp-asm-symver-support.m4
@@ -0,0 +1,21 @@
+dnl ####################################################################
+dnl If compiler supports asm .symver, define HAVE_ASM_SYMVER C preprocessor macro and Automake conditional
+dnl ####################################################################
+dnl
+AC_DEFUN([GP_ASM_SYMVER_SUPPORT], [dnl
+GP_ASM_SYMVER_IFELSE([dnl
+ have_asm_symver=yes
+ AC_DEFINE([HAVE_ASM_SYMVERS], [1],
+ [Define if there is asm .symver support.])
+], [dnl
+ have_asm_symver=no
+])
+AM_CONDITIONAL([HAVE_ASM_SYMVER],
+ [test "x$have_asm_symver" = xyes])
+])dnl
+dnl
+dnl ####################################################################
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End:
diff --git a/libgphoto2_port/libgphoto2_port/Makefile.am b/libgphoto2_port/libgphoto2_port/Makefile.am
index 967949843..dfbad73a9 100644
--- a/libgphoto2_port/libgphoto2_port/Makefile.am
+++ b/libgphoto2_port/libgphoto2_port/Makefile.am
@@ -1,10 +1,24 @@
-lib_LTLIBRARIES = libgphoto2_port.la
+EXTRA_DIST =
-libgphoto2_port_la_CPPFLAGS = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/libgphoto2_port \
- $(AM_CPPFLAGS) $(CPPFLAGS) \
- $(LTDLINCL)
+
+# included by all *.c files containing translated string literals as
+# libgphoto2_port/i18n.h
+EXTRA_DIST += i18n.h
+
+
+lib_LTLIBRARIES = libgphoto2_port.la
+libgphoto2_port_la_CFLAGS =
+libgphoto2_port_la_CPPFLAGS =
+libgphoto2_port_la_DEPENDENCIES =
+libgphoto2_port_la_LDFLAGS =
+libgphoto2_port_la_LIBADD =
+libgphoto2_port_la_SOURCES =
+
+libgphoto2_port_la_CPPFLAGS += -I$(top_srcdir)
+libgphoto2_port_la_CPPFLAGS += -I$(top_srcdir)/libgphoto2_port
+libgphoto2_port_la_CPPFLAGS += $(AM_CPPFLAGS)
+
+libgphoto2_port_la_LDFLAGS += -no-undefined
# Notes about the list of exported symbols:
# gp_* also contains internal symbols which are intended for
@@ -25,38 +39,35 @@ libgphoto2_port_la_CPPFLAGS = \
#
# Yes, this is messy, but we are going to clean this up.
-libgphoto2_port_la_LDFLAGS = \
- -no-undefined \
- @VERSIONMAPLDFLAGS@ \
- -version-info @LIBGPHOTO2_PORT_VERSION_INFO@
+# EXTRA_DIST += libgphoto2_port.sym
+EXTRA_DIST += libgphoto2_port.ver
+if HAVE_ASM_SYMVER
+libgphoto2_port_la_DEPENDENCIES += $(srcdir)/libgphoto2_port.ver
+libgphoto2_port_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libgphoto2_port.ver
+# else
+# libgphoto2_port_la_DEPENDENCIES += $(srcdir)/libgphoto2_port.sym
+# libgphoto2_port_la_LDFLAGS += -export-symbols $(srcdir)/libgphoto2_port.sym
+endif
+
+libgphoto2_port_la_LDFLAGS += -version-info @LIBGPHOTO2_PORT_VERSION_INFO@
-libgphoto2_port_la_LIBADD = \
- $(LIBLTDL) \
- $(INTLLIBS)
# The libtool docs describe these params, but they don't build.
# "-dlopen" self \
# "-dlopen" $(top_builddir)/serial/....la \
# "-dlopen" $(top_builddir)/usb/....la
-libgphoto2_port_la_SOURCES = \
- gphoto2-port-info-list.c \
- gphoto2-port-info.h \
- gphoto2-port-log.c \
- gphoto2-port-version.c \
- gphoto2-port.c \
- gphoto2-port-portability.c \
- gphoto2-port-result.c
-
-libgphoto2_port_la_DEPENDENCIES = \
- $(top_srcdir)/gphoto2/gphoto2-port-version.h \
- $(top_srcdir)/gphoto2/gphoto2-port-library.h \
- $(srcdir)/libgphoto2_port.ver
-
-# Note: If you have problem with this file not being put into
-# the source tarball correctly at "make dist", this may
-# be the result of tar not creating archives with >99
-# characters of path length.
-EXTRA_DIST = \
- libgphoto2_port.ver
+libgphoto2_port_la_CPPFLAGS += $(LTDLINCL)
+libgphoto2_port_la_LIBADD += $(LIBLTDL)
-EXTRA_DIST += i18n.h
+libgphoto2_port_la_LIBADD += $(INTLLIBS)
+
+libgphoto2_port_la_SOURCES += gphoto2-port-info-list.c
+libgphoto2_port_la_SOURCES += gphoto2-port-info.h
+libgphoto2_port_la_SOURCES += gphoto2-port-log.c
+libgphoto2_port_la_SOURCES += gphoto2-port-version.c
+libgphoto2_port_la_SOURCES += gphoto2-port.c
+libgphoto2_port_la_SOURCES += gphoto2-port-portability.c
+libgphoto2_port_la_SOURCES += gphoto2-port-result.c
+
+libgphoto2_port_la_DEPENDENCIES += $(top_srcdir)/gphoto2/gphoto2-port-version.h
+libgphoto2_port_la_DEPENDENCIES += $(top_srcdir)/gphoto2/gphoto2-port-library.h