summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2008-11-12 12:48:58 +0100
committerSimon Josefsson <simon@josefsson.org>2008-11-12 12:48:58 +0100
commitb2207f997cf59bd36160330244e943dcc69a3b64 (patch)
tree79ba079caba7d1fd07bb38013a3a3cfeac119dae /m4
parent69a940236433a3c7a082c35f42fe49c7bac0f69c (diff)
downloadlibtasn1-b2207f997cf59bd36160330244e943dcc69a3b64.tar.gz
libtasn1-b2207f997cf59bd36160330244e943dcc69a3b64.tar.bz2
libtasn1-b2207f997cf59bd36160330244e943dcc69a3b64.zip
Split up operations into external M4 files.
Diffstat (limited to 'm4')
-rw-r--r--m4/linker-script.m429
-rw-r--r--m4/update-header-version.m424
-rw-r--r--m4/valgrind.m430
3 files changed, 83 insertions, 0 deletions
diff --git a/m4/linker-script.m4 b/m4/linker-script.m4
new file mode 100644
index 0000000..edf0469
--- /dev/null
+++ b/m4/linker-script.m4
@@ -0,0 +1,29 @@
+# linker-script.m4 serial 1
+dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# sj_LINKER_SCRIPT()
+# -------------
+# Check if ld supports linker scripts, and define automake conditional
+# HAVE_LD_VERSION_SCRIPT if so.
+AC_DEFUN([sj_LINKER_SCRIPT],
+[
+ AC_ARG_ENABLE([ld-version-script],
+ AS_HELP_STRING([--enable-ld-version-script],
+ [enable/disable linker version script (default is enabled when possible)]),
+ [have_ld_version_script=$enableval], [])
+ if test -z "$have_ld_version_script"; then
+ AC_MSG_CHECKING([if -Wl,--version-script works])
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,--version-script=$srcdir/lib/libtasn1.vers"
+ AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
+ [have_ld_version_script=yes], [have_ld_version_script=no])
+ LDFLAGS="$save_LDFLAGS"
+ AC_MSG_RESULT($have_ld_version_script)
+ fi
+ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
+])
diff --git a/m4/update-header-version.m4 b/m4/update-header-version.m4
new file mode 100644
index 0000000..5a370dd
--- /dev/null
+++ b/m4/update-header-version.m4
@@ -0,0 +1,24 @@
+# update-header-version.m4 serial 1
+dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# sj_UPDATE_HEADER_VERSION(HEADER-FILE)
+# -------------
+# Update version number in HEADER-FILE. It searches for '_VERSION ".*"'
+# and replaces the .* part with the $PACKAGE_VERSION.
+AC_DEFUN([sj_UPDATE_HEADER_VERSION],
+[
+ # Update version number in lib/libtasn1.h.
+ if ! sed 's/_VERSION ".*"/_VERSION "'$PACKAGE_VERSION'"/' $1 > fixhdr.tmp; then
+ AC_MSG_ERROR([[*** Failed to update version number in $1...]])
+ fi
+ if cmp -s $1 fixhdr.tmp 2>/dev/null; then
+ rm -f fixhdr.tmp
+ elif ! mv fixhdr.tmp $1; then
+ AC_MSG_ERROR([[*** Failed to move fixhdr.tmp to $1...]])
+ fi
+])
diff --git a/m4/valgrind.m4 b/m4/valgrind.m4
new file mode 100644
index 0000000..0cd106a
--- /dev/null
+++ b/m4/valgrind.m4
@@ -0,0 +1,30 @@
+# valgrind.m4 serial 1
+dnl Copyright (C) 2008 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# sj_VALGRIND()
+# -------------
+# Check if valgrind is available, and set VALGRIND to it if available.
+AC_DEFUN([sj_VALGRIND],
+[
+ # Run self-tests under valgrind?
+ if test "$cross_compiling" = no; then
+ AC_CHECK_PROGS(VALGRIND, valgrind)
+ fi
+ if test -n "$VALGRIND" && $VALGRIND true > /dev/null 2>&1; then
+ opt_valgrind_tests=yes
+ else
+ opt_valgrind_tests=no
+ VALGRIND=
+ fi
+ AC_MSG_CHECKING([whether self tests are run under valgrind])
+ AC_ARG_ENABLE(valgrind-tests,
+ AS_HELP_STRING([--enable-valgrind-tests],
+ [run self tests under valgrind]),
+ opt_valgrind_tests=$enableval)
+ AC_MSG_RESULT($opt_valgrind_tests)
+])