/[path-sandbox]/trunk/configure.ac
Gentoo

Contents of /trunk/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


Revision 377 - (hide annotations) (download)
Sun Nov 9 11:08:25 2008 UTC (6 years ago) by vapier
File size: 5933 byte(s)
bump ver to 1.3.x and build lzma tarballs
1 vapier 377 AC_PREREQ([2.61])
2     AC_INIT([sandbox], [1.3.0], [sandbox@gentoo.org])
3 ferringb 2 AM_INIT_AUTOMAKE
4 ferringb 16 AC_CONFIG_HEADER([config.h])
5 ferringb 2
6 vapier 61 dnl Checks for programs.
7 ferringb 2 AC_PROG_CC
8 azarah 29 AC_ISC_POSIX
9     AC_PROG_INSTALL
10     AC_PROG_MAKE_SET
11     AC_PROG_AWK
12 azarah 236 AC_CHECK_PROGS([READELF], [readelf eu-readelf], [false])
13 azarah 29
14 vapier 21 AC_ENABLE_SHARED
15     AC_DISABLE_STATIC
16 vapier 61 dnl Next four lines is a hack to prevent libtool checking for CXX/F77
17 azarah 56 m4_undefine([AC_PROG_CXX])
18     m4_defun([AC_PROG_CXX],[])
19     m4_undefine([AC_PROG_F77])
20     m4_defun([AC_PROG_F77],[])
21 ferringb 2 AC_PROG_LIBTOOL
22    
23     AC_PREFIX_DEFAULT([/usr])
24 azarah 29
25 vapier 61 dnl Checks for libraries.
26     dnl Checks for header files.
27 ferringb 2 AC_FUNC_ALLOCA
28     AC_HEADER_DIRENT
29     AC_HEADER_STDC
30     AC_HEADER_SYS_WAIT
31 vapier 370 AC_CHECK_HEADERS_ONCE([ \
32     dirent.h \
33     dlfcn.h \
34     errno.h \
35     fcntl.h \
36     libgen.h \
37     limits.h \
38     memory.h \
39     signal.h \
40     stdarg.h \
41     stddef.h \
42     stdio.h \
43     stdlib.h \
44     string.h \
45     strings.h \
46     unistd.h \
47     utime.h \
48     sys/file.h \
49     sys/mman.h \
50     sys/param.h \
51     sys/stat.h \
52     sys/time.h \
53     sys/types.h \
54     sys/wait.h \
55 vapier 21 ])
56 ferringb 2
57 vapier 61 dnl Checks for typedefs, structures, and compiler characteristics.
58 ferringb 2 AC_C_CONST
59     AC_TYPE_UID_T
60     AC_TYPE_MODE_T
61     AC_TYPE_SIZE_T
62     AC_CHECK_TYPES([ptrdiff_t])
63    
64 vapier 61 dnl Checks for library functions.
65 ferringb 2 AC_FUNC_CHOWN
66     AC_FUNC_FORK
67     AC_FUNC_LSTAT
68     AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
69     AC_TYPE_SIGNAL
70     AC_FUNC_STAT
71 vapier 21 AC_CHECK_FUNCS([ \
72 vapier 356 bzero ftruncate getcwd lchown memmove \
73     memcpy memset mkdir pathconf realpath \
74     rmdir setenv strcasecmp strchr strdup \
75     strerror strndup strrchr strspn strstr \
76     strtok_r \
77 vapier 21 ])
78 azarah 278 dnl For librcutil
79     AC_CHECK_FUNCS([remove])
80 ferringb 2
81 azarah 278 dnl Check if gcc provides va_copy or __va_copy (for librcutil)
82     AC_MSG_CHECKING([for va_copy])
83     AC_TRY_COMPILE([
84     #include <stdarg.h>
85     ], [
86     va_list ap, aq;
87     va_copy(ap, aq);
88     ],
89     [va_copy="va_copy"],
90     [AC_TRY_COMPILE([
91     #include <stdarg.h>
92     ], [
93     va_list ap, aq;
94     __va_copy(ap, aq);
95     ],
96     [va_copy="__va_copy"],
97     [AC_MSG_ERROR([Unable to determine name of va_copy macro])]
98     )]
99     )
100     AC_MSG_RESULT([$va_copy])
101     if test x"$va_copy" != xva_copy ; then
102     AC_DEFINE_UNQUOTED([va_copy], [$va_copy],
103     [Define to name of va_copy macro proviced by gcc if its not `va_copy'.]
104     )
105     fi
106    
107 vapier 243 dnl Verify people aren't doing stupid shit
108     if test x"$enable_static" != xno ; then
109     AC_MSG_ERROR([dont be a Kumba, building a libsandbox.a is stupid])
110     fi
111     if test x"$enable_shared" != xyes ; then
112     AC_MSG_ERROR([dont be a Kumba, omitting a libsandbox.so is stupid])
113     fi
114     if echo $CFLAGS | $EGREP -e -static >/dev/null 2>&1; then
115     AC_MSG_ERROR([dont be a Kumba, using -static in CFLAGS is stupid])
116     fi
117     if echo $LDFLAGS | $EGREP -e -static >/dev/null 2>&1; then
118     AC_MSG_ERROR([dont be a Kumba, using -static in LDFLAGS is stupid])
119     fi
120    
121 azarah 218 dnl Some libc's like those on bsd have dlopen() in libc, and not libdl
122     AC_CHECK_LIB([dl], [dlopen],
123 azarah 234 [have_libdl="yes"],
124     [have_libdl="no"]
125 azarah 218 )
126     if test x"$have_libdl" = xyes ; then
127 azarah 234 LIBDL="-ldl"
128     AC_SUBST([LIBDL])
129     DL_LIB="dl"
130 azarah 218 else
131 azarah 234 DL_LIB="c"
132     AC_CHECK_LIB([c], [dlopen],
133     [],
134     [AC_MSG_ERROR([Unable to determine library providing dlopen])]
135     )
136 azarah 218 fi
137    
138 vapier 62 dnl uClibc doesn't currently provide dlvsym() so lets
139     dnl verify the toolchain supports it
140 azarah 218 AC_CHECK_LIB([$DL_LIB], [dlvsym],
141 azarah 234 [AC_DEFINE([HAVE_DLVSYM], [1], [libdl supports dlvsym])],
142     [AC_DEFINE([HAVE_DLVSYM], [0], [libdl does not support dlvsym])]
143 vapier 62 )
144    
145 vapier 23 dnl when using libc5, (f)trucate's offset argument type is size_t with
146     dnl libc5, but it's off_t with libc6 (glibc2).
147 azarah 180 AC_MSG_CHECKING([truncate argument type])
148     TRUNC_ARG_TYPE=`echo '#include <unistd.h>' | $CC -E - | grep -q 'truncate.*size_t'`
149     if test "$TRUNC_ARG_TYPE"x != x ; then
150 azarah 234 AC_MSG_RESULT([size_t])
151     AC_DEFINE([TRUNCATE_T], [size_t], [truncate arg type])
152 vapier 23 else
153 azarah 234 AC_MSG_RESULT([off_t])
154     AC_DEFINE([TRUNCATE_T], [off_t], [truncate arg type])
155 vapier 23 fi
156    
157 azarah 220 dnl Check if libc provides RTLD_NEXT
158     AC_MSG_CHECKING([for RTLD_NEXT])
159 azarah 216 AC_TRY_COMPILE([
160 azarah 234 #define _GNU_SOURCE
161     #include <dlfcn.h>
162     ], [
163     #if !defined(RTLD_NEXT)
164     # error no RTLD_NEXT
165     #endif
166     ],
167     [have_rtld_next="yes"],
168     [have_rtld_next="no"]
169 azarah 217 )
170 azarah 220 AC_MSG_RESULT([$have_rtld_next])
171 azarah 235 if test x"$have_rtld_next" = xyes ; then
172 vapier 370 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
173 azarah 235 AC_DEFINE([HAVE_RTLD_NEXT], [1], [Have RTLD_NEXT enabled libc])
174     fi
175 azarah 216
176 vapier 53 dnl we need to handle symbols differently based upon their version,
177     dnl but we have to know which symbols the libc supports first
178 azarah 180 AC_MSG_CHECKING([libc path])
179 vapier 23 echo "int main(void) { return 0; }" > libctest.c
180 vapier 356 $CC $CFLAGS $CPPFLAGS $LDFLAGS -Wl,-verbose -o libctest libctest.c > libctest.log 2>&1
181 vapier 238 cat libctest.log 1>&AS_MESSAGE_LOG_FD
182 vapier 356 LIBC_PATH=$(
183     $AWK '/attempt to open/ { if (($4 ~ /\/libc\.so/) && ($5 == "succeeded")) LIBC = $4; }; END {print LIBC}' libctest.log
184     )
185 azarah 234 rm -f libctest*
186 vapier 239 if test x"$LIBC_PATH" = x || ! test -r "$LIBC_PATH" ; then
187 vapier 238 AC_MSG_ERROR([Unable to determine LIBC PATH ($LIBC_PATH)])
188 vapier 53 fi
189 azarah 180 AC_MSG_RESULT([$LIBC_PATH])
190     AC_SUBST([LIBC_PATH])
191 vapier 23
192 vapier 53 dnl when intercepting libc calls, we have to know the name of the
193     dnl libc to load and search with dl*() calls
194 azarah 180 AC_MSG_CHECKING([libc version])
195 vapier 53 dnl the sed script at the end here looks funny but it's ok ...
196 azarah 234 echo "int main(void) { return 0; }" > libctest.c
197 vapier 356 $CC $CFLAGS $CPPFLAGS $LDFLAGS -Wall -o libctest libctest.c
198     LIBC_VERSION=$(
199     $READELF -d libctest | \
200     grep NEEDED.*libc\\.so | \
201     $AWK '{print $NF}' | sed -e ['s:\[::' -e 's:\]::']
202     )
203 azarah 234 rm -f libctest*
204 vapier 53 if test "$LIBC_VERSION"x = x ; then
205 azarah 234 AC_MSG_ERROR([Unable to determine LIBC VERSION])
206 vapier 53 fi
207 azarah 180 AC_MSG_RESULT([$LIBC_VERSION])
208 azarah 233 AC_DEFINE_UNQUOTED([LIBC_VERSION], ["$LIBC_VERSION"], [Name of libc to hook into])
209 vapier 53
210 vapier 356 dnl We add to CPPFLAGS rather than doing AC_DEFINE_UNQUOTED
211     dnl so we dont have to worry about fully expanding all of
212     dnl the variables ($sysconfdir defaults to "$prefix/etc")
213 azarah 309 SANDBOX_DEFINES='-DETCDIR="\"$(sysconfdir)\"" -DLIBSANDBOX_PATH="\"$(libdir)\"" -DSANDBOX_BASHRC_PATH="\"$(pkgdatadir)\""'
214     AC_SUBST([SANDBOX_DEFINES])
215    
216 azarah 183 AC_OUTPUT([
217 vapier 356 Makefile
218     scripts/Makefile
219     etc/Makefile
220     data/Makefile
221     libsbutil/Makefile
222     libsandbox/Makefile
223     src/Makefile
224 azarah 183 ])

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20