[xiph-cvs] cvs commit: vorbis-tools/ogg123 Makefile.am cmdline_options.c

Stan Seibert volsung at xiph.org
Sat Dec 15 20:38:37 PST 2001



volsung     01/12/15 20:38:36

  Modified:    .        Tag: volsung_kc_20011011 acinclude.m4 configure.in
               ogg123   Tag: volsung_kc_20011011 Makefile.am
                        cmdline_options.c
  Log:
  More build fixes including a better libcurl test and a fix to the pthread
  test.

Revision  Changes    Path
No                   revision

No                   revision

1.9.4.2   +99 -62    vorbis-tools/acinclude.m4

Index: acinclude.m4
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/acinclude.m4,v
retrieving revision 1.9.4.1
retrieving revision 1.9.4.2
diff -u -r1.9.4.1 -r1.9.4.2
--- acinclude.m4	2001/12/15 15:26:22	1.9.4.1
+++ acinclude.m4	2001/12/16 04:38:35	1.9.4.2
@@ -102,68 +102,6 @@
   rm -f conf.oggtest
 ])
 
-dnl Shamelessly stolen from Joerg Schilling's star.
-dnl Copyright 1998 J. Schilling
-
-dnl Checks if mmap() works to get shared memory
-dnl Defines HAVE_SMMAP on success.
-AC_DEFUN(AC_FUNC_SMMAP,
-[AC_CACHE_CHECK([if mmap works to get shared memory], ac_cv_func_smmap,
-                [AC_TRY_RUN([
-#include <sys/types.h>
-#include <sys/mman.h>
-
-char *
-mkshare()
-{
-        int     size = 8192;
-        int     f;
-        char    *addr;
-
-        if ((f = open("/dev/zero", 2)) < 0)
-                exit(1);
-        addr = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, f, 0);
-        if (addr == (char *)-1)
-                exit(1);
-        close(f);
-
-        return (addr);
-}
-
-main()
-{
-        char    *addr;
-        
-        addr = mkshare(8192);
-        *addr = 'I';
-
-        switch (fork()) {
-
-        case -1:
-                printf("help\n"); exit(1);
-
-        case 0: /* child */
-                *addr = 'N';
-                _exit(0);
-                break;
-        default: /* parent */
-                wait(0);
-                sleep(1);
-                break;
-        }
-
-        if (*addr != 'N')
-                exit(1);
-        exit(0);
-}
-], 
-                [ac_cv_func_smmap=yes],
-                [ac_cv_func_smmap=no],
-                [ac_cv_func_smmap=no])])
-if test $ac_cv_func_smmap = yes; then
-  AC_DEFINE(HAVE_SMMAP)
-fi])
-
 # Configure paths for libvorbis
 # Jack Moffitt <jack at icecast.org> 10-21-2000
 # Shamelessly stolen from Owen Taylor and Manish Singh
@@ -471,4 +409,103 @@
     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
   fi
+])
+
+dnl AM_PATH_CURL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Test for libcurl, and define CURL_CFLAGS and CURL_LIBS
+dnl
+AC_DEFUN(AM_PATH_CURL,
+[dnl 
+dnl Get the cflags and libraries
+dnl
+AC_ARG_WITH(curl,[  --with-curl=PFX   Prefix where libcurl is installed (optional)], curl_prefix="$withval", curl_prefix="")
+AC_ARG_WITH(curl-libraries,[  --with-curl-libraries=DIR   Directory where libcurl library is installed (optional)], curl_libraries="$withval", curl_libraries="")
+AC_ARG_WITH(curl-includes,[  --with-curl-includes=DIR   Directory where libcurl header files are installed (optional)], curl_includes="$withval", curl_includes="")
+AC_ARG_ENABLE(curltest, [  --disable-curltest       Do not try to compile and run a test libcurl program],, enable_curltest=yes)
+
+  if test "x$curl_libraries" != "x" ; then
+    CURL_LIBS="-L$curl_libraries"
+  elif test "x$curl_prefix" != "x" ; then
+    CURL_LIBS="-L$curl_prefix/lib"
+  elif test "x$prefix" != "xNONE" ; then
+    CURL_LIBS="-L$prefix/lib"
+  fi
+
+  CURL_LIBS="$CURL_LIBS -lcurl"
+
+  if test "x$curl_includes" != "x" ; then
+    CURL_CFLAGS="-I$curl_includes"
+  elif test "x$curl_prefix" != "x" ; then
+    CURL_CFLAGS="-I$curl_prefix/include"
+  elif test "$prefix" != "xNONE"; then
+    CURL_CFLAGS="-I$prefix/include"
+  fi
+
+  AC_MSG_CHECKING(for libcurl)
+  no_curl=""
+
+
+  if test "x$enable_curltest" = "xyes" ; then
+    ac_save_CFLAGS="$CFLAGS"
+    ac_save_LIBS="$LIBS"
+    CFLAGS="$CFLAGS $CURL_CFLAGS"
+    LIBS="$LIBS $CURL_LIBS"
+dnl
+dnl Now check if the installed libcurl is sufficiently new.
+dnl
+      rm -f conf.curltest
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <curl/curl.h>
+
+int main ()
+{
+  system("touch conf.curltest");
+  return 0;
+}
+
+],, no_curl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+  fi
+
+  if test "x$no_curl" = "x" ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$1], , :, [$1])     
+  else
+     AC_MSG_RESULT(no)
+     if test -f conf.curltest ; then
+       :
+     else
+       echo "*** Could not run libcurl test program, checking why..."
+       CFLAGS="$CFLAGS $CURL_CFLAGS"
+       LIBS="$LIBS $CURL_LIBS"
+       AC_TRY_LINK([
+#include <stdio.h>
+#include <curl/curl.h>
+],     [ return 0; ],
+       [ echo "*** The test program compiled, but did not run. This usually means"
+       echo "*** that the run-time linker is not finding libcurl or finding the wrong"
+       echo "*** version of libcurl. If it is not finding libcurl, you'll need to set your"
+       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+       echo "*** is required on your system"
+       echo "***"
+       echo "*** If you have an old version installed, it is best to remove it, although"
+       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+       [ echo "*** The test program failed to compile or link. See the file config.log for the"
+       echo "*** exact error that occured. This usually means libcurl was incorrectly installed"
+       echo "*** or that you have moved libcurl since it was installed." ])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+     CURL_CFLAGS=""
+     CURL_LIBS=""
+     ifelse([$2], , :, [$2])
+  fi
+  AC_SUBST(CURL_CFLAGS)
+  AC_SUBST(CURL_LIBS)
+  rm -f conf.curltest
 ])

1.21.2.1.2.5 +24 -11    vorbis-tools/configure.in

Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/configure.in,v
retrieving revision 1.21.2.1.2.4
retrieving revision 1.21.2.1.2.5
diff -u -r1.21.2.1.2.4 -r1.21.2.1.2.5
--- configure.in	2001/12/16 01:34:59	1.21.2.1.2.4
+++ configure.in	2001/12/16 04:38:35	1.21.2.1.2.5
@@ -19,13 +19,7 @@
 
 AM_PROG_LIBTOOL
 
-dnl --------------------------------------------------  
-dnl Additional arguments
-dnl --------------------------------------------------  
 
-AC_ARG_WITH(ogg, [  --with-ogg=DIR          Set where the Ogg library is located]) 
-AC_ARG_WITH(vorbis, [  --with-vorbis=DIR          Set where the Vorbis library is located]) 
-
 dnl --------------------------------------------------
 dnl Set build flags based on environment
 dnl --------------------------------------------------
@@ -86,10 +80,9 @@
 dnl --------------------------------------------------
  
 AC_CACHE_CHECK(
-        [if compiler recognizes -pthread],
+        [if compiler natively does POSIX threads],
         ogg123_cv_gcc_pthread,
         ac_save_CFLAGS=$CFLAGS
-        CFLAGS="$CFLAGS -pthread"
         AC_LANG_SAVE
         AC_LANG_C
         AC_TRY_LINK([#include <pthread.h>],
@@ -99,10 +92,27 @@
         )
         AC_LANG_RESTORE
         CFLAGS=$ac_save_CFLAGS
+	
+        if test $ogg123_cv_gcc_pthread = no
+        then
+            CFLAGS="$CFLAGS -pthread"
+            AC_LANG_SAVE
+            AC_LANG_C
+            AC_TRY_LINK([#include <pthread.h>],
+                    [void *p = pthread_create;],
+                    ogg123_cv_gcc_pthread=flag,
+                    ogg123_cv_gcc_pthread=no
+            )
+            AC_LANG_RESTORE
+        fi
 )
 if test $ogg123_cv_gcc_pthread = yes
 then
         THREAD_LIBS=""
+        THREAD_CFLAGS=""
+elif test $ogg123_cv_gcc_pthread = flag
+then
+        THREAD_LIBS=""
         THREAD_CFLAGS="-pthread"
 else
         dnl AC_CHECK_HEADERS(pthread.h) unreliable
@@ -117,13 +127,14 @@
 AM_PATH_OGG(,AC_MSG_ERROR(Ogg needed!))
 AM_PATH_VORBIS(,AC_MSG_ERROR(Vorbis needed!))
 AM_PATH_AO(,AC_MSG_ERROR(libao needed!))
+AM_PATH_CURL(,AC_MSG_ERROR(libcurl needed!))
+
 SOCKET_LIBS=
-AC_CHECK_HEADER(curl/curl.h, , AC_MSG_ERROR(libcurl headers needed!))
-AC_CHECK_HEADER(curl/easy.h, , AC_MSG_ERROR(libcurl headers needed!))
-AC_CHECK_LIB(curl, curl_easy_perform, CURL_LIBS="-lcurl", AC_MSG_ERROR(libcurl needed!))
 AC_CHECK_LIB(socket, socket, SOCKET_LIBS="-lsocket")
 AC_CHECK_LIB(nsl, gethostbyname, SOCKET_LIBS="-lnsl $SOCKET_LIBS")
+
 SHARE_LIBS='$(top_srcdir)/share/libutf8.a $(top_srcdir)/share/libgetopt.a'
+SHARE_CFLAGS='-I$(top_srcdir)/share'
 
 dnl --------------------------------------------------
 dnl Check for library functions
@@ -153,7 +164,9 @@
 AC_SUBST(THREAD_LIBS)
 AC_SUBST(THREAD_CFLAGS)
 AC_SUBST(SOCKET_LIBS)
+AC_SUBST(SHARE_CFLAGS)
 AC_SUBST(SHARE_LIBS)
+AC_SUBST(CURL_CFLAGS)
 AC_SUBST(CURL_LIBS)
 
 AC_OUTPUT(Makefile include/Makefile share/Makefile oggenc/Makefile oggenc/man/Makefile ogg123/Makefile vorbiscomment/Makefile vcut/Makefile ogginfo/Makefile debian/Makefile)

No                   revision

No                   revision

1.14.2.4.2.7 +3 -2      vorbis-tools/ogg123/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/Makefile.am,v
retrieving revision 1.14.2.4.2.6
retrieving revision 1.14.2.4.2.7
diff -u -r1.14.2.4.2.6 -r1.14.2.4.2.7
--- Makefile.am	2001/12/16 01:34:59	1.14.2.4.2.6
+++ Makefile.am	2001/12/16 04:38:36	1.14.2.4.2.7
@@ -8,10 +8,11 @@
 mandir = @MANDIR@
 man_MANS = ogg123.1
 
-INCLUDES = @OGG_CFLAGS@ @VORBIS_CFLAGS@ @AO_CFLAGS@ @THREAD_CFLAGS@
+INCLUDES = @OGG_CFLAGS@ @VORBIS_CFLAGS@ @AO_CFLAGS@ @CURL_CFLAGS@ \
+           @THREAD_CFLAGS@ @SHARE_CFLAGS@
 
 ogg123_LDADD = @VORBISFILE_LIBS@ @VORBIS_LIBS@ @OGG_LIBS@ @AO_LIBS@ \
-		@SOCKET_LIBS@ @SHARE_LIBS@ @CURL_LIBS@ @THREAD_LIBS@
+               @SOCKET_LIBS@ @SHARE_LIBS@ @CURL_LIBS@ @THREAD_LIBS@
 ogg123_DEPENDENCIES = @SHARE_LIBS@
 ogg123_SOURCES = audio.c buffer.c callbacks.c \
                  cfgfile_options.c cmdline_options.c \

1.1.2.3   +2 -2      vorbis-tools/ogg123/Attic/cmdline_options.c

Index: cmdline_options.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/Attic/cmdline_options.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- cmdline_options.c	2001/12/11 18:46:23	1.1.2.2
+++ cmdline_options.c	2001/12/16 04:38:36	1.1.2.3
@@ -11,16 +11,16 @@
  *                                                                  *
  ********************************************************************
 
- last mod: $Id: cmdline_options.c,v 1.1.2.2 2001/12/11 18:46:23 volsung Exp $
+ last mod: $Id: cmdline_options.c,v 1.1.2.3 2001/12/16 04:38:36 volsung Exp $
 
  ********************************************************************/
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <getopt.h>
 #include <ao/ao.h>
 
+#include "getopt.h"
 #include "cmdline_options.h"
 #include "status.h"
 

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list