ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libptytty/ptytty.m4
(Generate patch)

Comparing libptytty/ptytty.m4 (file contents):
Revision 1.24 by sf-exg, Thu May 12 14:17:56 2011 UTC vs.
Revision 1.25 by sf-exg, Thu May 12 16:43:47 2011 UTC

3 3
4AC_DEFUN([PT_FIND_FILE], 4AC_DEFUN([PT_FIND_FILE],
5[AC_CACHE_CHECK(where $1 is located, pt_cv_path_$1, 5[AC_CACHE_CHECK(where $1 is located, pt_cv_path_$1,
6[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> 6[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <sys/stat.h>
8$5 9$5
9#include <errno.h>
10int main() 10int main()
11{ 11{
12 char **path, *list[] = { $4, NULL }; 12 char **path, *list[] = { $4, NULL };
13 FILE *a, *f=fopen("conftestval", "w"); 13 FILE *f = fopen("conftestval", "w");
14 if (!f) exit(1); 14 if (!f) return 1;
15#ifdef $2 15#ifdef $2
16 fprintf(f, "%s\n", $2); 16 fprintf(f, "%s\n", $2);
17 exit(0); 17#elif defined($3)
18#endif
19#ifdef $3
20 fprintf(f, "%s\n", $3); 18 fprintf(f, "%s\n", $3);
21 exit(0); 19#else
22#endif
23 for (path = list; *path; path++) { 20 for (path = list; *path; path++) {
24 if ((a = fopen(*path, "r")) != NULL || errno == EACCES) { 21 struct stat st;
22 if (stat(*path, &st) == 0) {
25 fprintf(f, "%s\n", *path); 23 fprintf(f, "%s\n", *path);
26 exit(0); 24 break;
27 } 25 }
28 } 26 }
29 exit(0); 27#endif
28 return fclose(f) != 0;
30}]])],[pt_cv_path_$1=`cat conftestval`],[pt_cv_path_$1=], 29}]])],[pt_cv_path_$1=`cat conftestval`],[pt_cv_path_$1=],
31[AC_MSG_WARN(Define $2 in config.h manually)])]) 30[AC_MSG_WARN(Define $2 in config.h manually)])])
32if test x$pt_cv_path_$1 != x; then 31if test x$pt_cv_path_$1 != x; then
33 AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define location of $1) 32 AC_DEFINE_UNQUOTED($2, "$pt_cv_path_$1", Define location of $1)
34fi]) 33fi])

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines