CHECK_FUNCTION_EXISTS(bzero HAVE_BZERO)
CHECK_FUNCTION_EXISTS(backtrace HAVE_BACKTRACE)
CHECK_FUNCTION_EXISTS(symlink HAVE_SYMLINK)
+CHECK_FUNCTION_EXISTS(lstat HAVE_LSTAT)
# Find gd
CHECK_INCLUDE_FILE(gd.h HAVE_GD_H)
IF(ENABLE_ICONV)
CHECK_INCLUDE_FILE(iconv.h HAVE_ICONV_H)
IF(HAVE_ICONV_H)
+ FIND_PATH(ICONV_INCLUDE_PATH NAMES iconv.h)
+ FIND_LIBRARY(ICONV_LIBRARY NAMES iconv DOC "The ICONV library")
+ IF(ICONV_LIBRARY)
+ TARGET_LINK_LIBRARIES(sarg ${ICONV_LIBRARY})
+ ENDIF(ICONV_LIBRARY)
CHECK_FUNCTION_EXISTS(iconv_open HAVE_ICONV)
- IF(!HAVE_ICONV)
- FIND_PATH(ICONV_INCLUDE_PATH NAMES iconv.h)
- FIND_LIBRARY(ICONV_LIBRARY NAMES iconv DOC "The ICONV library")
- ENDIF(!HAVE_ICONV)
SET(ICONV_CONST_FILE ${CMAKE_BINARY_DIR}/consticonv.c)
FILE(WRITE ${ICONV_CONST_FILE} "
#cmakedefine HAVE_FOPEN64
#cmakedefine HAVE_BACKTRACE
#cmakedefine HAVE_SYMLINK
+#cmakedefine HAVE_LSTAT
#define RLIM_STRING "@RLIM_STRING@"
#define ICONV_CONST @ICONV_CONST@
DIR *dirp;
struct dirent *direntp;
char dname[MAXLEN];
+ int err;
dirp=opendir(dir);
if (!dirp) return;
fprintf(stderr,"SARG: directory name to delete too long: %s/%s\n",dir,direntp->d_name);
exit(1);
}
- if (lstat(dname,&st)) {
+#ifdef HAVE_LSTAT
+ err=lstat(dname,&st);
+#else
+ err=stat(dname,&st);
+#endif
+ if (err) {
fprintf(stderr,"SARG: cannot stat %s\n",dname);
exit(1);
}