File: configure

package info (click to toggle)
chrony 1.21z-5
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 2,080 kB
  • ctags: 2,375
  • sloc: ansic: 14,831; yacc: 858; sh: 588; perl: 426; makefile: 148
file content (360 lines) | stat: -rwxr-xr-x 8,803 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
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
#!/bin/sh
#
# $Header: /cvs/src/chrony/configure,v 1.30 2003/09/22 21:53:57 richard Exp $
#
# =======================================================================
#
# chronyd/chronyc - Programs for keeping computer clocks accurate.
#
# Copyright (C) Richard P. Curnow  1997-2003
#
# =======================================================================

# This configure script determines the operating system type and version

if [ "x${CC}" = "x" ]; then
  MYCC="gcc"
else
  MYCC="${CC}"
fi

if [ "x${CFLAGS}" = "x" ]; then
  MYCFLAGS="-O2 -g"
else
  MYCFLAGS="${CFLAGS}"
fi

# ======================================================================
# FUNCTIONS

#{{{ test_for_sqrt
test_for_sqrt () {
# 0 : doesn't need -lm
# 1 : needs -lm
# 2 : doesn't even link with -lm

  cat >docheck.c <<EOF;
#include <math.h>
int main(int argc, char **argv) {
  return (int) sqrt((double)argc);
}
EOF

  ${MYCC} ${MYCFLAGS} -c -o docheck.o docheck.c >/dev/null 2>&1
  if [ $? -eq 0 ]
  then
    ${MYCC} ${MYCFLAGS} -o docheck docheck.o >/dev/null 2>&1
    if [ $? -eq 0 ]
    then
      result=0
    else
      ${MYCC} ${MYCFLAGS} -o docheck docheck.o -lm >/dev/null 2>&1
      if [ $? -eq 0 ]
      then
        result=1
      else
        result=2
      fi
    fi
  else
    result=2
  fi

  rm -f docheck.c docheck.o docheck
  echo $result
}
#}}}
#{{{ test_for_stdint_h
test_for_stdint_h () {
  cat >docheck.c <<EOF;
#include <stdint.h>
int main(int argc, char **argv) {
  return 0;
}
EOF

  ${MYCC} ${MYCFLAGS} -c -o docheck.o docheck.c >/dev/null 2>&1
  if [ $? -eq 0 ]
  then
    result=0
  else
    result=1
  fi

  rm -f docheck.c docheck.o
  echo $result
}
#}}}
#{{{ test_for_inttypes_h
test_for_inttypes_h () {
  cat >docheck.c <<EOF;
#include <inttypes.h>
int main(int argc, char **argv) {
  return 0;
}
EOF

  ${MYCC} ${MYCFLAGS} -c -o docheck.o docheck.c >/dev/null 2>&1
  if [ $? -eq 0 ]
  then
    result=0
  else
    result=1
  fi

  rm -f docheck.c docheck.o
  echo $result
}
#}}}
#{{{ usage
usage () {
  cat <<EOF;
\`configure' configures tdl to adapt to many kinds of systems.

Usage: ./configure [OPTION]...

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]

By default, \`make install' will install all the files in
\`/usr/local/bin', \`/usr/local/lib' etc.  You can specify
an installation prefix other than \`/usr/local' using \`--prefix',
for instance \`--prefix=$HOME'.

For better control, use the options below.
  --disable-readline     Don't try to use GNU readline
  --readline-dir=DIR     Specify parent of readline include and lib directories
  --readline-inc-dir=DIR Specify where readline include directory is
  --readline-lib-dir=DIR Specify where readline lib directory is
  --with-ncurses-library=DIR Specify where ncurses lib directory is

Fine tuning of the installation directories:
  --infodir=DIR          info documentation [PREFIX/info]
  --mandir=DIR           man documentation [PREFIX/man]

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>

Use these variables to override the choices made by \`configure' or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to <rc@rc0.org.uk>.
EOF

}
#}}}

# ======================================================================



OPERATINGSYSTEM=`uname -s`
VERSION=`uname -r`
MACHINE=`uname -m`

SYSTEM=${OPERATINGSYSTEM}-${MACHINE}

EXTRA_LIBS=""
EXTRA_CLI_LIBS=""
EXTRA_OBJECTS=""
EXTRA_DEFS=""
INSTALL_PREFIX=/usr/local
SYSDEFS=""

# Support for readline (on by default)
feat_readline=1
readline_lib=""
readline_inc=""
ncurses_lib=""

SETINFODIR=""
SETMANDIR=""

for option
do
    case "$option" in
    --prefix=* | --install_prefix=* )
      INSTALL_PREFIX=`echo $option | sed -e 's/[^=]*=//;'`
    ;;
    --trace )
      EXTRA_DEFS="-DTRACEON"
    ;;
    --disable-readline )
      feat_readline=0
    ;;
    --with-readline-library=* )
      readline_lib=-L`echo $option | sed -e 's/^.*=//;'`
    ;;
    --with-readline-includes=* )
      readline_inc=-I`echo $option | sed -e 's/^.*=//;'`
    ;;
    --with-ncurses-library=* )
      ncurses_lib=-L`echo $option | sed -e 's/^.*=//;'`
    ;;
    --infodir=* )
      SETINFODIR=`echo $option | sed -e 's/^.*=//;'`
    ;;
    --mandir=* )
      SETMANDIR=`echo $option | sed -e 's/^.*=//;'`
    ;;
    --help | -h )
      usage
      exit 0
    ;;
    * )
    echo "Unrecognized option : " $option
    esac
done

case $SYSTEM in
    SunOS-sun4* )
    case $VERSION in
        4.* )
            EXTRA_OBJECTS="sys_sunos.o strerror.o"
            EXTRA_LIBS="-lkvm"
            SYSDEFS="-DSUNOS"
            echo "Configuring for SunOS (" $SYSTEM "version" $VERSION ")"
        ;;
        5.* )
            EXTRA_OBJECTS="sys_solaris.o"
            EXTRA_LIBS="-lsocket -lnsl -lkvm -lelf"
            EXTRA_CLI_LIBS="-lsocket -lnsl"
            SYSDEFS="-DSOLARIS"
            echo "Configuring for Solaris (" $SYSTEM "SunOS version" $VERSION ")"
            if [ $VERSION = "5.3" ]; then
                SYSDEFS="$SYSDEFS -DHAS_NO_BZERO"
                echo "Using memset() instead of bzero()"
            fi
        ;;
    esac
    ;;
    Linux* )
        EXTRA_OBJECTS="sys_linux.o wrap_adjtimex.o rtc_linux.o"
        SYSDEFS="-DLINUX"
        echo "Configuring for " $SYSTEM
        if [ "${MACHINE}" = "alpha" ]; then
           echo "Enabling -mieee"
           # FIXME: Should really test for GCC
           SYSDEFS="$SYSDEFS -mieee -DALPHA"
        fi
    ;;

    BSD/386-i[3456]86 )
        # Antti Jrvinen <costello@iki.fi> reported that this system can
        # be supported with the SunOS 4.x driver files.
        EXTRA_OBJECTS="sys_sunos.o strerror.o"
        EXTRA_LIBS="-lkvm"
        SYSDEFS="-DSUNOS"
        echo "Configuring for BSD/386 (using SunOS driver)"
    ;;
    NetBSD-* )
        EXTRA_OBJECTS="sys_netbsd.o"
        EXTRA_LIBS="-lkvm"
        SYSDEFS=""
        echo "Configuring for $SYSTEM"
    ;;
    SunOS-i86pc* )                                          
        # Doug Woodward <dougw@whistler.com> reported that this configuration
        # works for Solaris 2.8 / SunOS 5.8 on x86 platforms
        EXTRA_OBJECTS="sys_solaris.o"                
        EXTRA_LIBS="-lsocket -lnsl -lkvm -lelf"      
        EXTRA_CLI_LIBS="-lsocket -lnsl"                              
        SYSDEFS="-DSOLARIS"                               
        echo "Configuring for Solaris (" $SYSTEM "SunOS version" $VERSION ")" 
    ;;                                                                        
    CYGWIN32_NT-i[3456]86 )
        EXTRA_OBJECTS="sys_winnt.o"
        EXTRA_LIBS=""
        SYSDEFS="-DWINNT"
        echo "Configuring for Windows NT (Cygwin32)"
    ;;
    * )
        echo "Sorry, I don't know how to build this software on your system."
        exit 1
    ;;
esac

printf "Checking if sqrt() needs -lm : "
case `test_for_sqrt`
in
0)
  printf "No\n"
  LIBS=""
;;
1)
  printf "Yes\n"
  LIBS="-lm"
;;
*)
  printf "\nCan't compile/link a program which uses sqrt(), bailing out\n"
  exit 1
;;
esac

printf "Checking for <stdint.h> : "
if [ `test_for_stdint_h` -eq 0 ]; then
  printf "Yes\n"
  SYSDEFS="${SYSDEFS} -DHAS_STDINT_H"
else
  printf "No\n"
fi

printf "Checking for <inttypes.h> : "
if [ `test_for_inttypes_h` -eq 0 ]; then
  printf "Yes\n"
  SYSDEFS="${SYSDEFS} -DHAS_INTTYPES_H"
else
  printf "No\n"
fi

if [ "x${MYCC}" = "xgcc" ]; then
  CCWARNFLAGS="-Wmissing-prototypes -Wall"
else
  CCWARNFLAGS=""
fi

if [ $feat_readline = "1" ]; then
  READLINE_COMPILE="-DFEAT_READLINE=1 $readline_inc"
  READLINE_LINK="$readline_lib $ncurses_lib -lreadline -lncurses"
else
  READLINE_COMPILE=""
  READLINE_LINK=""
fi

MANDIR=${INSTALL_PREFIX}/man
INFODIR=${INSTALL_PREFIX}/info
if [ "x$SETINFODIR" != "x" ]; then
  INFODIR=$SETINFODIR
fi
if [ "x$SETMANDIR" != "x" ]; then
  MANDIR=$SETMANDIR
fi

sed -e "s%@EXTRA_OBJECTS@%${EXTRA_OBJECTS}%;\
	s%@CC@%${MYCC}%;\
	s%@CFLAGS@%${MYCFLAGS}%;\
	s%@CCWARNFLAGS@%${CCWARNFLAGS}%;\
	s%@LIBS@%${LIBS}%;\
	s%@EXTRA_LIBS@%${EXTRA_LIBS}%;\
	s%@SYSDEFS@%${SYSDEFS}%;\
	s%@EXTRA_DEFS@%${EXTRA_DEFS}%;\
	s%@EXTRA_CLI_LIBS@%${EXTRA_CLI_LIBS}%;\
	s%@READLINE_COMPILE@%${READLINE_COMPILE}%;\
	s%@READLINE_LINK@%${READLINE_LINK}%;\
	s%@INSTALL_PREFIX@%${INSTALL_PREFIX}%;\
	s%@MANDIR@%${MANDIR}%;\
	s%@INFODIR@%${INFODIR}%;"\
	< Makefile.in > Makefile

# =======================================================================
# vim:et:sw=2:ht=2:sts=2:fdm=marker:cms=#%s