1dnl Process this file with autoconf to produce a configure script. 2AC_PREREQ(2.55) 3AC_INIT(libcddb, 1.3.2) 4AC_CONFIG_SRCDIR(configure.ac) 5AM_CONFIG_HEADER(config.h) 6AC_CONFIG_FILES([Makefile \ 7 libcddb.pc \ 8 include/Makefile \ 9 include/cddb/Makefile \ 10 include/cddb/cddb_config.h \ 11 include/cddb/version.h \ 12 lib/Makefile \ 13 examples/Makefile \ 14 tests/Makefile \ 15 tests/settings.sh]) 16AM_INIT_AUTOMAKE([dist-bzip2]) 17AM_MAINTAINER_MODE 18 19LIBCDDB_VERSION_NUM=131 20AC_SUBST(LIBCDDB_VERSION_NUM) 21 22dnl iconv uses gettext macros (dependency on config.rpath) 23AM_GNU_GETTEXT_VERSION(0.14.4) 24 25dnl Process custom command-line options 26AC_ARG_ENABLE([loglevel], 27 AC_HELP_STRING([--enable-loglevel=LVL], 28 [set default log level to one of debug, info, warn, ] 29 [error, critical or none (default=warn)]), 30 default_loglevel=$enableval, default_loglevel=$enableval) 31if test x$default_loglevel = xdebug; then 32 default_loglevel="CDDB_LOG_DEBUG" 33elif test x$default_loglevel = xinfo; then 34 default_loglevel="CDDB_LOG_INFO" 35elif test x$default_loglevel = xwarn -o x$default_loglevel = xyes; then 36 default_loglevel="CDDB_LOG_WARN" 37elif test x$default_loglevel = xerror; then 38 default_loglevel="CDDB_LOG_ERROR" 39elif test x$default_loglevel = xcritical; then 40 default_loglevel="CDDB_LOG_CRITICAL" 41elif test x$default_loglevel = xnone -o x$default_loglevel = xno; then 42 default_loglevel="CDDB_LOG_NONE" 43elif test x$default_loglevel != x; then 44 AC_MSG_WARN([invalid loglevel, using default]) 45fi 46 47if test x$default_loglevel != x; then 48 AC_DEFINE_UNQUOTED([LOGLEVEL],$default_loglevel,[Set to default log level]) 49fi 50 51AC_ARG_WITH([cdio], 52 AC_HELP_STRING([--without-cdio], 53 [do not use libcdio functionality when building the ] 54 [example program (default = use if found)])) 55AC_ARG_WITH([iconv], 56 AC_HELP_STRING([--without-iconv], 57 [do not include character set conversion support using ] 58 [the iconv library (default = enabled if found)])) 59 60dnl Check for target 61AC_CANONICAL_HOST 62case $host in 63 *beos*) 64 AC_DEFINE([BEOS],1,[Define if compiling on BeOS system.]) 65 ;; 66 *darwin*) 67 AC_DEFINE([CDDB_NEED_UNISTD_H],1, 68 [Define if you have <unistd.h> and need it included. 69 On MacOS, <regex.h> needs this but that header doesn't 70 include it.]) 71 AC_DEFINE([CDDB_NEED_SYS_SOCKET_H],1, 72 [Define if you have <sys/socket.h> and need it included. 73 On MacOS, <cddb_net.h> needs this but that header doesn't 74 include it.]) 75 ;; 76 *haiku*) 77 AC_DEFINE([HAIKU],1,[Define if compiling on Haiku system.]) 78 AC_DEFINE([CDDB_NEED_UNISTD_H],1, 79 [Define if you have <unistd.h> and need it included.]) 80 AC_DEFINE([CDDB_NEED_SYS_SOCKET_H],1, 81 [Define if you have <sys/socket.h> and need it included.]) 82 ;; 83esac 84 85dnl Checks for programs. 86AC_PROG_AWK 87AC_PROG_CC 88AC_PROG_CPP 89AC_LIBTOOL_WIN32_DLL 90AC_PROG_LIBTOOL 91AC_PROG_INSTALL 92AC_PROG_LN_S 93AC_PROG_MAKE_SET 94 95dnl Checks for libraries. 96AC_CHECK_LIB([socket], [connect]) 97AC_CHECK_LIB([network], [connect]) 98 99dnl Checks for header files. 100AC_HEADER_STDC 101AC_HEADER_TIME 102AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h regex.h stdlib.h string.h sys/socket.h]) 103AC_CHECK_HEADERS([unistd.h errno.h time.h sys/time.h fcntl.h windows.h winsock2.h]) 104 105dnl Checks for typedefs, structures, and compiler characteristics. 106AC_C_CONST 107AC_TYPE_SIZE_T 108 109dnl Checks for library functions. 110AC_FUNC_MALLOC 111AC_FUNC_REALLOC 112AC_FUNC_STAT 113AC_FUNC_VPRINTF 114AC_FUNC_SELECT_ARGTYPES 115AC_CHECK_FUNCS([mkdir regcomp socket strdup strtol strchr memset alarm select realloc]) 116AC_CHECK_FUNC([gethostbyname], , AC_CHECK_LIB([nsl], [gethostbyname])) 117 118dnl Check for libcdio 119if test x$with_cdio != xno; then 120 PKG_CHECK_MODULES(LIBCDIO, libcdio >= 0.76, [ 121 HAVE_LIBCDIO=yes 122 AC_DEFINE(HAVE_LIBCDIO, [], [Define this if you have libcdio installed]) 123 ], 124 [AC_MSG_WARN(new enough libcdio not found. CD reading in CDDB test program disabled. Get libcdio from http://www.gnu.org/software/libcdio/) 125 HAVE_LIBCDIO=no]) 126 AC_SUBST(LIBCDIO_LIBS) 127 AC_SUBST(LIBCDIO_CFLAGS) 128else 129 HAVE_LIBCDIO=no 130fi 131 132dnl Check for iconv 133if test x$with_iconv != xno; then 134 AC_CHECK_HEADERS([iconv.h], [with_iconv=1], [with_iconv=0]) 135 AM_ICONV 136else 137 with_iconv=0 138fi 139AC_SUBST(with_iconv) 140 141dnl Check and add some GCC specific warning flags 142dnl - we do this as the last thing so that a possible -Werror flag 143dnl - does not cause a failure in one of the other tests above 144if test "x$GCC" != "xyes" 145then 146 echo "*** non GNU CC compiler detected." 147 echo "*** This package has not been tested very well with non GNU compilers" 148 echo "*** you should try to use 'gcc' for compiling this package." 149else 150 WARN_CFLAGS="-Wall -Wchar-subscripts -Wmissing-prototypes -Wmissing-declarations" 151 WARN_CFLAGS="$WARN_CFLAGS -Wunused -Wpointer-arith -Wwrite-strings -Wnested-externs" 152 WARN_CFLAGS="$WARN_CFLAGS -Wno-sign-compare" 153dnl MAINTAINER_CFLAGS="-std=c99 -pedantic -Werror -O0" 154dnl MAINTAINER_CFLAGS="-Werror -O0" 155 MAINTAINER_CFLAGS="-Werror" 156 157 if test "x$enable_maintainer_mode" = "xyes"; then 158 maintainer_flags="" 159 for MOPT in $MAINTAINER_CFLAGS; do 160 SAVE_CFLAGS="$CFLAGS" 161 CFLAGS="$CFLAGS $MOPT" 162 AC_MSG_CHECKING([whether $CC accepts $MOPT]) 163 AC_TRY_COMPILE([], [], has_option=yes, has_option=no) 164 CFLAGS="$SAVE_CFLAGS" 165 AC_MSG_RESULT($has_option) 166 if test "x$has_option" = "xyes"; then 167 maintainer_flags="$maintainer_flags $MOPT" 168 fi 169 unset has_option 170 unset SAVE_CFLAGS 171 done 172 unset MOPT 173 MAINTAINER_CFLAGS="$maintainer_flags" 174 unset maintainer_flags 175 else 176 MAINTAINER_CFLAGS="" 177 fi 178 179 warning_flags="" 180 for WOPT in $WARN_CFLAGS; do 181 SAVE_CFLAGS="$CFLAGS" 182 CFLAGS="$CFLAGS $WOPT" 183 AC_MSG_CHECKING([whether $CC accepts $WOPT]) 184 AC_TRY_COMPILE([], [], has_option=yes, has_option=no) 185 CFLAGS="$SAVE_CFLAGS" 186 AC_MSG_RESULT($has_option) 187 if test "x$has_option" = "xyes"; then 188 warning_flags="$warning_flags $WOPT" 189 fi 190 unset has_option 191 unset SAVE_CFLAGS 192 done 193 unset WOPT 194 WARN_CFLAGS="$warning_flags" 195 unset warning_flags 196fi 197CFLAGS="$CFLAGS $WARN_CFLAGS $MAINTAINER_CFLAGS" 198 199dnl Additional configuration (platform dependant) 200case $host in 201 *mingw*) 202 LIBS="$LIBS -lws2_32 -lregex" 203 ;; 204 *) 205 ;; 206esac 207 208dnl Create makefiles 209AC_OUTPUT 210