-
Notifications
You must be signed in to change notification settings - Fork 42
/
configure.ac
139 lines (126 loc) · 4.08 KB
/
configure.ac
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
AC_PREREQ([2.61])
AC_INIT([pkgin], [23.12.0], [https://github.com/NetBSDfr/pkgin/issues])
AC_CONFIG_SRCDIR([actions.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AM_MAINTAINER_MODE([enable])
AM_SILENT_RULES([yes])
# Code is written to a C99 baseline.
: ${CFLAGS="-std=c99 -g -O2"}
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
#
# Enable some useful compiler warnings if running in maintainer mode. Note
# that maintainer mode is explicitly disabled in the pkgsrc build to avoid
# user failures (the bug reports are nice, the user experience is not).
#
AS_IF([test "x$USE_MAINTAINER_MODE" = "xyes"],
CFLAGS="$CFLAGS -Werror -Wall -Wextra -Wunused -Wno-unused-parameter"
)
#
# --with-dbdir=/path/to/pkgin/db
#
AC_ARG_WITH([dbdir],
[AS_HELP_STRING([--with-dbdir=DIR],
[Path to pkgin database directory])],
[PKGIN_DBDIR="$withval"],
[AC_MSG_ERROR([--with-dbdir is mandatory])]
)
AC_SUBST(PKGIN_DBDIR)
#
# Check for required libraries. All of them accept --with-*=DIR arguments
# so that we can be specific about which one to use.
#
AC_ARG_WITH([libarchive],
[AS_HELP_STRING([--with-libarchive=DIR],
[Root libarchive directory (e.g. /usr/local)])],
[CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"]
)
AC_CHECK_HEADER([archive.h],[],[AC_MSG_FAILURE([can't find archive.h])])
AC_CHECK_LIB([archive],[archive_read_new],[],
[AC_MSG_FAILURE([can't find libarchive])]
)
AC_ARG_WITH([libfetch],
[AS_HELP_STRING([--with-libfetch=DIR],
[Root libfetch directory (e.g. /usr/local)])],
[CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"]
)
AC_CHECK_HEADER([fetch.h],[],[AC_MSG_FAILURE([can't find fetch.h])])
dnl
dnl This is a bit silly. I can't find a way to try both with and without
dnl OpenSSL libraries in the same check, so we're forced to look for two
dnl different symbols (to avoid the cache).
dnl
AC_CHECK_LIB([fetch],[fetchMakeURL],[],
[AC_CHECK_LIB([fetch],[fetchParseURL],
[LIBS="$LIBS -lfetch -lcrypto -lssl"],
[AC_MSG_FAILURE([can't find libfetch])],
[-lcrypto -lssl]
)]
)
AC_ARG_WITH([sqlite3],
[AS_HELP_STRING([--with-sqlite3=DIR],
[Root sqlite3 directory (e.g. /usr/local)])],
[CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"]
)
AC_CHECK_HEADER([sqlite3.h],[],[AC_MSG_FAILURE([can't find sqlite3.h])])
AC_CHECK_LIB([sqlite3],[sqlite3_open_v2],[],
[AC_MSG_FAILURE([can't find libsqlite3])]
)
#
# --with-machine-arch=MACHINE_ARCH
#
AC_ARG_WITH([machine-arch],
[AS_HELP_STRING([--with-machine-arch=ARCH],
[Target MACHINE_ARCH])],
[MACHINE_ARCH="$withval"],
[AC_MSG_ERROR([--with-machine-arch is mandatory])]
)
AC_SUBST(MACHINE_ARCH)
#
# --with-pkg-install=/path/to/pkg_install/sbin
#
AC_ARG_WITH([pkg-install],
[AS_HELP_STRING([--with-pkg-install=DIR],
[Path to pkg_install commands (e.g. /usr/pkg/sbin)])],
[PKG_INSTALL_DIR="$withval"],
[AC_MSG_ERROR([--with-pkg-install is mandatory])]
)
AC_SUBST(PKG_INSTALL_DIR)
#
# There is no real merit in testing for lots of different library functions and
# headers if they're essential anyway. It's unlikely we will want to support
# esoteric environments.
#
# The only functions we test for are those that are non-portable, and for which
# we provide compat functions for environments where they are not available.
#
AC_CHECK_FUNC([humanize_number],
AM_CONDITIONAL([HAVE_HUMANIZE_NUMBER], true),
# May also be in libutil
[AC_SEARCH_LIBS([humanize_number], [util],
AM_CONDITIONAL(HAVE_HUMANIZE_NUMBER, true),
AM_CONDITIONAL(HAVE_HUMANIZE_NUMBER, false)
)]
)
AC_CHECK_HEADERS([util.h bsd/libutil.h libutil.h])
AC_CHECK_HEADERS([sys/termios.h termios.h])
#
# Tests for library functions that may exist outside of libc.
#
AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([inet_addr], [nsl])
#
# Check for high-resolution timestamps in struct stat (from libarchive).
#
AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX
AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64
AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd
AC_CONFIG_FILES([Makefile])
AC_OUTPUT