File: acinclude.m4

package info (click to toggle)
gesftpserver 2~ds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 916 kB
  • sloc: ansic: 7,876; python: 206; makefile: 62; sh: 4
file content (278 lines) | stat: -rw-r--r-- 8,373 bytes parent folder | download
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# This file is part of the Green End SFTP Server.
# Copyright (C) 2007, 2011,14,15,18 Richard Kettlewell
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
AC_DEFUN([RJK_BUILDSYS_FINK],[
  AC_CANONICAL_BUILD
  AC_CANONICAL_HOST
  AC_PATH_PROG([FINK],[fink],[none],[$PATH:/sw/bin])
  if test "x$FINK" != xnone && test "$host" = "$build"; then
    AC_CACHE_CHECK([fink install directory],[rjk_cv_finkprefix],[
      rjk_cv_finkprefix="`echo "$FINK" | sed 's,/bin/fink$,,'`"
    ])
    CPPFLAGS="${CPPFLAGS} -isystem /usr/include -isystem ${rjk_cv_finkprefix}/include"
    LDFLAGS="${LDFLAGS} -L/usr/lib -L${rjk_cv_finkprefix}/lib"
  fi
])

AC_DEFUN([RJK_ISCLANG],[
  AC_CACHE_CHECK([whether compiling with Clang],[rjk_cv_isclang],[
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
                      #ifndef __clang__
                        not clang
                      #endif]])],
     [rjk_cv_isclang=yes], [rjk_cv_isclang=no])])])])])

AC_DEFUN([RJK_BUILDSYS_MISC],[
  AC_CANONICAL_BUILD
  AC_CANONICAL_HOST
  AC_CACHE_CHECK([for extra include directories],[rjk_cv_extraincludes],[
    rjk_cv_extraincludes=none
    # If we're cross-compiling then we've no idea where to look for
    # extra includes
    if test "$host" = "$build"; then
      case $host_os in
      freebsd* )
        rjk_cv_extraincludes=/usr/local/include
        ;;
      esac
    fi
  ])
  if test $rjk_cv_extraincludes != none; then
    if test $GCC = yes; then
      CPPFLAGS="-isystem $rjk_cv_extraincludes"
    else
      CPPFLAGS="-I$rjk_cv_extraincludes"
    fi
  fi
  AC_CACHE_CHECK([for extra library directories],[rjk_cv_extralibs],[
    rjk_cv_extralibs=none
    if test "$host" = "$build"; then
      case $host_os in
      freebsd* )
        rjk_cv_extralibs=/usr/local/lib
        ;;
      esac
    fi
  ])
  if test $rjk_cv_extralibs != none; then
    LDFLAGS="-L$rjk_cv_extralibs"
  fi
])

AC_DEFUN([RJK_GCC_WARNINGS],[
  RJK_ISCLANG
  AC_CACHE_CHECK([for ${CC} warning options],[rjk_cv_ccwarnings],[
    if test $rjk_cv_isclang = no; then
      suppress=-Wno-type-limits
    else
      suppress=-Wno-tautological-constant-out-of-range-compare
    fi
    if test "$GCC" = yes; then
      rjk_cv_ccwarnings="-Wall -W -Wpointer-arith -Wbad-function-cast \
$suppress \
-Wwrite-strings -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs"
    else
      rjk_cv_ccwarnings="unknown"
    fi
  ])
  AC_CACHE_CHECK([how to make ${CC} treat warnings as errors],
                 [rjk_cv_ccwerror],[
    if test "$GCC" = yes; then
      rjk_cv_ccwerror="-Werror"
    else
      rjk_cv_ccwerror="unknown"
    fi
  ])
  AC_MSG_CHECKING([whether to enable compiler warnings])
  AC_ARG_ENABLE([warnings],
		[AS_HELP_STRING([--disable-warnings],
				[Disable compiler warnings])],
		[warnings="$enableval"],
		[warnings=yes])
  AC_MSG_RESULT([$warnings])
  AC_MSG_CHECKING([whether to treat warnings as errors])
  AC_ARG_ENABLE([warnings-as-errors],
                [AS_HELP_STRING([--disable-warnings-as-errors],
                                [Don't treat compiler warnings as errors])],
		[warnings_as_errors="$enableval"],
		[warnings_as_errors=yes])
  AC_MSG_RESULT([$warnings_as_errors])
  if test "$warnings" = yes && test "$rjk_cv_ccwarnings" != unknown; then
    CC="${CC} $rjk_cv_ccwarnings"
  fi
  if test "$warnings_as_errors" = yes && test "$rjk_cv_ccwerror" != unknown; then
    CC="${CC} $rjk_cv_ccwerror"
  fi
  AC_CACHE_CHECK([whether <inttypes.h> macros produce warnings],
                 [rjk_cv_inttypeswarnings],[
    AC_TRY_COMPILE([#include <stddef.h>
#include <stdio.h>
#include <inttypes.h>],
                   [uint64_t x=0;size_t sz=0;printf("%"PRIu64" %zu\n", x, sz);],
                   [rjk_cv_inttypeswarnings=no],
                   [rjk_cv_inttypeswarnings=yes])
  ])
  if test $rjk_cv_inttypeswarnings = yes && test "$GCC" = yes; then
    CC="${CC} -Wno-format"
  fi
])

AC_DEFUN([RJK_GTKFLAGS],[
  AM_PATH_GLIB_2_0([],[],[missing_libraries="$missing_libraries libglib"])
  AM_PATH_GTK_2_0([],[],[missing_libraries="$missing_libraries libgtk"])
  if test "$GCC" = yes; then
    GTK_CFLAGS="`echo \"$GTK_CFLAGS\"|sed 's/-I/-isystem /g'`"
    GLIB_CFLAGS="`echo \"$GLIB_CFLAGS\"|sed 's/-I/-isystem /g'`"
  fi
])

AC_DEFUN([RJK_STAT_TIMESPEC],[
  AC_CHECK_MEMBER([struct stat.st_atimespec],
		  [AC_DEFINE([HAVE_STAT_TIMESPEC],[1],
		             [define if struct stat uses struct timespec])],
		  [rjk_cv_stat_timespec=no],
		  [#include <sys/stat.h>])
  ])
])

AC_DEFUN([RJK_GCC_ATTRS],[
  AH_BOTTOM([#ifdef __GNUC__
# define attribute(x) __attribute__(x)
#else
# define attribute(x)
#endif])
  ])
])

AC_DEFUN([RJK_ICONV],[
  # MacOS has a rather odd iconv (presumably for some good reason)
  AC_CHECK_LIB([iconv],[iconv_open])
  AC_CHECK_LIB([iconv],[libiconv_open])
])

AC_DEFUN([RJK_GCOV],[
  GCOV=${GCOV:-true}
  AC_ARG_WITH([gcov],
              [AS_HELP_STRING([--with-gcov],
                              [Enable coverage testing])],
              [if test $withval = yes; then
                 CFLAGS="${CFLAGS} -O0 -fprofile-arcs -ftest-coverage"
                 GCOV=`echo $CC | sed s'/gcc/gcov/;s/ .*$//'`;
               fi])
  AC_SUBST([GCOV],[$GCOV])
])

AC_DEFUN([RJK_THREADS],[
  AC_CANONICAL_BUILD
  AC_CANONICAL_HOST
  # If you're cross-compiling then you're on your own
  AC_MSG_CHECKING([how to build threaded code])
  if test "$host" = "$build"; then
    case $host_os in
    solaris2* )
      case "$GCC" in
      yes )
        AC_MSG_RESULT([-lpthread])
        AC_CHECK_LIB([pthread],[pthread_create])
        ;;
      * )
        AC_MSG_RESULT([-mt option])
        CC="${CC} -mt"
        ;;
      esac
      ;;
    * )
      # Guess that unrecognized things are like Linux/BSD
      AC_MSG_RESULT([-lpthread])
      AC_CHECK_LIB([pthread],[pthread_create])
      ;;
    esac
  fi
  # We always ask for this.
  AC_DEFINE([_REENTRANT],[1],[define for re-entrant functions])
])

AC_DEFUN([RJK_SIZE_MAX],[
  AC_CHECK_SIZEOF([unsigned short])
  AC_CHECK_SIZEOF([unsigned int])
  AC_CHECK_SIZEOF([unsigned long])
  AC_CHECK_SIZEOF([unsigned long long])
  AC_CHECK_SIZEOF([size_t])
  AC_CHECK_HEADERS([stdint.h])
  AC_CACHE_CHECK([for SIZE_MAX],[rjk_cv_size_max],[
    AC_TRY_COMPILE([#include <limits.h>
                    #include <stddef.h>
                    #if HAVE_STDINT_H
                    # include <stdint.h>
                    #endif],
                   [size_t x = SIZE_MAX;++x;],
                   [rjk_cv_size_max=yes],
                   [rjk_cv_size_max=no])
  ])
  if test "$rjk_cv_size_max" = yes; then
    AC_DEFINE([HAVE_SIZE_MAX],[1], [define if you have SIZE_MAX])
  fi
  AH_BOTTOM([#if ! HAVE_SIZE_MAX
# if SIZEOF_SIZE_T == SIZEOF_UNSIGNED_SHORT
#  define SIZE_MAX USHRT_MAX
# elif SIZEOF_SIZE_T == SIZEOF_UNSIGNED_INT
#  define SIZE_MAX UINT_MAX
# elif SIZEOF_SIZE_T == SIZEOF_UNSIGNED_LONG
#  define SIZE_MAX ULONG_MAX
# elif SIZEOF_SIZE_T == SIZEOF_UNSIGNED_LONG_LONG
#  define SIZE_MAX ULLONG_MAX
# else
#  error Cannot deduce SIZE_MAX
# endif
#endif
  ])
])

AC_DEFUN([RJK_GETOPT],[
  AC_CHECK_FUNC([getopt_long],[],[
    AC_LIBOBJ([getopt])
    AC_LIBOBJ([getopt1])
  ])
])

AC_DEFUN([RJK_PYTHON3],[
  AC_CACHE_CHECK([for Python 3],[rjk_cv_python3],[
    if python3 -V >/dev/null 2>&1; then
      rjk_cv_python3=python3
    elif python -V >confpyver 2>&1; then
      read p v < confpyver
      case "$v" in
      1* | 2* )
        ;;
      * )
        rjk_cv_python3=python
        ;;
      esac
    fi
    rm -f confpyver
    if test "$rjk_cv_python3" = ""; then
      AC_MSG_ERROR([cannot find Python 3.x])
    fi
  ])
  AC_SUBST([PYTHON3],[$rjk_cv_python3])
])

dnl Local Variables:
dnl mode:autoconf
dnl indent-tabs-mode:nil
dnl End: