File: configure.in

package info (click to toggle)
fakeroot 0.4.4-9.2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 696 kB
  • ctags: 173
  • sloc: sh: 7,643; ansic: 711; cpp: 312; makefile: 120
file content (202 lines) | stat: -rw-r--r-- 5,590 bytes parent folder | download | duplicates (2)
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
dnl Process this file with autoconf to produce a configure script.
AC_INIT(libfakeroot.c)

AC_CANONICAL_SYSTEM


AM_INIT_AUTOMAKE(fakeroot, 0.4.4.2)

dnl AM_CONFIG_HEADER(config.h)

LIBTOOL=libtool

AM_PROG_LIBTOOL
AC_PROG_CC
AC_PROG_CXX
dnl Checks for programs.

dnl Checks for libraries.
dnl Replace `main' with a function in -ldl:
AC_CHECK_LIB(dl, dlopen)

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T

dnl The parameters to the wrapped functions have to match
dnl those in the system header files. I don't know how to
dnl really get the names of the paramters, but this seems to work.
AC_MSG_CHECKING([for second and third argument of readlink])
readlink_buf_arg=unknown
readlink_bufsize_arg=unknown
for second in void char; do
  for third in size_t int; do
    AC_TRY_COMPILE([#include <unistd.h>
      int readlink(const char *path, $second *buf, $third bufsiz);],
      [puts("hello, world");],
      [readlink_buf_arg=$second
       readlink_bufsize_arg=$third
      ],
      [])
  done
done
AC_MSG_RESULT([$readlink_buf_arg, $readlink_bufsize_arg])
AC_DEFINE_UNQUOTED(READLINK_BUF_TYPE, $readlink_buf_arg)
AC_DEFINE_UNQUOTED(READLINK_BUFSIZE_TYPE, $readlink_bufsize_arg)

AC_MSG_CHECKING([checking for union semun])
  AC_TRY_COMPILE([
       # include <sys/types.h>
       # include <sys/ipc.h>
       # include <sys/sem.h>
  ], [  
       union semun s;
  ],
  [AC_DEFINE(HAVE_SEMUN_DEF)
   AC_MSG_RESULT([yes])  
  ],
  [ AC_MSG_RESULT([no])]
  )

dnl glibc uses `* dev' as forth argument of __xmknod.
dnl Although the test below should probably be more general
dnl (not just __xmknod, but also mknod etc), at the moment this
dnl seems enough, as probably glibc is the only that does this.
AC_MSG_CHECKING([checking for type of arg of __xmknod])
  AC_TRY_COMPILE([
       #include <sys/types.h>
       #include <sys/stat.h>
       #include <fcntl.h>
       #include <unistd.h>
  ], [  
       int __xmknod  ( int ver, 
                       const char *pathname ,  
                       mode_t  mode ,  dev_t dev);
  ],
  [
   AC_DEFINE(XMKNOD_FRTH_ARG,)
   AC_MSG_RESULT([no extra *])]
  ],
  [ 
   AC_DEFINE(XMKNOD_FRTH_ARG,*)
   AC_MSG_RESULT([needs *])  
  ]
  )




for field in d_off d_type; do
AC_MSG_CHECKING([checking for ${field} in struct dirent])
AC_TRY_COMPILE([
       #include <sys/types.h>
       #include <dirent.h>
  ], [  

       struct dirent d;
       d.${field}=0
  ],
  [AC_DEFINE_UNQUOTED(STAT_HAS_${field},1)
   AC_MSG_RESULT([yes])  
  ],
  [ AC_MSG_RESULT([no])]
  )
done

dnl find out how stat() etc are called. On linux systems, we really
dnl need to wrap __xstat(), on Solaris _stat, on Digital Unix stat() (IIRC)

:>fakerootconfig.h.tmp

for SEARCH in %stat f%stat l%stat %stat64 f%stat64 l%stat64 %mknod; do
  FUNC=`echo $SEARCH|sed -e 's/.*%//'`
  PRE=`echo $SEARCH|sed -e 's/%.*//'`
  FOUND=
  for WRAPPED in __${PRE}x${FUNC} ${PRE}${FUNC}; do
    AC_CHECK_FUNCS($WRAPPED,FOUND=$WRAPPED)
dnl
dnl to unconditionally define only the _* functions, comment out the 2 lines above,
dnl and uncomment the 2 lines below.
dnl
dnl  for WRAPPED in _${PRE}${FUNC}; do
dnl    FOUND=$WRAPPED
    if test -n "$FOUND"; then
      PF=`echo ${PRE}${FUNC}| tr '[[:lower:]]' '[[:upper:]]'` 
      DEFINE_WRAP=`echo wrap_${PRE}${FUNC}| tr '[[:lower:]]' '[[:upper:]]'` 
      DEFINE_NEXT=`echo wrap_${FOUND}| tr '[[:lower:]]' '[[:upper:]]'` 
      DEFINE_ARG=`echo wrap_${FOUND}| tr '[[:lower:]]' '[[:upper:]]'` 
      AC_DEFINE_UNQUOTED(WRAP_${PF}, $FOUND)
      AC_DEFINE_UNQUOTED(WRAP_${PF}_QUOTE, "$FOUND")
      AC_DEFINE_UNQUOTED(TMP_${PF}, tmp_$FOUND)
      AC_DEFINE_UNQUOTED(NEXT_${PF}_NOARG, next_$FOUND)
      if test __"${PRE}x${FUNC}" != "${WRAPPED}"; then
        DEF_BEGIN=""
      else
        DEF_BEGIN="a,"
      fi
      if test "${FUNC}" = "mknod"; then
        DEF_END=",d"
      else
        DEF_END=""
      fi
      dnl no matter what I do, the resulting define looks like
      dnl #define macro (a,b,c) (a,b,c)
      dnl with a space in between "macro" and "(". To prevent this,
      dnl I leave the space here, and remove it later with sed 
      dnl at (end of configure.in)
      dnl AC_DEFINE_UNQUOTED(NEXT_${PF}(a,b,c${DEF_END}), 
      dnl 		     next_$FOUND(${DEF_BEGIN}b,c${DEF_END}))
      dnl AC_DEFINE_UNQUOTED(${PF}[_ARG(a,b,c${DEF_END})], 
      dnl 		     (${DEF_BEGIN}b,c${DEF_END}))

      dnl Anyway the trickery above also leads to automake problems
      dnl (tries to remake config.h.in, but fails). So, as a way
      dnl out, Yann DIRSON wrote this:
      {
       echo "#define NEXT_${PF}(a,b,c${DEF_END}) next_$FOUND(${DEF_BEGIN}b,c${DEF_END})"
       echo "#define ${PF}_ARG(a,b,c${DEF_END}) (${DEF_BEGIN}b,c${DEF_END})"
      } >>fakerootconfig.h.tmp

      break
    fi
  done      
done

if test -r fakerootconfig.h
then
       if test "`diff fakerootconfig.h fakerootconfig.h.tmp`" = ""
       then
               AC_MSG_RESULT([fakerootconfig.h not changed])
               rm fakerootconfig.h.tmp
       else
               AC_MSG_RESULT([recreated fakerootconfig.h])
               rm fakerootconfig.h ; mv fakerootconfig.h.tmp fakerootconfig.h
       fi
else
       AC_MSG_RESULT([created fakerootconfig.h])
       mv fakerootconfig.h.tmp fakerootconfig.h
fi


dnl Checks for library functions.
AC_CHECK_FUNCS(strdup strstr)

AC_OUTPUT([Makefile scripts/Makefile doc/Makefile])

dnl Local variables:
dnl mode: m4
dnl End: