aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac45
1 files changed, 39 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 4474d40..790329c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,11 +4,40 @@ AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE
+
+if test -z "$CFLAGS"; then
+ CFLAGS="-Os"
+fi
+
+AC_CANONICAL_HOST
AC_PROG_CC
AC_PROG_CC_STDC
+AC_PROG_INSTALL
AC_TYPE_SIZE_T
+# check for spectre mitigation
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mindirect-branch=thunk"
+AC_MSG_CHECKING([if ${CC} supports -mindirect-branch=thunk spectre mitigation])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
+ [ AC_MSG_RESULT([yes])
+ SPECTRE_MIT="-mindirect-branch=thunk" ],
+ AC_MSG_RESULT([no]))
+CFLAGS="$saved_CFLAGS"
+AC_SUBST(SPECTRE_MIT)
+
+# check for -fvisibility=hidden compiler support (GCC >= 4)
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
+AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden -fvisibility-inlines-hidden])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
+ [ AC_MSG_RESULT([yes])
+ SYMBOL_VISIBILITY="-fvisibility=hidden" ],
+ AC_MSG_RESULT([no]))
+CFLAGS="$saved_CFLAGS"
+AC_SUBST(SYMBOL_VISIBILITY)
+
AC_CHECK_LIB(socket, connect)
AC_CHECK_LIB(pthread, pthread_create)
@@ -16,14 +45,18 @@ PKG_CHECK_MODULES([libssh], [libssh >= 0.7.3])
AC_SUBST([libssh_CFLAGS])
AC_SUBST([libssh_LIBS])
-dnl Check for header files that do not exist on all platforms
+dnl Check for std header files
+AC_CHECK_HEADERS([stdio.h stdlib.h unistd.h string.h ctype.h assert.h sched.h signal.h errno.h])
+
+dnl Check for system specific header files
+AC_CHECK_HEADERS([pty.h linux/capability.h sys/types.h sys/wait.h sys/stat.h])
AC_CHECK_HEADERS([libutil.h pthread.h pty.h strings.h syslog.h sys/prctl.h \
- sys/uio.h util.h])
+ sys/uio.h poll.h sys/epoll.h util.h])
-dnl Most systems require linking against libutil.so in order to get login_tty()
-AC_CHECK_FUNCS(login_tty, [],
- [AC_CHECK_LIB(util, login_tty,
+dnl Most systems require linking against libutil.so in order to get forkpty()
+AC_CHECK_FUNCS(forkpty, [],
+ [AC_CHECK_LIB(util, forkpty,
[LIBS="-lutil $LIBS"
- AC_DEFINE(HAVE_LOGIN_TTY)])])
+ AC_DEFINE(HAVE_FORKPTY)])])
AC_OUTPUT(Makefile src/Makefile)