forked from laurenz/pgreplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
79 lines (68 loc) · 2.55 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.62])
AC_INIT([pgreplay], [1.4.0], [https://github.com/laurenz/pgreplay/issues], [pgreplay], [http://laurenz.github.io/pgreplay/])
AC_CONFIG_SRCDIR([parse.c])
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_BUILD
# Checks for programs.
AC_PROG_INSTALL
AC_PROG_CC([gcc cc])
# add -Wall to CFLAGS for gcc
if test "$GCC" = yes; then CFLAGS="-Wall $CFLAGS"; fi
# check if ld supports -rpath
AC_MSG_CHECKING([whether the linker supports -rpath])
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/lib"
AC_LINK_IFELSE([AC_LANG_SOURCE([[main() {}]])], [rpath=yes], [rpath=no])
LDFLAGS="$save_LDFLAGS"
AC_MSG_RESULT([$rpath])
AC_ARG_WITH([postgres],
[AS_HELP_STRING([--with-postgres=DIR],
[specify location of pg_config for your PostgreSQL installation])],
[if ! test -x "$with_postgres"/pg_config; then
echo "*** pg_config not found in '$with_postgres'" 1>&2
exit 1
fi
pgbindir=`"$with_postgres"/pg_config --bindir`
AC_SUBST([pgbindir])
if test $build_os = mingw32; then pglibdir="$pgbindir"; else pglibdir=`"$with_postgres"/pg_config --libdir`; fi
pgincludedir=`"$with_postgres"/pg_config --includedir`
LDFLAGS="$LDFLAGS -L$pglibdir"
if test $rpath = yes; then LDFLAGS="$LDFLAGS -Wl,-rpath,$pglibdir"; fi
CFLAGS="$CFLAGS -I$pgincludedir"
PATH=`"$with_postgres"/pg_config --bindir`:$PATH])
# Install with PostgreSQL by default
AC_PREFIX_PROGRAM(pg_config)
# Checks for libraries.
AC_CHECK_LIB([pq], [PQsendPrepare], [], [AC_MSG_ERROR([
*** cannot locate PostgreSQL client library
*** required is version 8.0 or better
])])
# special Windows settings
if test $build_os = mingw32; then
AC_SUBST([EXTRA_OBJS], [windows.o])
# assume socks library is present
# we have a problem using AC_CHECK_LIB because the function is __stdcall
LIBS="$LIBS -lwsock32"
fi
# Checks for header files.
AC_HEADER_TIME
AC_CHECK_HEADERS([fcntl.h netinet/in.h stdint.h stdlib.h string.h sys/time.h unistd.h inttypes.h])
AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([PostgreSQL header files not found])], [/* dummy */])
# Checks for typedefs, structures, and compiler characteristics.
AC_SYS_LARGEFILE
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT64_T
AC_TYPE_UINT32_T
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned short)
AC_C_BIGENDIAN
# Checks for library functions.
AC_FUNC_STRTOD
AC_CHECK_FUNCS([gettimeofday select setenv strchr strtoul])
AC_CONFIG_FILES([Makefile test/runtest.sh])
AC_OUTPUT
chmod u+x test/runtest.sh