summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2017-03-29 23:26:45 +0200
committerGitHub <noreply@github.com>2017-03-29 23:26:45 +0200
commitf149b6247538f9820be1e8c43d2600e446f8f105 (patch)
tree466ab42931644a4e635d8ab7488af2c83cd9a704
parent3f6179a1fd0ff1a8d27b5e68bef05cda7581c447 (diff)
parentc98f1cd25a4e9bdd48e3fe463e04b347fd3b7ccc (diff)
Merge pull request #66 from rofl0r/configure_trim
Configure trim
-rw-r--r--configure.ac40
-rw-r--r--m4macros/Makefile.am3
-rw-r--r--m4macros/typecheck.m4103
-rw-r--r--src/common.h155
-rw-r--r--src/log.h11
5 files changed, 48 insertions, 264 deletions
diff --git a/configure.ac b/configure.ac
index 3990c2f..10036ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,48 +161,17 @@ dnl
AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([sys/ioctl.h sys/mman.h sys/resource.h \
- sys/select.h sys/socket.h sys/time.h sys/uio.h \
- sys/un.h arpa/inet.h netinet/in.h \
- assert.h ctype.h errno.h fcntl.h grp.h io.h libintl.h \
- netdb.h pwd.h regex.h signal.h stdarg.h stddef.h stdio.h \
- sysexits.h syslog.h time.h wchar.h wctype.h \
+AC_CHECK_HEADERS([sys/ioctl.h alloca.h memory.h malloc.h sysexits.h \
values.h])
-dnl OpenBSD machines don't like having malloc included (even if it's present)
-dnl as they expect you to use stdlib.h
-case "$target" in
- *-openbsd*) ;;
- *) AC_CHECK_HEADER(malloc.h);;
-esac
-
-
-dnl Checks for types
-AC_TYPE_SIZE_T
-AC_TYPE_PID_T
-AC_UNP_CHECK_TYPE(uint8_t, unsigned char)
-AC_UNP_CHECK_TYPE(int16_t, short)
-AC_UNP_CHECK_TYPE(uint16_t, unsigned short)
-AC_UNP_CHECK_TYPE(int32_t, int)
-AC_UNP_CHECK_TYPE(uint32_t, unsigned int)
-AC_UNP_CHECK_TYPE(ssize_t, int)
-AC_UNP_CHECK_TYPE(socklen_t, unsigned int)
-AC_UNP_CHECK_TYPE(in_addr_t, uint32_t)
-
-
dnl Checks for libary functions
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
-AC_CHECK_FUNCS([gethostname inet_ntoa memchr memset select socket strcasecmp \
- strchr strdup strerror strncasecmp strpbrk strstr strtol])
-AC_CHECK_FUNCS([isascii memcpy memmove setrlimit ftruncate regcomp regexec])
+AC_CHECK_FUNCS([inet_ntoa strdup])
AC_CHECK_FUNCS([strlcpy strlcat setgroups])
-AC_CHECK_FUNCS([time rand srand])
-
-
dnl Enable extra warnings
DESIRED_FLAGS="-fdiagnostics-show-option -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wfloat-equal -Wundef -Wformat=2 -Wlogical-op -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Waggregate-return -Winit-self -Wpacked --std=c89 -ansi -pedantic -Wno-overlength-strings -Wc++-compat -Wno-long-long -Wno-overlength-strings -Wdeclaration-after-statement -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-qual -Wcast-align -Wwrite-strings -Wp,-D_FORTIFY_SOURCE=2 -fno-common"
@@ -230,11 +199,6 @@ dnl
dnl Make sure we can actually handle the "--with-*" and "--enable-*" stuff.
dnl
-dnl Handle the REGEX library
-if test x"$ac_cv_func_regexec" != x"yes"; then
- AC_MSG_ERROR([Could not locate the regexec() function])
-fi
-
dnl
dnl Substitute the variables into the various Makefiles
dnl
diff --git a/m4macros/Makefile.am b/m4macros/Makefile.am
index de54db6..b9a2ac2 100644
--- a/m4macros/Makefile.am
+++ b/m4macros/Makefile.am
@@ -1,4 +1,3 @@
EXTRA_DIST = \
as-compiler-flag.m4 \
- argenable.m4 \
- typecheck.m4
+ argenable.m4
diff --git a/m4macros/typecheck.m4 b/m4macros/typecheck.m4
deleted file mode 100644
index a8a88b4..0000000
--- a/m4macros/typecheck.m4
+++ /dev/null
@@ -1,103 +0,0 @@
-dnl Taken from Unix Network Programming, W. Richard Stevens
-
-dnl ##################################################################
-dnl We cannot use the AC_CHECK_TYPE macros becasue AC_CHECK_TYPE
-dnl #includes only <sys/types.h>, <stdlib.h>, and <stddef.h>.
-dnl Unfortunately, many implementations today hide typedefs in wierd
-dnl locations: Solaris 2.5.1 has uint8_t and uint32_t in <pthread.h>.
-dnl SunOS 4.1.x has int8_t in <sys/bittypes.h>.
-dnl So we define our own macro AC_UNP_CHECK_TYPE that does the same
-dnl #includes as "unp.h", and then looks for the typedef.
-dnl
-dnl This macro should be invoked after all the header checks have been
-dnl performed, since we #include "confdefs.h" below, and then use the
-dnl HAVE_foo_H values that is can #define.
-dnl
-AC_DEFUN([AC_UNP_CHECK_TYPE],
- [AC_MSG_CHECKING(if $1 defined)
- AC_CACHE_VAL(ac_cv_type_$1,
- [AC_TRY_COMPILE(
-[
-#include "confdefs.h" /* the header built by configure so far */
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-# include <arpa/inet.h>
-#endif
-#ifdef HAVE_ERRNO_H
-# include <errno.h>
-#endif
-#ifdef HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-#ifdef HAVE_NETDB_H
-# include <netdb.h>
-#endif
-#ifdef HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-#ifdef HAVE_STDIO_H
-# include <stdio.h>
-#endif
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-#ifdef HAVE_STRING_H
-# include <string.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_UIO_H
-# include <sys/uio.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-#ifdef HAVE_SYS_UN_H
-# include <sys/un.h>
-#endif
-#ifdef HAVE_SYS_SELECT_H
-# include <sys/select.h>
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#ifdef HAVE_SYS_IOCTL_H
-# include <sys/ioctl.h>
-#endif
-#ifdef HAVE_SYS_FILIO_H
-# include <sys/filio.h>
-#endif
-#ifdef HAVE_SYS_SOCKIO_H
-# include <sys/sockio.h>
-#endif
-#ifdef HAVE_PTHREAD_H
-# include <pthread.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-],
- [ $1 foo ],
- [ac_cv_type_$1=yes],
- [ac_cv_type_$1=no])])
- AC_MSG_RESULT([$ac_cv_type_$1])
- if test $ac_cv_type_$1 = no ; then
- AH_TEMPLATE([$1], [Defined with the proper type.])
- AC_DEFINE($1, $2)
- fi
-]) \ No newline at end of file
diff --git a/src/common.h b/src/common.h
index 89a054f..47a1ed1 100644
--- a/src/common.h
+++ b/src/common.h
@@ -32,134 +32,67 @@
/*
* Include standard headers which are used through-out tinyproxy
*/
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_VALUES_H
-# include <values.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#ifdef HAVE_STDDEF_H
-# include <stddef.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_SYS_IOCTL_H
-# include <sys/ioctl.h>
-#endif
-#ifdef HAVE_SYS_SELECT_H
+/* standard C headers - we can safely assume they exist. */
+#include <stddef.h>
+#include <stdint.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+/* standard POSIX headers - they need to be there as well. */
+# include <errno.h>
+# include <fcntl.h>
+# include <netdb.h>
+# include <signal.h>
+# include <stdarg.h>
+# include <strings.h>
+# include <syslog.h>
+# include <wchar.h>
+# include <wctype.h>
+# include <sys/mman.h>
# include <sys/select.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
-#endif
-
-#ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif
-
-#ifdef HAVE_SYS_RESOURCE_H
-# include <sys/resource.h>
-#endif
-#ifdef HAVE_SYS_UIO_H
+# include <sys/types.h>
+# include <sys/wait.h>
# include <sys/uio.h>
-#endif
-#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
+# include <sys/time.h>
+# include <time.h>
+# include <inttypes.h>
+# include <sys/resource.h>
# include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
+# include <assert.h>
# include <arpa/inet.h>
+# include <grp.h>
+# include <pwd.h>
+# include <regex.h>
+
+/* rest - some oddball headers */
+#ifdef HAVE_VALUES_H
+# include <values.h>
#endif
+
+#ifdef HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif
+
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#endif
-#ifdef HAVE_ASSERT_H
-# include <assert.h>
-#endif
-#ifdef HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-#ifdef HAVE_ERRNO_H
-# include <errno.h>
-#endif
-#ifdef HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-#ifdef HAVE_GRP_H
-# include <grp.h>
-#endif
+
#ifdef HAVE_MEMORY_H
# include <memory.h>
#endif
-#ifdef HAVE_NETDB_H
-# include <netdb.h>
-#endif
-#ifdef HAVE_PWD_H
-# include <pwd.h>
-#endif
-#ifdef HAVE_REGEX_H
-# include <regex.h>
-#endif
-#ifdef HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-#ifdef HAVE_STDARG_H
-# include <stdarg.h>
-#endif
-#ifdef HAVE_STDIO_H
-# include <stdio.h>
-#endif
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#else
-# ifdef HAVE_MALLOC_H
-# include <malloc.h>
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
+
+#ifdef HAVE_MALLOC_H
+# include <malloc.h>
#endif
+
#ifdef HAVE_SYSEXITS_H
-# include <sysexits.h>
-#endif
-#ifdef HAVE_SYSLOG_H
-# include <syslog.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef HAVE_WCHAR_H
-# include <wchar.h>
-#endif
-#ifdef HAVE_WCTYPE_H
-# include <wctype.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-# include <sys/mman.h>
+# include <sysexits.h>
#endif
/*
diff --git a/src/log.h b/src/log.h
index b523ab0..68c89c3 100644
--- a/src/log.h
+++ b/src/log.h
@@ -77,16 +77,7 @@
* don't advocate this, but it could be useful at times.)
*/
-#ifdef HAVE_SYSLOG_H
-# include <syslog.h>
-#else
-# define LOG_CRIT 2
-# define LOG_ERR 3
-# define LOG_WARNING 4
-# define LOG_NOTICE 5
-# define LOG_INFO 6
-# define LOG_DEBUG 7
-#endif
+#include <syslog.h>
#define LOG_CONN 8 /* extra to log connections without the INFO stuff */