|
1
|
+#!/bin/sh
|
|
2
|
+set -eu
|
|
3
|
+
|
|
4
|
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
|
|
5
|
+ CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
|
|
6
|
+else
|
|
7
|
+ CROSS_COMPILE=
|
|
8
|
+fi
|
|
9
|
+
|
|
10
|
+cd "$AUTOPKGTEST_TMP"
|
|
11
|
+
|
|
12
|
+# stolen from cvt/cvt.c
|
|
13
|
+# Copyright 2005-2006 Luc Verhaegen.
|
|
14
|
+cat <<EOF > libtest.c
|
|
15
|
+#include <string.h>
|
|
16
|
+#include <stdio.h>
|
|
17
|
+#include <stdlib.h>
|
|
18
|
+#include <math.h>
|
|
19
|
+
|
|
20
|
+#include <libxcvt/libxcvt.h>
|
|
21
|
+
|
|
22
|
+/*
|
|
23
|
+ * Originally grabbed from xf86Mode.c.
|
|
24
|
+ *
|
|
25
|
+ * Ignoring the actual mode_info->name, as the user will want something solid
|
|
26
|
+ * to grab hold of.
|
|
27
|
+ */
|
|
28
|
+static void
|
|
29
|
+print_mode_line(struct libxcvt_mode_info *mode_info, int hdisplay, int vdisplay, float vrefresh,
|
|
30
|
+ bool reduced)
|
|
31
|
+{
|
|
32
|
+ if (reduced)
|
|
33
|
+ printf("Modeline \"%dx%dR\" ", hdisplay, vdisplay);
|
|
34
|
+ else
|
|
35
|
+ printf("Modeline \"%dx%d_%.2f\" ", hdisplay, vdisplay, vrefresh);
|
|
36
|
+
|
|
37
|
+ printf("%6.2f %i %i %i %i %i %i %i %i", mode_info->dot_clock / 1000.,
|
|
38
|
+ mode_info->hdisplay, mode_info->hsync_start, mode_info->hsync_end, mode_info->htotal,
|
|
39
|
+ mode_info->vdisplay, mode_info->vsync_start, mode_info->vsync_end, mode_info->vtotal);
|
|
40
|
+
|
|
41
|
+ if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_INTERLACE)
|
|
42
|
+ printf(" interlace");
|
|
43
|
+ if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_HSYNC_POSITIVE)
|
|
44
|
+ printf(" +hsync");
|
|
45
|
+ if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_HSYNC_NEGATIVE)
|
|
46
|
+ printf(" -hsync");
|
|
47
|
+ if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_VSYNC_POSITIVE)
|
|
48
|
+ printf(" +vsync");
|
|
49
|
+ if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_VSYNC_NEGATIVE)
|
|
50
|
+ printf(" -vsync");
|
|
51
|
+
|
|
52
|
+ printf("\n");
|
|
53
|
+}
|
|
54
|
+
|
|
55
|
+int
|
|
56
|
+main (int argc, char *argv[])
|
|
57
|
+{
|
|
58
|
+ struct libxcvt_mode_info *mode_info;
|
|
59
|
+ int hdisplay = 1024, vdisplay = 768;
|
|
60
|
+ float vrefresh = 60.0;
|
|
61
|
+ bool reduced = false, verbose = false;
|
|
62
|
+ bool interlaced = false;
|
|
63
|
+
|
|
64
|
+ mode_info = libxcvt_gen_mode_info(hdisplay, vdisplay, vrefresh, reduced, interlaced);
|
|
65
|
+ if (!mode_info) {
|
|
66
|
+ fprintf(stderr, "Out of memory!\n");
|
|
67
|
+ return 0;
|
|
68
|
+ }
|
|
69
|
+ print_mode_line(mode_info, hdisplay, vdisplay, vrefresh, reduced);
|
|
70
|
+ free(mode_info);
|
|
71
|
+
|
|
72
|
+ return 0;
|
|
73
|
+}
|
|
74
|
+EOF
|
|
75
|
+
|
|
76
|
+${CROSS_COMPILE}gcc -o libtest libtest.c $(${CROSS_COMPILE}pkg-config --cflags --libs libxcvt)
|
|
77
|
+echo "build ok"
|
|
78
|
+[ -x libtest ]
|
|
79
|
+./libtest
|
|
80
|
+echo "starts ok"
|