--- reiserfsprogs-3.6.11/configure.in.ori 2003-08-01 17:49:31.000000000 +0200 +++ reiserfsprogs-3.6.11/configure.in 2003-11-21 11:39:14.000000000 +0100 @@ -18,7 +18,7 @@ dnl Checks for programs. AC_PROG_RANLIB -dnl AC_PROG_AWK +AC_PROG_AWK dnl AC_PROG_INSTALL dnl AC_PROG_LN_S @@ -50,78 +50,41 @@ fi ]) -AC_DEFUN(AC_PREPARE_CREDITS, -[ - -AC_MSG_CHECKING(for CREDITS) - -AC_TRY_RUN([ -#define _GNU_SOURSE -#include -#include -#include - -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++; +credits="./CREDITS" +AC_MSG_CHECKING(for $credits) +if test -r $credits ; then + AC_MSG_RESULT(yes) +else + AC_MSG_ERROR(Missing file $credits) +fi + +$AWK [' +BEGIN {in_header = 1; start = 2; count = 0} + +{ + if (in_header) { + print $0 + if ($0 == "") { + in_header = 0; + printf "char *credits[] = {\n" + } } 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; + if (($0 == "") || (length($0) < 1)) { + start = 1; + count++; + } else { + if (!start) + printf "\t\\\n" + else if (start == 1) + printf ",\n\n" + printf "\t\"" $0 "\\n\"" + start = 0; + } + } } -], AC_MSG_RESULT(yes), AC_MSG_RESULT(no) ; exit) -]) -AC_PREPARE_CREDITS() +END { print "\n};\n#define CREDITS_COUNT " count } +'] $credits > include/credits.h AC_OUTPUT( include/Makefile