summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorFabian Groffen2011-01-25 21:40:46 +0100
committerKarel Zak2011-01-31 15:51:06 +0100
commita804f444eb6c0a5232e37db3a58193fa2a549cd9 (patch)
tree027336f80ef190d98ce6c95662f5833b1ebad9af /configure.ac
parentbuild-sys: enable lsblk and libmount for Linux only (diff)
downloadkernel-qcow2-util-linux-a804f444eb6c0a5232e37db3a58193fa2a549cd9.tar.gz
kernel-qcow2-util-linux-a804f444eb6c0a5232e37db3a58193fa2a549cd9.tar.xz
kernel-qcow2-util-linux-a804f444eb6c0a5232e37db3a58193fa2a549cd9.zip
provide a workaround if program_invocation_short_name is missing
Try some replacements, such as getexecname() on Solaris and __progname on BSDs and Darwin. When not found, base program_invocation_short_name on the source filename it is used in, as not to require argv[0] to be passed along. This latter approach is not dynamic, but doesn't require code changes for all places where program_invocation_short_name is used now. Signed-off-by: Fabian Groffen <grobian@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac16
1 files changed, 16 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 59b55ea09..f27ba3e18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -191,6 +191,7 @@ AC_CHECK_FUNCS(
strtoull \
sysconf \
getdtablesize \
+ getexecname \
getrlimit \
srandom \
setresgid \
@@ -248,6 +249,21 @@ no:no)
esac
+AC_MSG_CHECKING(whether program_invocation_short_name is defined)
+AC_TRY_COMPILE([#include <argp.h>],
+ [program_invocation_short_name = "test";],
+ AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME, 1,
+ [Define if program_invocation_short_name is defined])
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no))
+
+AC_MSG_CHECKING([whether __progname is defined])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char *__progname;],
+ [if (*__progname == 0) return;])],
+ AC_DEFINE(HAVE___PROGNAME, 1, [Define if __progname is defined])
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no))
+
dnl Static compilation
m4_define([UTIL_STATIC_PROGRAMS], [losetup, mount, umount, fdisk, sfdisk, blkid])