# Check for readlinkat.
AC_CHECK_FUNC([readlinkat], [AC_DEFINE(HAVE_READLINKAT, 1)], [])
+# Check for serial_struct.
+AC_CHECK_TYPE([struct serial_struct], [AC_DEFINE(HAVE_SERIAL_STRUCT, 1)],
+ [], [[#include <linux/serial.h>]])
+
saved="$CFLAGS"; CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
__attribute__((visibility("hidden"))) void foo(void) { }
{
char name[PATH_MAX], target[PATH_MAX];
struct dirent entry, *result;
+#ifdef HAVE_SERIAL_STRUCT
struct serial_struct serial_info;
+ int ioctl_result;
+#endif
#ifndef HAVE_READLINKAT
char buf[sizeof(entry.d_name) + 16];
#endif
- int len, fd, ioctl_result;
+ int len, fd;
DIR *dir;
int ret = SP_OK;
DEBUG("open failed, skipping");
continue;
}
+#ifdef HAVE_SERIAL_STRUCT
ioctl_result = ioctl(fd, TIOCGSERIAL, &serial_info);
+#endif
close(fd);
+#ifdef HAVE_SERIAL_STRUCT
if (ioctl_result != 0) {
DEBUG("ioctl failed, skipping");
continue;
DEBUG("port type is unknown, skipping");
continue;
}
+#endif
}
DEBUG("Found port %s", name);
*list = list_append(*list, name);