Browse code

require the user to explicitly specifiy --enable-gpl before enabling of gpl parts becomes possible print correct license if --enable-gpl is specified

Originally committed as revision 2985 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2004/04/09 23:50:00
Showing 2 changed files
... ...
@@ -30,6 +30,7 @@ echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
30 30
 echo "  --enable-amr_wb          enable amr_wb float audio codec"
31 31
 echo "  --enable-sunmlib         use Sun medialib [default=no]"
32 32
 echo "  --enable-pthreads        use pthreads [default=no]"
33
+echo "  --enable-gpl             allow use of gpl code, the resulting libav* and ffmpeg will be under gpl [default=no]"
33 34
 echo ""
34 35
 echo "Advanced options (experts only):"
35 36
 echo "  --source-path=PATH       path of source code [$source_path]"
... ...
@@ -173,6 +174,7 @@ amr_wb="no"
173 173
 amr_nb_fixed="no"
174 174
 sunmlib="no"
175 175
 pthreads="no"
176
+gpl="no"
176 177
 
177 178
 # OS specific
178 179
 targetos=`uname -s`
... ...
@@ -419,9 +421,53 @@ for opt do
419 419
   ;;
420 420
   --enable-pthreads) pthreads="yes"
421 421
   ;;
422
+  --enable-gpl) gpl="yes"
423
+  ;;
422 424
   esac
423 425
 done
424 426
 
427
+if test "$gpl" != "yes"; then
428
+    if test "$pp" != "no" -o "$shared_pp" != "no"; then
429
+        echo "The Postprocessing code is under GPL and --enable-gpl is not specified"
430
+        fail="yes"
431
+    fi
432
+
433
+    if test "$a52" != "no" -o "$a52bin" != "no"; then
434
+        echo "liba52 is under GPL and --enable-gpl is not specified"
435
+        fail="yes"
436
+    fi
437
+    
438
+    if test "$faad" != "no" -o "$faadbin" != "no"; then
439
+        cat > $TMPC << EOF
440
+            #include <faad.h>
441
+            int main( void ) { return 0; }
442
+EOF
443
+    
444
+        if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
445
+            cat > $TMPC << EOF
446
+                #include <faad.h>
447
+                #ifndef FAAD2_VERSION
448
+                ok faad1
449
+                #endif
450
+                int main( void ) { return 0; }
451
+EOF
452
+            if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
453
+                echo "faad2 is under GPL and --enable-gpl is not specified"
454
+                fail="yes"
455
+            fi
456
+        else
457
+            faad="no"
458
+            faadbin="no"
459
+            echo "faad test failed"
460
+        fi
461
+    fi
462
+   
463
+
464
+    if test "$fail" == "yes"; then
465
+        exit 1
466
+    fi
467
+fi
468
+
425 469
 # compute mmx state
426 470
 if test $mmx = "default"; then
427 471
     if test $cpu = "x86"; then
... ...
@@ -927,6 +973,11 @@ echo "pthreads support"      $pthreads
927 927
 echo "AMR-NB float support"  $amr_nb
928 928
 echo "AMR-NB fixed support"  $amr_nb_fixed
929 929
 echo "AMR-WB float support"  $amr_wb
930
+if test "$gpl" = "no" ; then
931
+echo "License: LGPL"
932
+else
933
+echo "License: GPL"
934
+fi
930 935
 
931 936
 echo "Creating config.mak and config.h"
932 937
 
... ...
@@ -1225,6 +1276,11 @@ if test "$risky" = "yes" ; then
1225 1225
   echo "CONFIG_RISKY=yes" >> config.mak
1226 1226
 fi
1227 1227
 
1228
+if test "$gpl" = "yes" ; then
1229
+  echo "#define CONFIG_GPL 1" >> $TMPH
1230
+  echo "CONFIG_GPL=yes" >> config.mak
1231
+fi
1232
+
1228 1233
 echo "#define restrict $_restrict" >> $TMPH
1229 1234
 
1230 1235
 # build tree in object directory if source path is different from current one
... ...
@@ -3488,6 +3488,21 @@ static void show_license(void)
3488 3488
 {
3489 3489
     show_banner();
3490 3490
     printf(
3491
+#ifdef CONFIG_GPL
3492
+    "This program is free software; you can redistribute it and/or modify\n"   
3493
+    "it under the terms of the GNU General Public License as published by\n"
3494
+    "the Free Software Foundation; either version 2 of the License, or\n"
3495
+    "(at your option) any later version.\n"
3496
+    "\n"
3497
+    "This program is distributed in the hope that it will be useful,\n"
3498
+    "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
3499
+    "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
3500
+    "GNU General Public License for more details.\n"
3501
+    "\n"
3502
+    "You should have received a copy of the GNU General Public License\n"
3503
+    "along with this program; if not, write to the Free Software\n"
3504
+    "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n"
3505
+#else
3491 3506
     "This library is free software; you can redistribute it and/or\n"
3492 3507
     "modify it under the terms of the GNU Lesser General Public\n"
3493 3508
     "License as published by the Free Software Foundation; either\n"
... ...
@@ -3501,6 +3516,7 @@ static void show_license(void)
3501 3501
     "You should have received a copy of the GNU Lesser General Public\n"
3502 3502
     "License along with this library; if not, write to the Free Software\n"
3503 3503
     "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n"
3504
+#endif
3504 3505
     );
3505 3506
     exit(1);
3506 3507
 }