File: configure.in

package info (click to toggle)
libmpeg1 1.3.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 848 kB
  • ctags: 645
  • sloc: ansic: 8,520; sh: 2,793; makefile: 153
file content (158 lines) | stat: -rw-r--r-- 5,405 bytes parent folder | download | duplicates (3)
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(wrapper.c)
AC_CONFIG_HEADER(config.h)
AC_CONFIG_AUX_DIR(.)
AC_PROG_INSTALL

dnl "Declare" variables that will be substituted in the output files
dnl and that the user might want to override at configure time
AC_SUBST(OPTIMIZE)
AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(INCLUDE_DIRS)
AC_SUBST(DEFINES)

AC_SUBST(EXTRA_LDFLAGS)

# Warn if user set CFLAGS, CPPFLAGS, or LDFLAGS (we override them)
if test -s "$CFLAGS" ; then AC_MSG_WARN(value of CFLAGS ignored--set OPTIMIZE and/or EXTRA_CFLAGS instead) ; fi
if test -s "$CPPFLAGS" ; then AC_MSG_WARN(value of CPPFLAGS ignored--set INCLUDE_DIRS and/or DEFINES instead) ; fi
if test -s "$LDFLAGS" ; then AC_MSG_WARN(value of LDFLAGS ignored--set EXTRA_LDFLAGS instead) ; fi

# Get host architecture (really only interested in OS)
AC_CANONICAL_HOST

# And determine endian-ness (needed if we have to define our own
# htonl() function on platforms that lack netinet/in.h)
AC_C_BIGENDIAN

# Determine the standalone executables to build -- mpegtest on all
# platforms, plus easympeg on IRIX.  (This assumes that IRIX means
# SGI, and SGI means GL -- and vice-versa.  Should work until 
# I make easympeg work with OpenGL!)
extras="mpegtest"
case "$host_os" in
  irix*) extras="$extras easympeg" ;;
esac
AC_SUBST(extras)

# Set the default compiler optimization flags (only if nothing 
# supplied from the environment)
if test -z "$OPTIMIZE" ; then OPTIMIZE="-O2" ; fi

# Set CFLAGS and CPPFLAGS here in preparation for testing the 
# compiler.  (Note that the values set here are *not* exported
# to the output files; we let the Makefiles take care of putting
# these values together again.  That way the user can override eg.
# OPTIMIZE at build-time as well as at configure time.)
CFLAGS="$OPTIMIZE $EXTRA_CFLAGS"
CPPFLAGS="$INCLUDE_DIRS $DEFINES"

# Look for the C compiler (default gcc), and make sure it supports
# prototypes, void, and enums properly (can't trust __STDC__).
AC_PROG_CC
cc_flagged=`echo "$CC $CFLAGS" |sed 's/ +/ /;s/ *$//'`
AC_MSG_CHECKING(that \"$cc_flagged\" is fairly ANSI-compliant)
AC_CACHE_VAL(mpeg_cv_cc_ansi, [
AC_TRY_COMPILE(, [
typedef enum { RED, GREEN, BLUE, YELLOW, BLACK } colour;
void *foo (colour C);
colour a = GREEN;

foo (a);
], mpeg_cv_cc_ansi=yes, mpeg_cv_cc_ansi=no)])
CC_ANSI=$mpeg_cv_cc_ansi
AC_MSG_RESULT($CC_ANSI)

if test $CC_ANSI = no; then
  AC_MSG_CHECKING(for alternative C compiler)
  AC_CHECK_PROGS(ALTCC, acc, none)
  if test $ALTCC = none; then
    AC_MSG_ERROR(An ANSI-compliant C compiler is required to build the MPEG Library)
  else
    CC=$ALTCC
  fi
fi

# Process the "--with-dmalloc" option
AC_ARG_WITH(dmalloc, [  --with-dmalloc          use the dmalloc library])
if test "$with_dmalloc" = "yes" ; then
  DEFINES="$DEFINES -DDMALLOC"
  EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldmalloc"
fi

# Look for ranlib and ar
AC_PROG_RANLIB
AC_CHECK_PROG(AR, ar, ar)

# Check for the "--disable-dither" option: this controls which files will
# actually be compiled and included in the library, so has to be processed
# at configure time.  Also, enable/disable dither controls the
# ENABLE_DITHER #define, which is done through config.h.

AC_ARG_ENABLE(dither,[
  --enable-dither         include code for all dithering modes (default)
  --disable-dither        only include code for full-colour conversion
                          (useful when linking with ImageMagick)],
dither=$enable_dither, dither=yes)
if test $dither = yes; then
  libsrc='$(DECODER_SRC) $(DITHER_SRC)'
  libobj='$(DECODER_SRC:.c=.o) $(DITHER_SRC:.c=.o)'
  AC_DEFINE(ENABLE_DITHER, 1)
  AC_MSG_RESULT(including dithering code)
else
  libsrc='$(DECODER_SRC)'
  libobj='$(DECODER_SRC:.c=.o)'
  AC_DEFINE(ENABLE_DITHER, 0)
  AC_MSG_RESULT(omitting dithering code)
fi
AC_SUBST(libsrc)
AC_SUBST(libobj)


# Check for header files
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/time.h unistd.h netinet/in.h)

# Check for typedefs, structures, and compiler characteristics
AC_HEADER_TIME

# Check for library functions
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strtod strtol random rand lrand48)
AC_CHECK_FUNC(getrusage,AC_DEFINE(HAVE_GETRUSAGE,1),AC_DEFINE(HAVE_GETRUSAGE,0))

# See if random() and lrand48() are actually declared where they're
# supposed to be (this is just paranoia-cruft leftover from the
# Berkeley code... still necessary?)
AC_EGREP_HEADER(random,stdlib.h,AC_DEFINE(HAVE_RANDOM_DECL,1),AC_DEFINE(HAVE_RANDOM_DECL,0))
AC_EGREP_HEADER(lrand48,stdlib.h,AC_DEFINE(HAVE_LRAND48_DECL,1),AC_DEFINE(HAVE_LRAND48_DECL,0))

# Try to find out where CLK_TCK is defined if we don't have getrusage.
# Need to do this because IRIX puts it in <time.h> and <limit.h>, AIX
# puts it in <time.h>, SunOS doesn't have it, and I dunno about anyone
# else.  Note: nothing is currently done with the $clk_tck_where
# value; right now I only worry about the case where CLK_TCK isn't
# found at all.

if test "$ac_cv_func_getrusage" = "no"; then
  AC_MSG_CHECKING(for where to find CLK_TCK symbol)
  clk_tck_where=""
  for hdr in "<time.h>" "<limits.h>" ; do
    if test -z "$clk_tck_where"; then
      AC_EGREP_CPP(yes,
[#include $hdr
 #ifdef CLK_TCK
  yes
 #endif
], clk_tck_where=$hdr)
    fi
  done
  if test -z "$clk_tck_where"; then
    AC_MSG_WARN([CLK_TCK not found, assuming 60 ticks/sec])
    AC_DEFINE(CLK_TCK,60)
  else
    AC_MSG_RESULT($clk_tck_where)
  fi
fi

AC_OUTPUT(Makefile extras/Makefile)