Compile gptfdisk for Android.

Build sgdisk command line tool for use on Android devices.  The
command line parsing is currently written using popt, which has been
deprecated for some time, and is replaced by GNOME's glib option
parser.

Instead of pulling in either of those dependencies, this change
adds a stub that implements just enough of popt to get things
working.

Change-Id: I619f8da2e413893b4ea015a5d9e48d42637e25c8
diff --git a/android_popt.h b/android_popt.h
new file mode 100644
index 0000000..ab27c48
--- /dev/null
+++ b/android_popt.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef ANDROID_POPT_H
+#define ANDROID_POPT_H
+
+/*
+ * popt has been deprecated for some time, and is replaced by GNOME's glib
+ * option parser. Instead of pulling in either of those dependencies, this
+ * stub implements just enough of popt to get things working.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+
+#define POPT_ARG_NONE		 0U
+#define POPT_ARG_STRING		 1U
+#define POPT_ARG_INT		 2U
+
+#define POPT_AUTOHELP
+
+#pragma pack(push)
+#pragma pack(0)
+
+struct poptOption {
+    const char *longName;
+    char shortName;
+    unsigned int argInfo;
+    void *arg;
+    int val;
+    const char *descrip;
+    const char *argDescrip;
+};
+
+struct _poptContext {
+    int argc;
+    const char **argv;
+    const struct poptOption *options;
+    struct option *long_options;
+    const char *otherHelp;
+};
+
+typedef struct _poptContext *poptContext;
+
+#pragma pack(pop)
+
+poptContext poptGetContext(const char *name, int argc, const char **argv,
+        const struct poptOption *options, unsigned int flags);
+poptContext poptFreeContext(poptContext con);
+void poptResetContext(poptContext con);
+
+void poptSetOtherOptionHelp(poptContext con, const char *text);
+void poptPrintUsage(poptContext con, FILE *fp, int flags);
+
+int poptGetNextOpt(poptContext con);
+const char *poptGetArg(poptContext con);
+
+#endif