File: configure.in

package info (click to toggle)
userv 0.60.2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 424 kB
  • ctags: 495
  • sloc: ansic: 3,866; makefile: 155; sh: 134
file content (153 lines) | stat: -rw-r--r-- 4,314 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
#  userv - configure.in
# 
#  Copyright (C)1996-1997 Ian Jackson
#   
#  This 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 userv; if not, write to the Free Software
#  Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

AC_INIT(language.i4)
AC_CONFIG_HEADER(config.h)

AC_PREFIX_DEFAULT(/usr/local)

crdir="`pwd`"
AC_SUBST(DEBUGDEFS)
AC_SUBST(DEBUGLIBS)
DEBUGDEFS=''
DEBUGLIBS=''
AC_ARG_ENABLE(debug,
[  --enable-debug          build debugging version],
[
 if test "x$enable_debug" = xyes; then
  DEBUGDEFS="-DDEBUG -DVARDIR='\"$crdir/vd\"' -DSYSTEMCONFIGDIR='\"$crdir/slash-etc\"' -DSERVICEUSERDIR='\"$crdir/tilde\"'"
  DEBUGLIBS=-lefence
  echo will build debugging version
 elif test "x$enable_debug" != xno; then
  AC_MSG_ERROR(--enable-debug does not allow any arguments except 'yes' and 'no')
 fi
])

AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL

CFLAGS="$CFLAGS -D_GNU_SOURCE"

AC_CACHE_CHECK(for EPROTO,userv_cv_hdr_eproto,
 AC_EGREP_CPP(yes,
[
#include <errno.h>
#ifdef EPROTO
 yes
#endif
],userv_cv_hdr_eproto=yes,userv_cv_hdr_eproto=no))
if test $userv_cv_hdr_eproto = yes
then
	AC_DEFINE(HAVE_EPROTO)
fi

AC_SUBST(OPTIMISE)
if test "${GCC-no}" = yes; then
 OPTIMISE=-O2
else
 OPTIMISE=-O
fi

dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>)
define(DPKG_CACHED_TRY_COMPILE,[
 AC_MSG_CHECKING($1)
 AC_CACHE_VAL($2,[
  AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no])
 ])
 if test "x$$2" = xyes; then
  true
  $5
 else
  true
  $6
 fi
])

DPKG_CACHED_TRY_COMPILE(your C compiler,dpkg_cv_c_works,
 [#include <string.h>], [strcmp("a","b")],
 AC_MSG_RESULT(works),
 AC_MSG_RESULT(broken)
 AC_MSG_ERROR(C compiler is broken))

DPKG_CACHED_TRY_COMPILE(__attribute__((,,)),dpkg_cv_c_attribute_supported,,
 [extern int testfunction(int x) __attribute__((,,))],
 AC_MSG_RESULT(yes)
 AC_DEFINE(HAVE_GNUC25_ATTRIB)
  DPKG_CACHED_TRY_COMPILE(__attribute__((noreturn)),dpkg_cv_c_attribute_noreturn,,
   [extern int testfunction(int x) __attribute__((noreturn))],
   AC_MSG_RESULT(yes)
   AC_DEFINE(HAVE_GNUC25_NORETURN),
   AC_MSG_RESULT(no))
  DPKG_CACHED_TRY_COMPILE(__attribute__((unused)),dpkg_cv_c_attribute_unused,,
   [extern int testfunction(int x) __attribute__((unused))],
   AC_MSG_RESULT(yes)
   AC_DEFINE(HAVE_GNUC25_UNUSED),
   AC_MSG_RESULT(no))
  DPKG_CACHED_TRY_COMPILE(__attribute__((format...)),dpkg_cv_attribute_format,,
   [extern int testfunction(char *y, ...) __attribute__((format(printf,1,2)))],
   AC_MSG_RESULT(yes)
   AC_DEFINE(HAVE_GNUC25_PRINTFFORMAT),
   AC_MSG_RESULT(no)),
 AC_MSG_RESULT(no))

AC_SUBST(CWARNS)
CWARNS=""

dnl DPKG_C_GCC_TRY_WARNS(<warnings>,<cachevar>)
define(DPKG_C_GCC_TRY_WARNS,[
 AC_MSG_CHECKING([GCC warning flag(s) $1])
 if test "${GCC-no}" = yes
 then
  AC_CACHE_VAL($2,[
   oldcflags="${CFLAGS-}"
   CFLAGS="${CFLAGS-} ${CWARNS} $1 -Werror"
   AC_TRY_COMPILE([
#include <string.h>
#include <stdio.h>
],[
    strcmp("a","b"); fprintf(stdout,"test ok\n");
], [$2=yes], [$2=no])
   CFLAGS="${oldcflags}"])
  if test "x$$2" = xyes; then
   CWARNS="${CWARNS} $1"
   AC_MSG_RESULT(ok)
  else
   $2=''
   AC_MSG_RESULT(no)
  fi
 else
  AC_MSG_RESULT(no, not using GCC)
 fi
])

DPKG_C_GCC_TRY_WARNS(-Wall -Wno-implicit, dpkg_cv_c_gcc_warn_all)
DPKG_C_GCC_TRY_WARNS(-Wwrite-strings, dpkg_cv_c_gcc_warn_writestrings)
DPKG_C_GCC_TRY_WARNS(-Wpointer-arith, dpkg_cv_c_gcc_warn_pointerarith)
DPKG_C_GCC_TRY_WARNS(-Wimplicit -Wnested-externs, dpkg_cv_c_gcc_warn_implicit)

if test "${GCC-no}" = yes; then
 CWARNS="${CWARNS} -Wmissing-prototypes -Wstrict-prototypes -Werror"
fi
[CFLAGS="`echo $CFLAGS $CWARNS | sed -e 's/-O[0-9]*/$(OPTIMISE)/'`"]

AC_SUBST(VERSION)
VERSION="`sed -n '/^userv (.*)/!d; s/^userv (//; s/).*//; p; q' debian/changelog`"
echo will build version $VERSION

AC_OUTPUT(Makefile)