blob: c91ad6c39cb7916bcc9255e008ea35c7a7ba95c4 [file] [log] [blame]
dnl Process this file with autoconf to produce a configure script.
AC_INIT(version.h)
AM_INIT_AUTOMAKE(reiserfsprogs, 3.6.9)
dnl We install in /sbin, the utils are to be available on boot
dnl AC_PREFIX(/)
AM_CONFIG_HEADER(include/config.h)
AC_SUBST(sbindir)
PRESET_CFLAGS=$CFLAGS
AC_PROG_CC
if test "x" = "x$PRESET_CFLAGS"; then
CFLAGS="${RPM_OPT_FLAGS} $CFLAGS -Wall"
fi
dnl Checks for programs.
AC_PROG_RANLIB
dnl AC_PROG_AWK
dnl AC_PROG_INSTALL
dnl AC_PROG_LN_S
dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/ioctl.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_STRUCT_ST_RDEV
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strerror strstr strtol)
dnl Never enable this. It is for debugging only
AC_ARG_ENABLE(io-failure-emulation,
[ --enable-io-failure-emulation Never use that. It is for debugging only],
[ if test "$enableval" = "yes" ; then
echo -e "\nCarefull! IO failure emulation is ON\n"
AC_DEFINE(IO_FAILURE_EMULATION, 1, [gets set when configure --enable-io-failure-emulation])
fi
])
AC_DEFUN(AC_PREPARE_CREDITS,
[
AC_MSG_CHECKING(for CREDITS)
AC_TRY_RUN([
#define _GNU_SOURSE
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main (void) {
FILE *fin, *fout;
char *line = NULL;
unsigned int len = 0;
int start, count;
if ((fin = fopen("CREDITS", "r")) == NULL) {
fprintf(stderr, "Error occured while openning the file 'CREDITS': "
"%s.\n", strerror(errno));
return 1;
}
if ((fout = fopen("include/credits.h", "w")) == NULL) {
fprintf(stderr, "Error occured while openning the file 'credits.h': "
"%s.\n", strerror(errno));
return 1;
}
/* Replicate the header. */
while (getline(&line, &len, fin) != -1) {
fprintf(fout, line);
if (!strcmp(line, "\n"))
break;
}
fprintf(fout, "char *credits[] = {\n");
start = 2; count = 0;
while (getline(&line, &len, fin) != -1) {
if (!strcmp(line, "\n") || strlen(line) < 1) {
start = 1;
count++;
} else {
if (!start)
fprintf(fout, "\t\\\" "\n");
else if (start == 1)
fprintf(fout, ",\n\n");
line[strlen(line) - 1] = 0;
fprintf(fout, "\t\"%s\\\n\"", line);
start = 0;
}
}
fprintf(fout, "\n};\n");
fprintf(fout, "#define CREDITS_COUNT %d\n", count);
free(line);
fclose(fin);
fclose(fout);
return 0;
}
], AC_MSG_RESULT(yes), AC_MSG_RESULT(no) ; exit)
])
AC_PREPARE_CREDITS()
AC_OUTPUT(
include/Makefile
mkreiserfs/Makefile
resize_reiserfs/Makefile
fsck/Makefile
lib/Makefile
Makefile
reiserfscore/Makefile
debugreiserfs/Makefile
tune/Makefile
tests/Makefile
tests/PROGS/Makefile)