Consistently use the libnbcompat header for md5 if this is not a native
[pkgsrc.git] / pkgtools / pkg_install / files / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.52)
3 AC_INIT([pkg_install], [20070804], [joerg@NetBSD.org])
4 AC_CONFIG_SRCDIR([lib/plist.c])
5 AC_CONFIG_HEADER(lib/config.h)
6
7 AC_CANONICAL_HOST
8 CANONICAL_HOST=$host
9 AC_SUBST(CANONICAL_HOST)
10 AC_SUBST(INCLUDES)
11
12 # Checks for programs.
13 AC_PROG_MAKE_SET
14 AC_PROG_CC
15 AC_PROG_INSTALL
16 AC_PROG_LN_S
17 AC_PROG_RANLIB
18 AC_CHECK_PROG(AR, ar, ar)
19
20 AC_PATH_PROG(CHMOD, chmod)
21 AC_PATH_PROG(CMP, cmp)
22 AC_PATH_PROG(CP, cp)
23 AC_PATH_PROG(ENV, env)
24 AC_PATH_PROG(FIND, find)
25 AC_PATH_PROG(GREP, grep)
26 AC_PATH_PROG(LN, ln)
27 AC_PATH_PROG(MKDIR, mkdir)
28 AC_PATH_PROG(RMDIR, rmdir)
29 AC_PATH_PROG(RM, rm)
30 AC_PATH_PROG(SED, sed)
31 AC_PATH_PROG(SORT, sort)
32 AC_PATH_PROG(TOUCH, touch)
33
34 AUTOCONF=${AUTOCONF-"$srcdir/missing --run autoconf"}
35 AC_SUBST(AUTOCONF)
36 AUTOHEADER=${AUTOHEADER-"$srcdir/missing --run autoheader"}
37 AC_SUBST(AUTOHEADER)
38
39 dnl Set the default pkg dbdir
40 AC_ARG_WITH(pkgdbdir,
41 [  --with-pkgdbdir=DIR     Where to put the pkg database (/var/db/pkg)],
42 [ pkgdbdir="$with_pkgdbdir" ],
43 [ pkgdbdir="/var/db/pkg" ])
44 AC_SUBST(pkgdbdir)
45
46 AC_ARG_WITH(pax,
47 [  --with-pax=path         Path to pax (PREFIX/bin/pax)],
48 [ pax="$with_pax" ],
49 [ pax='$(prefix)/bin/pax' ])
50 AC_SUBST(pax)
51
52 AC_ARG_WITH(ssl,
53 [ --with-ssl            Enable OpenSSL based signature support],
54 [ ssl_support=yes ],
55 [ ssl_support= ])
56 AC_SUBST(ssl_support)
57
58 AC_ARG_ENABLE([bootstrap],
59     [AS_HELP_STRING([--enable-bootstrap], [build minimal version of pkg_install])],
60     [bootstrap=yes], [bootstrap=])
61
62 AC_SUBST(bootstrap)
63
64 dnl Checks for libraries.
65 AC_CHECK_LIB(db, __db185_open, , AC_SEARCH_LIBS(dbopen, [db db1]))
66 AC_SEARCH_LIBS(tgetent, [termcap termlib curses ncurses])
67
68 dnl Checks for header files.
69 AC_HEADER_STDC
70 AC_CHECK_HEADERS([assert.h ctype.h dirent.h err.h errno.h fnctl.h \
71         fnmatch.h glob.h grp.h inttypes.h limits.h netdb.h \
72         pwd.h regex.h signal.h stdarg.h stdio.h stdlib.h string.h \
73         termcap.h termios.h time.h unistd.h vis.h])
74 AC_CHECK_HEADERS([db1/db.h db_185.h db.h])
75 AC_CHECK_HEADERS([sys/cdefs.h sys/file.h sys/ioctl.h sys/param.h \
76         sys/poll.h sys/queue.h sys/resource.h sys/signal.h sys/stat.h \
77         sys/statvfs.h sys/time.h sys/types.h sys/utsname.h sys/vfs.h \
78         sys/wait.h])
79
80 # Checks for library functions.
81 AC_CHECK_FUNCS([chflags dbopen __db185_open tgetent vfork])
82 AC_CHECK_FUNCS([getrlimit setrlimit])
83
84 AC_SEARCH_LIBS([gethostbyname], [nsl])
85 AC_SEARCH_LIBS([socket],
86                [socket],
87                [],
88                [AC_CHECK_LIB([socket],
89                              [socket],
90                              [LIBS="-lsocket -lnsl $LIBS"],
91                              [],
92                              [-lnsl])])
93
94 dnl Check for types
95 AC_TYPE_UINT8_T
96 AC_TYPE_UINT16_T
97 AC_TYPE_UINT32_T
98 AC_TYPE_UINT64_T
99
100 need_priu64=no
101 AC_MSG_CHECKING([for a working PRIu64])
102 AC_LANG_PUSH([C])
103 AC_RUN_IFELSE(
104         [AC_LANG_PROGRAM([[
105                 #include <stdio.h>
106                 #ifdef HAVE_INTTYPES_H
107                 #include <inttypes.h>
108                 #endif
109                 ]],
110                 [[
111                 char *x;
112                 #if !defined(PRIu64)
113                         return -1;
114                 #else
115                 x = PRIu64;
116                 if( x[0] == '%' ) {
117                         return -1;
118                 } else {
119                         return 0;
120                 }
121                 #endif
122                 ]])],
123         [
124                 # program worked correctly
125                 AC_MSG_RESULT([yes])
126         ],
127         [
128                 # program failed
129                 AC_MSG_RESULT([no])
130                 AC_DEFINE([NEED_PRI_MACRO], [1], [Defined when PRIu64 is missing or broken])
131                 need_priu64=yes
132         ],
133         [
134                 # we are cross compiling
135                 AC_MSG_RESULT([unable to check when crosscompiling])
136                 AC_DEFINE([NEED_PRI_MACRO], [1], [Defined when PRIu64 is missing or broken])
137                 need_priu64=yes
138         ])
139 AC_LANG_POP([C])
140 AC_CHECK_SIZEOF(int)
141 AC_CHECK_SIZEOF(long)
142 AC_CHECK_SIZEOF(long long)
143
144 case $host in
145 *-*-dragonfly* |*-*-freebsd*)
146         AC_DEFINE([NUMERIC_VERSION_ONLY], [1], [Defined when to retain only the numeric OS version])
147         ;;
148 esac
149
150 AH_BOTTOM(
151 #if !HAVE_VFORK
152 # define vfork fork
153 #endif
154 )
155
156 AC_CONFIG_FILES([Makefile add/Makefile admin/Makefile 
157         audit-packages/Makefile audit-packages/audit-packages.1 \
158         audit-packages/audit-packages.cat1 audit-packages/audit-packages.conf \
159         audit-packages/audit-packages.conf.5 \
160         audit-packages/audit-packages.conf.cat5 \
161         audit-packages/download-vulnerability-list.1 \
162         audit-packages/download-vulnerability-list.cat1 \
163         audit-packages/download-vulnerability-list.sh bpm/bpm.sh \
164         create/Makefile delete/Makefile info/Makefile lib/Makefile \
165         view/Makefile view/linkfarm.sh view/pkg_view.sh])
166 AC_OUTPUT