summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 4b527bc0b817418de08ceddb01f1097880ae3e47 (plain)
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
#  Copyright (C) 2001-2011 Artifex Software, Inc.
#  All Rights Reserved.

#  This software is provided AS-IS with no warranty, either express or
#  implied.

#  This software is distributed under license and may not be copied, modified
#  or distributed except as expressly authorized under the terms of that
#  license.  Refer to licensing information at http://www.artifex.com/
#  or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
#  San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.

# $Id$

# Process this file with autoconf to produce a configure script

# ------------------------------------------------
# Initialization and Versioning
# ------------------------------------------------

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.  This
# file is a modified template produced by autoscan with additions
# derived from ghostscript's configure.ac.
#

AC_PREREQ([2.61])
AC_INIT
AC_LANG(C)
AC_CONFIG_SRCDIR([pcl/pcjob.c])

# Checks for programs.
AC_PROG_CC

# Checks for header files.
AC_FUNC_ALLOCA
AC_HEADER_RESOLV
AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h inttypes.h langinfo.h libintl.h limits.h locale.h malloc.h memory.h netdb.h netinet/in.h nl_types.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/socket.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INT8_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_CHECK_TYPES([ptrdiff_t])

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_FUNC_STRTOD

AC_CHECK_FUNCS([alarm dup2 floor ftruncate gethostbyaddr gethostbyname gethostname getpass gettimeofday localeconv memchr memmove memset mkdir modf nl_langinfo pow putenv regcomp select setlocale socket sqrt strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strspn strstr strtol strtoul uname])

AC_CHECK_FUNCS([mkstemp], [HAVE_MKSTEMP=-DHAVE_MKSTEMP=1])
AC_SUBST(HAVE_MKSTEMP)

AC_CHECK_FUNCS([fopen64], [HAVE_FILE64=-DHAVE_FILE64])
AC_SUBST(HAVE_FILE64)

AC_CHECK_FUNCS([mkstemp64], [HAVE_MKSTEMP64=-DHAVE_MKSTEMP64])
AC_SUBST(HAVE_MKSTEMP64)

AC_CHECK_FUNCS([setlocale], [HAVE_SETLOCALE=-DHAVE_SETLOCALE])
AC_SUBST(HAVE_SETLOCALE)

dnl --------------------------------------------------
dnl Set options that we want to pass into all other
dnl configure scripts we might call
dnl --------------------------------------------------

SUBCONFIG_OPTS=""

if test x$build_alias != x; then
SUBCONFIG_OPTS="$SUBCONFIG_OPTS --build=$build_alias"
fi


dnl --------------------------------------------------
dnl Run subsidiary configure scripts
dnl --------------------------------------------------
LIBTIFFDIR=./gs/tiff

echo
echo "Running libtiff configure script..."
olddir=`pwd`
cd $LIBTIFFDIR && ./configure --disable-jbig $SUBCONFIG_OPTS
status=$?
if test "$status" -ne 0 ; then
  AC_MSG_ERROR([libtiff configure script failed], $status)
fi
cd $olddir
echo
echo "Continuing with GhostPDL configuration..."

dnl --------------------------------------------------
dnl check for big/little endian for LCMS
dnl --------------------------------------------------

AC_MSG_CHECKING([for big endian])

AC_RUN_IFELSE(
  [AC_LANG_PROGRAM([#include <stdio.h>], [
   static const int one = 1;
   return (*(char*)&one == 0 ? 0 : 1);
  ])],
  [LCMS_BIGENDIAN=1],
  [LCMS_BIGENDIAN=0])

if test "x$LCMS_BIGENDIAN" != "x0"; then
  LCMS_ENDIAN="-DUSE_BIG_ENDIAN=$LCMS_BIGENDIAN"
  LCMS2_ENDIAN="-DCMS_USE_BIG_ENDIAN=$LCMS_BIGENDIAN"
  AC_MSG_RESULT(yes)
else
  LCMS_ENDIAN=
  LCMS2_ENDIAN=
  AC_MSG_RESULT(no)
fi

AC_SUBST(LCMS_ENDIAN)
AC_SUBST(LCMS2_ENDIAN)

dnl --------------------------------------------------
dnl check for sse2 intrinsics
dnl --------------------------------------------------

AC_MSG_CHECKING([sse2 support])
save_cflags=$CFLAGS
CFLAGS="$CFLAGS $OPT_CFLAGS"

HAVE_SSE2=""
AC_LINK_IFELSE(
  [AC_LANG_PROGRAM([#include <emmintrin.h>], [
  __m128i input1;
  unsigned char buf1[[128]];
  input1 = _mm_loadu_si128((const __m128i *)buf1);
  return(0);
  ])],
  [HAVE_SSE2="-DHAVE_SSE2"], [HAVE_SSE2=""])

AC_ARG_ENABLE([sse2], AC_HELP_STRING([--disable-sse2],
       [Do not use sse2 instrinsics]), [
             if test "x$enable_sse2" = xno; then
                HAVE_SSE2=""
             fi])

if test "x$HAVE_SSE2" != x; then
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

AC_SUBST(HAVE_SSE2)
CFLAGS=$save_cflags

dnl --------------------------------------------------
dnl check for byte swap intrinsics
dnl --------------------------------------------------
AC_MSG_CHECKING([byteswap support])

HAVE_BSWAP32=""
AC_LINK_IFELSE(
  [AC_LANG_PROGRAM([], [
  int a = 0;
  int b = __builtin_bswap32(a);
  return(0);
  ])],
  [HAVE_BSWAP32="-DHAVE_BSWAP32"], [HAVE_BSWAP32=""])

AC_ARG_ENABLE([bswap32], AC_HELP_STRING([--disable-bswap32],
       [Do not use bswap32 instrinsic]), [
             if test "x$enable_bswap32" = xno; then
                HAVE_BSWAP32=""
             fi])

if test "x$HAVE_BSWAP32" != x; then
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi
 
AC_SUBST(HAVE_BSWAP32)

dnl --------------------------------------------------
dnl check for byte swap header
dnl --------------------------------------------------
AC_MSG_CHECKING([for byteswap.h])

HAVE_BYTESWAP_H=""
AC_COMPILE_IFELSE(
  [AC_LANG_PROGRAM([#include "byteswap.h"], [
  int a = 0;
  int b = __builtin_bswap32(a);
  return(0);
  ])],
  [HAVE_BYTESWAP_H="-DHAVE_BYTESWAP_H"], [HAVE_BYTESWAP_H=""])

AC_ARG_ENABLE([byteswap-h], AC_HELP_STRING([--disable-byteswap-h],
       [Do not use byteswap.h functions]), [
             if test "x$enable_byteswap-h" = xno; then
                HAVE_BYTESWAP_H=""
             fi])
 
if test "x$HAVE_BYTESWAP_H" != x; then
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

AC_SUBST(HAVE_BYTESWAP_H)

dnl --------------------------------------------------
dnl Check for libraries and x11 includes/libraries
dnl --------------------------------------------------

SYNC="nosync"
PTHREAD_LIBS=""
AC_CHECK_LIB(pthread, pthread_create, [
  SYNC=posync;
  PTHREAD_LIBS="-lpthread"
])
AC_SUBST(SYNC)
AC_SUBST(PTHREAD_LIBS)

AC_PATH_X

XINCLUDE=""
XLIBDIRS=""
XLIBDIR=""
XLIBS=""
X11DEVS=""

if test -z "$no_x"; then
  # workaround autoconf bug which used to depend on xmkmf to set the
  # $x_includes directory.  Danger quadrigraph ahead!
  if test ! -z "$x_libraries && test -z "$x_includes; then
     includedir="include"
     x_includes=$(echo $x_libraries | sed 's|@<:@^/@:>@*$||')
     x_includes="$x_includes$includedir"
  fi
  if test ! -z "$x_includes"; then
     XINCLUDE=-I$x_includes
  fi
  if test ! -z "$x_libraries"; then
    XLIBDIRS=-L$x_libraries
    XLIBDIR=-L$x_libraries
  fi
  XLIBS="Xt SM ICE Xext X11"
  X11DEVS='$(DD)x11.dev $(DD)x11alpha.dev $(DD)x11mono.dev $(DD)x11cmyk.dev'
fi

if test "x$ac_cv_header_sys_time_h" = xyes; then
    HAVE_SYS_TIME_H="-DHAVE_SYS_TIME_H=1"
fi

AC_SUBST(HAVE_SYS_TIME_H)

AC_SUBST(XINCLUDE)
AC_SUBST(XLIBDIRS)
AC_SUBST(XLIBDIR)
AC_SUBST(XLIBS)
AC_SUBST(X11DEVS)
AC_OUTPUT(config.mak)