| 1 |
dnl $Id: configure.in,v 1.39 2006/10/08 19:29:18 nyaochi Exp $ |
| 2 |
dnl |
| 3 |
dnl |
| 4 |
dnl Exported and configured variables: |
| 5 |
dnl CFLAGS |
| 6 |
dnl LDFLAGS |
| 7 |
dnl INCLUDES |
| 8 |
|
| 9 |
|
| 10 |
dnl Initialization for autoconf |
| 11 |
AC_PREREQ(2.53) |
| 12 |
AC_INIT |
| 13 |
AC_CONFIG_SRCDIR([cui/main.c]) |
| 14 |
|
| 15 |
|
| 16 |
dnl Checks for system |
| 17 |
AC_CANONICAL_HOST |
| 18 |
AC_AIX |
| 19 |
AC_MINIX |
| 20 |
AC_ISC_POSIX |
| 21 |
|
| 22 |
dnl Initialization for automake |
| 23 |
AM_INIT_AUTOMAKE(easyh10, 1.5) |
| 24 |
AM_CONFIG_HEADER(config.h) |
| 25 |
AM_MAINTAINER_MODE |
| 26 |
AM_C_PROTOTYPES |
| 27 |
|
| 28 |
dnl Checks for program |
| 29 |
AM_PROG_CC_STDC |
| 30 |
AC_PROG_CC |
| 31 |
AC_PROG_INSTALL |
| 32 |
AC_PROG_LN_S |
| 33 |
|
| 34 |
dnl Initialozation for libtool |
| 35 |
AC_PROG_LIBTOOL |
| 36 |
|
| 37 |
dnl Initialization for variables |
| 38 |
CFLAGS="${ac_save_CFLAGS}" |
| 39 |
LDFLAGS="${ac_save_LDFLAGS}" |
| 40 |
INCLUDES="-I\$(top_srcdir) -I\$(top_srcdir)/include -I\$(srcdir)" |
| 41 |
|
| 42 |
dnl Additional options |
| 43 |
|
| 44 |
|
| 45 |
dnl Checks for header files. |
| 46 |
AC_HEADER_STDC |
| 47 |
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h unistd.h stdint.h getopt.h) |
| 48 |
|
| 49 |
|
| 50 |
dnl Checks for typedefs, structures, and compiler characteristics. |
| 51 |
AC_C_CONST |
| 52 |
AC_CHECK_SIZEOF |
| 53 |
AC_TYPE_SIZE_T |
| 54 |
AC_STRUCT_TM |
| 55 |
AC_CHECK_SIZEOF(short) |
| 56 |
AC_CHECK_SIZEOF(unsigned short) |
| 57 |
AC_CHECK_SIZEOF(int) |
| 58 |
AC_CHECK_SIZEOF(unsigned int) |
| 59 |
AC_CHECK_SIZEOF(long) |
| 60 |
AC_CHECK_SIZEOF(unsigned long) |
| 61 |
|
| 62 |
AC_CHECK_TYPES([uint8_t, uint16_t, uint32_t]) |
| 63 |
|
| 64 |
AH_VERBATIM([HAVE_UINT8_T], |
| 65 |
[/* add uint8_t type */ |
| 66 |
#undef HAVE_UINT8_T |
| 67 |
#ifndef HAVE_UINT8_T |
| 68 |
typedef unsigned char uint8_t; |
| 69 |
#endif]) |
| 70 |
|
| 71 |
AH_VERBATIM([HAVE_UINT16_T], |
| 72 |
[/* add uint16_t type */ |
| 73 |
#undef HAVE_UINT16_T |
| 74 |
#ifndef HAVE_UINT16_T |
| 75 |
typedef unsigned short uint16_t; |
| 76 |
#endif]) |
| 77 |
|
| 78 |
if test "${ac_cv_sizeof_unsigned_short}" = "4"; then |
| 79 |
AC_DEFINE(A_UINT32_T,unsigned short) |
| 80 |
else |
| 81 |
if test "${ac_cv_sizeof_unsigned_int}" = "4"; then |
| 82 |
AC_DEFINE(A_UINT32_T,unsigned int) |
| 83 |
else |
| 84 |
if test "${ac_cv_sizeof_unsigned_long}" = "4"; then |
| 85 |
AC_DEFINE(A_UINT32_T,unsigned long) |
| 86 |
else |
| 87 |
AC_MSG_ERROR([CHECK_TYPE_uint32_t - please report to the developper]) |
| 88 |
fi |
| 89 |
fi |
| 90 |
fi |
| 91 |
|
| 92 |
AH_VERBATIM([HAVE_UINT32_T], |
| 93 |
[/* add uint32_t type */ |
| 94 |
#undef HAVE_UINT32_T |
| 95 |
#ifndef HAVE_UINT32_T |
| 96 |
#undef A_UINT32_T |
| 97 |
typedef A_UINT32_T uint32_t; |
| 98 |
#endif]) |
| 99 |
|
| 100 |
|
| 101 |
dnl Checks for library functions. |
| 102 |
AC_FUNC_ALLOCA |
| 103 |
AC_FUNC_MEMCMP |
| 104 |
AC_FUNC_VPRINTF |
| 105 |
AC_CHECK_FUNCS(getcwd mktime strdup strerror strtol strtoul) |
| 106 |
|
| 107 |
dnl Check for math library |
| 108 |
AC_CHECK_LIB(m, rand) |
| 109 |
|
| 110 |
dnl Check for zlib library |
| 111 |
AC_CHECK_LIB(z, uncompress, , [AC_MSG_ERROR(libz not found!)]) |
| 112 |
|
| 113 |
dnl Check for iconv library |
| 114 |
AC_ARG_WITH( |
| 115 |
iconv-header, |
| 116 |
[AC_HELP_STRING(--with-iconv-header=DIR, [iconv header directory])], |
| 117 |
[CFLAGS="-I$withval ${CFLAGS}"] |
| 118 |
) |
| 119 |
|
| 120 |
AC_ARG_WITH( |
| 121 |
iconv-library, |
| 122 |
[AC_HELP_STRING(--with-iconv-library=DIR, [iconv library directory])], |
| 123 |
[LDFLAGS="-L$withval ${LDFLAGS}"; with_libiconv=native], |
| 124 |
[with_libiconv=maybe] |
| 125 |
) |
| 126 |
|
| 127 |
AC_CHECK_HEADER(iconv.h, , [AC_MSG_ERROR(iconv.h not found!)]) |
| 128 |
|
| 129 |
found_iconv=no |
| 130 |
case $with_libiconv in |
| 131 |
maybe) |
| 132 |
# Check in the C library first |
| 133 |
AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes]) |
| 134 |
# Check if we have GNU libiconv |
| 135 |
if test $found_iconv = "no"; then |
| 136 |
AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes]) |
| 137 |
fi |
| 138 |
# Check if we have a iconv in -liconv, possibly from vendor |
| 139 |
if test $found_iconv = "no"; then |
| 140 |
AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes]) |
| 141 |
fi |
| 142 |
;; |
| 143 |
no) |
| 144 |
AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes]) |
| 145 |
;; |
| 146 |
gnu|yes) |
| 147 |
AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes]) |
| 148 |
;; |
| 149 |
native) |
| 150 |
echo "native" |
| 151 |
echo $LDFLAGS |
| 152 |
# Check if we have GNU libiconv |
| 153 |
if test $found_iconv = "no"; then |
| 154 |
AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes]) |
| 155 |
fi |
| 156 |
# Check if we have a iconv in -liconv, possibly from vendor |
| 157 |
if test $found_iconv = "no"; then |
| 158 |
AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes]) |
| 159 |
fi |
| 160 |
;; |
| 161 |
esac |
| 162 |
|
| 163 |
if test "x$found_iconv" = "xno" ; then |
| 164 |
AC_MSG_ERROR([*** No iconv() implementation found in C library or libiconv]) |
| 165 |
fi |
| 166 |
|
| 167 |
if test x$with_libiconv != xno ; then |
| 168 |
case " $INTLLIBS " in |
| 169 |
*[[\ \ ]]-liconv[[\ \ ]]*) ;; |
| 170 |
*) ICONV_LIBS="-liconv" ;; |
| 171 |
esac |
| 172 |
fi |
| 173 |
|
| 174 |
case $with_libiconv in |
| 175 |
gnu) |
| 176 |
AC_DEFINE(USE_LIBICONV_GNU, 1, [Using GNU libiconv]) |
| 177 |
;; |
| 178 |
native) |
| 179 |
AC_DEFINE(USE_LIBICONV_NATIVE, 1, [Using a native implementation of iconv in a separate library]) |
| 180 |
;; |
| 181 |
esac |
| 182 |
AM_LANGINFO_CODESET |
| 183 |
|
| 184 |
|
| 185 |
dnl Checks for id3tag |
| 186 |
AC_ARG_WITH( |
| 187 |
id3tag-header, |
| 188 |
[AC_HELP_STRING(--with-id3tag-header=DIR, [id3tag header directory])], |
| 189 |
[CFLAGS="-I$withval ${CFLAGS}"] |
| 190 |
) |
| 191 |
|
| 192 |
AC_ARG_WITH( |
| 193 |
id3tag-library, |
| 194 |
[AC_HELP_STRING(--with-id3tag-library=DIR, [id3tag library directory])], |
| 195 |
[LDFLAGS="-L$withval ${LDFLAGS}"] |
| 196 |
) |
| 197 |
|
| 198 |
AC_CHECK_HEADER( |
| 199 |
id3tag.h, |
| 200 |
, |
| 201 |
[AC_MSG_ERROR(id3tag header not found!)] |
| 202 |
) |
| 203 |
AC_CHECK_LIB( |
| 204 |
id3tag, |
| 205 |
id3_file_fdopen, |
| 206 |
[ID3TAG_LIBS="-lid3tag"], |
| 207 |
AC_MSG_ERROR([id3tag library is not found!]) |
| 208 |
) |
| 209 |
AC_CHECK_LIB( |
| 210 |
id3tag, |
| 211 |
id3_file_gettag, |
| 212 |
[CFLAGS="-DHAVE_LIBID3TAG_GETTAG ${CFLAGS}"] |
| 213 |
) |
| 214 |
|
| 215 |
dnl Check for POSIX regex implementation |
| 216 |
with_regex=no |
| 217 |
AC_CHECK_FUNCS( |
| 218 |
regcomp regexec regfree, |
| 219 |
[with_regex=posix] |
| 220 |
) |
| 221 |
|
| 222 |
dnl Check for Rx regex library |
| 223 |
AC_CHECK_HEADER(rxposix.h) |
| 224 |
AC_CHECK_LIB(rx, regexec, [with_regex=rx]) |
| 225 |
|
| 226 |
case $with_regex in |
| 227 |
posix) |
| 228 |
AC_DEFINE(HAVE_POSIX_REGEX, 1, [Using POSIX regex function]) |
| 229 |
REGEX_LIBS="" |
| 230 |
;; |
| 231 |
rx) |
| 232 |
AC_DEFINE(HAVE_GNU_RX, 1, [Using GNU Rx library]) |
| 233 |
REGEX_LIBS="-lrx" |
| 234 |
;; |
| 235 |
no) |
| 236 |
AC_MSG_ERROR([*** No regex implementation found in C library or GNU Rx]) |
| 237 |
;; |
| 238 |
esac |
| 239 |
|
| 240 |
AC_ARG_ENABLE( |
| 241 |
debug, |
| 242 |
[AC_HELP_STRING(--enable-debug, [Turn on debugging])] |
| 243 |
) |
| 244 |
|
| 245 |
if test "$enable_debug" = "yes"; then |
| 246 |
CFLAGS="-DDEBUG -O -g ${CFLAGS}" |
| 247 |
fi |
| 248 |
|
| 249 |
dnl Export variables |
| 250 |
AC_SUBST(CFLAGS) |
| 251 |
AC_SUBST(LDFLAGS) |
| 252 |
AC_SUBST(INCLUDES) |
| 253 |
AC_SUBST(ID3TAG_LIBS) |
| 254 |
AC_SUBST(ICONV_LIBS) |
| 255 |
AC_SUBST(REGEX_LIBS) |
| 256 |
|
| 257 |
dnl Checks for library functions. |
| 258 |
|
| 259 |
AC_CONFIG_FILES(Makefile cui/Makefile libh10db/Makefile libucs2/Makefile libgetmediainfo/Makefile easyh10.spec) |
| 260 |
AC_OUTPUT |