1AC_INIT([IceGenerator],0.5.5,administrator@tortugalabs.it) 2AC_COPYRIGHT([Copyright 2004 Tortuga Labs. Inc.]) 3AC_CANONICAL_HOST 4AC_CONFIG_SRCDIR(src/main.cpp) 5AM_INIT_AUTOMAKE(icegenerator,0.5.5) 6AM_CONFIG_HEADER(config.h) 7AM_SANITY_CHECK 8AM_MAINTAINER_MODE 9 10MAJOR_VERSION=0 11MINOR_VERSION=5 12RELEASE_VERSION=5 13VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION" 14 15if test "x$prefix" = xNONE; then 16 prefix=`eval echo ${ac_default_prefix}` 17fi 18 19if test "x$exec_prefix" = xNONE; then 20 exec_prefix=`eval echo ${ac_default_prefix}` 21fi 22 23dnl checks for programs needed to build. 24CXXFLAGS="-ansi -pedantic" 25 26AC_PROG_INSTALL 27AC_PROG_CC 28AM_PROG_CC_STDC 29AC_PROG_CXX 30AC_LANG_CPLUSPLUS 31 32AC_PROG_MAKE_SET 33AC_PROG_LN_S 34 35dnl debug check 36AC_ARG_ENABLE(debug, 37 [ --enable-debug enable debug (default disabled)], 38 [ CXXFLAGS="$CXXFLAGS -g" ], 39 [ CXXFLAGS="$CXXFLAGS -pipe -Wall -O3" ]) 40 41dnl libshout path check 42AC_ARG_WITH(shout,[ --with-shout=DIR libshout include and library files prefix path],[shoutdir=$withval],[shoutdir=""]) 43 44dnl MySQL path check 45AC_ARG_WITH(mysql,[ --with-mysql MySQL support],[mysql_en="yes"],[mysql_en=""]) 46 47dnl PostGreSQL path check 48AC_ARG_WITH(pgsql,[ --with-pgsql PostGreSQL support],[pgsql_en="yes"],[pgsql_en=""]) 49 50dnl ID3 path check 51AC_ARG_WITH(id3,[ --with-id3 ID3 support],[id3_en="yes"],[id3_en=""]) 52 53dnl checking mkdir -p 54AC_MSG_CHECKING([whether mkdir accepts -p]) 55if (mkdir -p config.tmpdir/p && mkdir -p config.tmpdir/p 2>&1) > /dev/null; then 56 AC_MSG_RESULT(yes) 57 MKDIR="mkdir -p" 58else 59 AC_MSG_RESULT(no) 60 MKDIR=mkdir 61fi 62rm -rf config.tmpdir 63 64dnl check for POSIX Threads library 65echo -e $'\n'$'\n'POSIX Threads 66ACX_PTHREAD([ 67 LDFLAGS="$LDFLAGS $PTHREAD_LIBS" 68 CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" 69 ]) 70AC_CHECK_HEADERS(pthread.h) 71AC_CHECK_FUNCS(pthread_create pthread_join) 72dnl AC_TRY_LINK_FUNC(pthread_create,[have_pthread_funcs=yes],AC_MSG_ERROR([Could not link to libpthread. IceGenerator package uses the pthread library. Install libpthread first.])) 73dnl AC_TRY_LINK_FUNC(pthread_join,[have_pthread_funcs=yes],AC_MSG_ERROR([Could not link to libpthread. IceGenerator package uses the pthread library. Install libpthread first.])) 74 75dnl I/O functions 76echo -e $'\n'$'\n'I/O functions 77AC_HEADER_STDC 78AC_HEADER_STAT 79AC_CHECK_HEADERS(stdio.h fcntl.h) 80AC_CHECK_FUNCS(open read write close printf fopen fprintf fflush fclose sprintf unlink fread fwrite,[have_io_funcs=yes],AC_MSG_ERROR([required function missing])) 81 82dnl log functions 83echo -e $'\n'$'\n'System log functions 84AC_CHECK_HEADERS(syslog.h) 85AC_CHECK_FUNCS(openlog syslog closelog,[have_log_funcs=yes],AC_MSG_ERROR([required function missing])) 86 87dnl network functions 88echo -e $'\n'$'\n'Network functions 89AC_CHECK_HEADERS(sys/socket.h netinet/in.h arpa/inet.h) 90dnl AC_CHECK_LIB(socket,socket,[LDFLAGS="$LDFLAGS -lsocket -lnsl"],,$LDFLAGS) 91ETR_SOCKET_NSL 92LDFLAGS="$LDFLAGS $ETR_SOCKET_LIBS" 93AC_CHECK_FUNCS(socket bind listen accept connect htons htonl inet_addr,[have_net_funcs=yes],AC_MSG_ERROR([required function missing])) 94TYPE_SOCKLEN_T 95 96dnl directory functions 97echo -e $'\n'$'\n'Directory functions 98AC_HEADER_DIRENT 99AC_CHECK_HEADERS(dirent.h) 100AC_CHECK_FUNCS(opendir readdir closedir,[have_dir_funcs=yes],AC_MSG_ERROR([required function missing])) 101 102dnl string/char functions 103echo -e $'\n'$'\n'String and character functions 104AC_CHECK_HEADERS(getopt.h ctype.h) 105AC_CHECK_FUNCS(getopt memset strcpy atoi strtok strcat strlen toupper strcmp strncmp bzero,[have_str_funcs=yes],AC_MSG_ERROR([required function missing])) 106 107dnl POSIX signal functions 108echo -e $'\n'$'\n'POSIX signal functions 109AC_CHECK_HEADERS(signal.h) 110AC_CHECK_FUNCS(sigaction sigemptyset sigaddset sigprocmask kill,[have_sigs_funcs=yes],AC_MSG_ERROR([required function missing])) 111 112dnl POSIX semaphores functions 113echo -e $'\n'$'\n'POSIX semaphores functions 114AC_CHECK_HEADERS(semaphore.h) 115AC_CHECK_LIB(rt,sem_init,[LDFLAGS="$LDFLAGS -lrt"],,$LDFLAGS) 116AC_CHECK_FUNCS(sem_init sem_destroy sem_wait sem_post,[have_sems_funcs=yes],AC_MSG_ERROR([required function missing])) 117 118dnl Utility functions 119echo -e $'\n'$'\n'Other functions 120AC_HEADER_TIME 121AC_STRUCT_TM 122AC_CHECK_HEADERS(time.h) 123AC_CHECK_FUNCS(sleep time srand rand getpid,[have_other_funcs=yes],AC_MSG_ERROR([required function missing])) 124 125dnl check for shout library path 126echo -e $'\n'$'\n'SHOUT library 127if test "$shoutdir" != "" ; then 128 CXXFLAGS="$CXXFLAGS -I$withval/include" 129 LDFLAGS="$LDFLAGS -L$withval/lib -lshout -lvorbis" 130 AC_CHECK_HEADERS($withval/include/shout/shout.h) 131else 132 PKG_CHECK_MODULES(SHOUT, shout >= 2.0) 133 CXXFLAGS="$CXXFLAGS $SHOUT_CFLAGS" 134 LDFLAGS="$LDFLAGS $SHOUT_LIBS" 135 AC_CHECK_HEADERS(shout/shout.h) 136fi 137AC_CHECK_LIB(shout,shout_init,[have_shout_funcs=yes],AC_MSG_ERROR([Could not link to libshout. IceGenerator package uses the libshout-2.0 library. Install libshout first.]),$LDFLAGS) 138 139dnl check for mysql library 140if test "$mysql_en" != "" ; then 141 echo -e $'\n'$'\n'MySQL library 142 mysql_cflags=`mysql_config --cflags` 143 mysql_lflags=`mysql_config --libs` 144 CXXFLAGS="$CXXFLAGS $mysql_cflags" 145 LDFLAGS="$LDFLAGS $mysql_lflags" 146 AC_CHECK_HEADERS(mysql/mysql.h) 147 AC_CHECK_LIB(mysqlclient,mysql_init,AC_DEFINE(HAVE_MYSQL,1,[MySQL is enabled]),AC_MSG_ERROR([Could not link to MySQL library.]),$LDFLAGS) 148fi 149 150dnl check for pgsql library 151if test "$pgsql_en" != "" ; then 152 echo -e $'\n'$'\n'PostGreSQL library 153 pgsql_cflags=`pg_config --includedir` 154 pgsql_lflags=`pg_config --libdir` 155 CXXFLAGS="$CXXFLAGS -I$pgsql_cflags" 156 LDFLAGS="$LDFLAGS -L$pgsql_lflags -lpq" 157 AC_CHECK_HEADERS(libpq-fe.h) 158 AC_CHECK_LIB(pq,PQconnectdb,AC_DEFINE(HAVE_PGSQL,1,[PgSQL is enabled]),AC_MSG_ERROR([Could not link to PgSQL library.]),$LDFLAGS) 159fi 160 161dnl check for id3 library 162if test "$id3_en" != "" ; then 163 echo -e $'\n'$'\n'ID3 library 164 AC_SEARCH_LIBS(ID3Tag_Link,"id3 -lz -lstdc++", 165 id3lib=yes 166 AC_DEFINE(HAVE_ID3, [], [Description]) 167 LDFLAGS="$LDFLAGS -lid3 -lz -lstdc++", 168 id3lib=no 169 AC_MSG_WARN(id3lib not found - disabling id3v2 support)) 170dnl AC_CHECK_HEADERS(tag.h) 171fi 172 173dnl ================================================================= 174dnl Always defined 175dnl ================================================================= 176 177AC_DEFINE(__MT__,1, 178 [Always define this, for thread safety on some platforms.]) 179 180SYSCONFDIR=`eval echo ${sysconfdir}` 181AC_SUBST(SYSCONFDIR) 182AC_DEFINE_UNQUOTED(DEFAULT_CONF_FILE,"`eval echo "${sysconfdir}/icegenerator.conf"`",[Default config file path]) 183 184AC_OUTPUT(Makefile src/Makefile) 185