strtoull \
sysconf \
getdtablesize \
+ getexecname \
getrlimit \
srandom \
setresgid \
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])
}
#endif
+#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
+# ifdef HAVE___PROGNAME
+extern char *__progname;
+# define program_invocation_short_name __progname
+# else
+# include <string.h>
+# ifdef HAVE_GETEXECNAME
+# include <stdlib.h>
+# define program_invocation_short_name \
+ prog_inv_sh_nm_from_file(getexecname(), 0)
+# else
+# define program_invocation_short_name \
+ prog_inv_sh_nm_from_file(__FILE__, 1)
+# endif
+static char prog_inv_sh_nm_buf[256];
+static inline char *
+prog_inv_sh_nm_from_file(char *f, char stripext)
+{
+ char *t;
+
+ if ((t = strrchr(f, '/')) != NULL)
+ t++;
+ else
+ t = f;
+
+ strncpy(prog_inv_sh_nm_buf, t, sizeof(prog_inv_sh_nm_buf) - 1);
+ prog_inv_sh_nm_buf[sizeof(prog_inv_sh_nm_buf) - 1] = '\0';
+
+ if (stripext && (t = strrchr(prog_inv_sh_nm_buf, '.')) != NULL)
+ *t = '\0';
+
+ return prog_inv_sh_nm_buf;
+}
+# endif
+#endif
+
#endif /* UTIL_LINUX_C_H */